test: expose the action at the repository root to probe uses URL parsing

This commit is contained in:
2026-08-09 15:16:58 +02:00
parent 4dee87df56
commit 562f469fbc
+45
View File
@@ -0,0 +1,45 @@
name: Resolve buildx cache settings
description: >-
Turns the DOCKER_CACHE_* variables exported by the runner into buildx driver options and
cache refs. Missing variables degrade the job to a build without cache instead of failing it.
inputs:
cache-image:
description: Cache image path without the registry host (e.g. "org/repo/app").
required: true
outputs:
driver-opts:
description: driver-opts for docker/setup-buildx-action; empty when the cache registry needs no network pinning.
value: ${{ steps.resolve.outputs.driver-opts }}
cache-from:
description: cache-from ref for docker/build-push-action; empty disables cache reads.
value: ${{ steps.resolve.outputs.cache-from }}
cache-to:
description: cache-to ref for docker/build-push-action; empty disables cache writes.
value: ${{ steps.resolve.outputs.cache-to }}
runs:
using: composite
steps:
- id: resolve
shell: bash
env:
CACHE_IMAGE: ${{ inputs.cache-image }}
run: |
if [ -n "${DOCKER_CACHE_NETWORK}" ]; then
echo "driver-opts=network=${DOCKER_CACHE_NETWORK}" >> "$GITHUB_OUTPUT"
else
echo "driver-opts=" >> "$GITHUB_OUTPUT"
fi
if [ -z "${DOCKER_CACHE_TYPE}" ] || [ -z "${DOCKER_CACHE_SERVER}" ]; then
echo "::warning::DOCKER_CACHE_* not set on the runner - building without cache"
echo "cache-from=" >> "$GITHUB_OUTPUT"
echo "cache-to=" >> "$GITHUB_OUTPUT"
exit 0
fi
ref="${DOCKER_CACHE_SERVER}/${CACHE_IMAGE}:cache"
echo "cache-from=type=${DOCKER_CACHE_TYPE},ref=${ref},registry.insecure=true" >> "$GITHUB_OUTPUT"
echo "cache-to=type=${DOCKER_CACHE_TYPE},ref=${ref},registry.insecure=true,mode=max" >> "$GITHUB_OUTPUT"