48 lines
1.7 KiB
YAML
48 lines
1.7 KiB
YAML
name: skopeo-inspect
|
|
description: Check for the existence of a containerd image.
|
|
inputs:
|
|
registry_host:
|
|
description: A containerd registry host.
|
|
required: false
|
|
default: ${{ vars.INTELIGR8_REGISTRY_HOST }}
|
|
image_namespace:
|
|
description: A containerd image prefix.
|
|
required: false
|
|
default: ${{ vars.INTELIGR8_IMAGE_NAMESPACE }}
|
|
image_name:
|
|
description: A containerd image name, without the host and prefix.
|
|
required: true
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- id: containerd_debug
|
|
uses: ./.gitea/actions/containerd-debug
|
|
- id: skopeo_inspect
|
|
env:
|
|
REGISTRY_HOST: ${{ inputs.registry_host }}
|
|
IMAGE_NAMESPACE: ${{ inputs.image_namespace }}
|
|
IMAGE_NAME: ${{ inputs.image_name }}
|
|
SKOPEO_DEBUG_OPTS: ${{ steps.containerd_debug.outputs.skopeo_debug_opts }}
|
|
shell: bash
|
|
run: |
|
|
GIT_COMMIT_SHORT_SHA=${GITHUB_SHA::8}
|
|
IMAGE_REMOTE_NAME=${REGISTRY_HOST}/${IMAGE_NAMESPACE}${IMAGE_NAME}
|
|
|
|
set +e
|
|
echo "Checking for image: ${IMAGE_REMOTE_NAME}:sha${GIT_COMMIT_SHORT_SHA}"
|
|
skopeo ${SKOPEO_OPTS} ${SKOPEO_DEBUG_OPTS} inspect docker://${IMAGE_REMOTE_NAME}:sha${GIT_COMMIT_SHORT_SHA}
|
|
SKOPEO_INSPECT_RC=$?
|
|
set -e
|
|
|
|
if (( ${SKOPEO_INSPECT_RC} == 0 )); then
|
|
echo "Found image: ${IMAGE_REMOTE_NAME}:sha${GIT_COMMIT_SHORT_SHA}"
|
|
echo "image_exists=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "Could not find image: ${IMAGE_REMOTE_NAME}:sha${GIT_COMMIT_SHORT_SHA}"
|
|
echo "image_exists=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
outputs:
|
|
image_exists:
|
|
description: `true` if the containerd image exists; `false` otherwise
|
|
value: ${{ steps.skopeo_inspect.outputs.image_exists }}
|