From 2092353c8b828105f3f47e40e094ed3153ce0531 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 7 Sep 2026 07:23:39 +0200 Subject: [PATCH] ci : add container image checking and tagging (wip) (#28394) This commit contains a suggestion for handling container images which are currently not semver tagged, they only have build numbers in there tags. The proposed solution here is to first add a check to make sure that there are container images built for the build number of the release and if not fail the build. The container images are build nightly but they can be triggered manually as well. If the the container images check passes then the make-release workflow will re-tag the images with the semver. --- .github/workflows/make-release.yml | 24 ++++++++++++++++ scripts/make-release-checks.sh | 45 ++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index 40fc86287..6644a80cc 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -19,6 +19,7 @@ env: permissions: contents: write + packages: write jobs: make-release: @@ -113,6 +114,29 @@ jobs: data: await fs.readFileSync('./nightly-tag.txt') }); + - name: Re-tag container images with release version + if: ${{ github.event.inputs.dry_run == 'false' && steps.desc.outputs.nightly_tag != '' }} + env: + GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} + run: | + VERSION="${{ steps.checks.outputs.version }}" + NIGHTLY_TAG="${{ steps.desc.outputs.nightly_tag }}" + REPO_OWNER="${GITHUB_REPOSITORY_OWNER,,}" + IMAGE_REPO="ghcr.io/${REPO_OWNER}/${{ github.event.repository.name }}" + + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin + + VARIANTS=("" "-cuda" "-cuda13" "-vulkan" "-rocm" "-intel" "-musa" "-openvino") + TYPES=("full" "light" "server") + for type in "${TYPES[@]}"; do + for variant in "${VARIANTS[@]}"; do + src="${IMAGE_REPO}:${type}${variant}-${NIGHTLY_TAG}" + dst="${IMAGE_REPO}:${type}${variant}-${VERSION}" + echo "Tagging ${src} -> ${dst}" + docker buildx imagetools create --tag "${dst}" "${src}" + done + done + - name: Dry run summary if: ${{ github.event.inputs.dry_run == 'true' }} run: | diff --git a/scripts/make-release-checks.sh b/scripts/make-release-checks.sh index bc575e5a4..32c193745 100755 --- a/scripts/make-release-checks.sh +++ b/scripts/make-release-checks.sh @@ -120,6 +120,51 @@ else fi fi +echo "Checking container images for commit ${SHA}..." +NIGHTLY_TAG="$(git tag --points-at "${SHA}" | grep -E '(^|-)b[0-9]+(-[0-9a-f]{7})?$' | head -n 1 || true)" +if [[ -z "${NIGHTLY_TAG}" ]]; then + echo "Warning: no nightly tag points at ${SHA} - skipping container image check" +elif [[ -z "${GITHUB_REPOSITORY:-}" ]]; then + echo "Warning: GITHUB_REPOSITORY not set - skipping container image check (local run)" +else + CONTAINER_REPO="${GITHUB_REPOSITORY,,}" # lower-case owner/repo for ghcr.io + GHCR_TOKEN="$(curl -fsSL \ + "https://ghcr.io/token?scope=repository:${CONTAINER_REPO}:pull&service=ghcr.io" \ + | grep -oP '"token"\s*:\s*"\K[^"]+')" + + VARIANTS=("" "-cuda" "-cuda13" "-vulkan" "-rocm" "-intel" "-musa" "-openvino") + TYPES=("full" "light" "server") + CONTAINER_ERR="" + for type in "${TYPES[@]}"; do + for variant in "${VARIANTS[@]}"; do + tag="${type}${variant}-${NIGHTLY_TAG}" + STATUS="$(curl -s -o /dev/null -w "%{http_code}" \ + -H "Authorization: Bearer ${GHCR_TOKEN}" \ + -H "Accept: application/vnd.oci.image.index.v1+json,application/vnd.docker.distribution.manifest.list.v2+json" \ + "https://ghcr.io/v2/${CONTAINER_REPO}/manifests/${tag}")" + if [[ "${STATUS}" == "200" ]]; then + echo " ${tag} - OK" + else + echo " ${tag} - MISSING" + CONTAINER_ERR+=" ${tag}" + fi + done + done + + if [[ -n "${CONTAINER_ERR}" ]]; then + if [[ "$DRY_RUN" == "true" ]]; then + echo "Warning: missing container images for ${NIGHTLY_TAG}:${CONTAINER_ERR} (dry run, continuing)." + CHECKS_PASSED=false + else + echo "Error: missing container images for ${NIGHTLY_TAG}:${CONTAINER_ERR}" + echo "The Docker workflow must complete successfully before making a release." + exit 1 + fi + else + echo "All container images found for ${NIGHTLY_TAG} - OK" + fi +fi + if [[ -n "${GITHUB_OUTPUT:-}" ]]; then echo "checks_passed=${CHECKS_PASSED}" >> "$GITHUB_OUTPUT" fi