Compare commits

..

1 Commits

Author SHA1 Message Date
Tommy Malmqvist
0147fa5df8
Merge f20f287d5b into 4532346e13 2025-09-17 08:17:03 +00:00

View File

@ -26,55 +26,26 @@ inputs:
runs:
using: "composite"
steps:
- id: pull-with-credentials
name: Pull image using provided credentials
- id: login
name: Login to registry (if credentials provided)
if: ${{ inputs.registry_username && inputs.registry_password && inputs.registry }}
shell: bash
env:
IMAGE_INPUT: ${{ inputs.image }}
REGISTRY: ${{ inputs.registry }}
REG_USER: ${{ inputs.registry_username }}
REG_PASS: ${{ inputs.registry_password }}
run: |
set -euo pipefail
IMAGE="$IMAGE_INPUT"
if [ -n "$REGISTRY" ]; then
REG="${REGISTRY%/}"
IMAGE="$REG/$IMAGE"
if [ -z "$REGISTRY" ] || [ -z "$REG_USER" ] || [ -z "$REG_PASS" ]; then
echo "Missing registry or credentials; skipping login"
exit 0
fi
echo "Using image: $IMAGE"
echo "Credentials provided; attempting docker login to $REGISTRY"
# Mask sensitive values
if [ -n "$REG_PASS" ]; then
echo "::add-mask::$REG_PASS"
fi
echo "Logging into registry: $REGISTRY"
echo "$REG_PASS" | docker login "$REGISTRY" --username "$REG_USER" --password-stdin
if docker pull "$IMAGE" >/dev/null 2>&1; then
echo "Image pulled successfully after login."
else
echo "Failed to pull image after login; proceeding to run (docker run may fail)."
fi
- id: pull-anonymous
name: Pull image anonymously
if: ${{ !(inputs.registry_username && inputs.registry_password && inputs.registry) }}
shell: bash
env:
IMAGE_INPUT: ${{ inputs.image }}
REGISTRY: ${{ inputs.registry }}
run: |
set -euo pipefail
IMAGE="$IMAGE_INPUT"
if [ -n "$REGISTRY" ]; then
REG="${REGISTRY%/}"
IMAGE="$REG/$IMAGE"
fi
echo "Using image: $IMAGE"
echo "No credentials provided (or registry not set); attempting anonymous pull"
if docker pull "$IMAGE" >/dev/null 2>&1; then
echo "Anonymous pull succeeded."
else
echo "Anonymous pull failed; proceeding to run (docker run may fail if auth required)."
fi
- id: run
name: Run yq container