From 1d327047980fa7e482d7f4bd279361fe87481cad Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Fri, 23 Oct 2026 11:34:36 +0200 Subject: [PATCH 1/5] chore: validate test images don't exist on remote before building This is a follow up to #2209, we need to backport those changes and we need to ensure release branches will not accidentally overwrite images built in the main branch. A new `exists` make target is added to all test containers and a global check ensures at least one of the images is missing before triggering the rebuild. On normal operation, new versions of the images will be built by the main branch and be available once the QA_TAG bump is backported to release branches. In this case the paths-filter action will determine a rebuild is needed, but the new check will skip building the images. If the images are in the process of being built on the main branch and some of them are not yet pushed, the backported commit will push the images again but they will have been built in such a small span of time the resulting images will pretty much be the same. On PRs, if the containers need to be rebuilt a unique tag is generated and the step will always return the images don't exist. --- .github/workflows/test-containers-build.yml | 10 ++++++++++ tests/containers/Makefile | 2 +- tests/containers/base/Makefile | 5 ++++- tests/containers/editors/Makefile | 5 ++++- tests/containers/self-deleter/Makefile | 5 ++++- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-containers-build.yml b/.github/workflows/test-containers-build.yml index 87aa5a4b..0607ab9c 100644 --- a/.github/workflows/test-containers-build.yml +++ b/.github/workflows/test-containers-build.yml @@ -77,7 +77,17 @@ jobs: username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }} password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }} + - name: Check images already exist + id: images-exist + run: | + EXIST=false + if make -C "${GITHUB_WORKSPACE}/tests/containers" exists; then + EXIST=true + fi + echo "exist=${EXIST}" >> "${GITHUB_OUTPUT}" + - name: Build and Push containers + if: steps.images-exist.outputs.exist == 'false' env: FACT_QA_TAG: ${{ needs.determine-qa-tag.outputs.qa-tag }} PLATFORM: linux/amd64,linux/arm64 diff --git a/tests/containers/Makefile b/tests/containers/Makefile index 4eb28d59..fb24f5da 100644 --- a/tests/containers/Makefile +++ b/tests/containers/Makefile @@ -1,6 +1,6 @@ include constants.mk -TARGETS := build build-and-push +TARGETS := build build-and-push exists DIRS := $(wildcard ./*/) $(TARGETS): $(DIRS) diff --git a/tests/containers/base/Makefile b/tests/containers/base/Makefile index f29828ed..b6969172 100644 --- a/tests/containers/base/Makefile +++ b/tests/containers/base/Makefile @@ -16,4 +16,7 @@ build: run build-and-push: BUILD_ARGS = --push build-and-push: run -.PHONY: build build-and-push all run +exists: + $(DOCKER) manifest inspect quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_BASE_TAG) &>/dev/null + +.PHONY: build build-and-push all run exists diff --git a/tests/containers/editors/Makefile b/tests/containers/editors/Makefile index df1f655e..5558e918 100644 --- a/tests/containers/editors/Makefile +++ b/tests/containers/editors/Makefile @@ -16,4 +16,7 @@ build: run build-and-push: BUILD_ARGS = --push build-and-push: run -.PHONY: build build-and-push all run +exists: + $(DOCKER) manifest inspect quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_EDITORS_TAG) &>/dev/null + +.PHONY: build build-and-push all run exists diff --git a/tests/containers/self-deleter/Makefile b/tests/containers/self-deleter/Makefile index 74ed5009..fb5ca726 100644 --- a/tests/containers/self-deleter/Makefile +++ b/tests/containers/self-deleter/Makefile @@ -16,4 +16,7 @@ build: run build-and-push: BUILD_ARGS = --push build-and-push: run -.PHONY: build build-and-push all run +exists: + $(DOCKER) manifest inspect quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_SELF_DELETER_TAG) &>/dev/null + +.PHONY: build build-and-push all run exists From 0d17a460b86e7516d06d5b4661543d4e2d8676e7 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Fri, 23 Oct 2026 12:09:04 +0200 Subject: [PATCH 2/5] Global FACT_QA_TAG and portable redirections --- .github/workflows/test-containers-build.yml | 3 ++- tests/containers/base/Makefile | 2 +- tests/containers/editors/Makefile | 2 +- tests/containers/self-deleter/Makefile | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-containers-build.yml b/.github/workflows/test-containers-build.yml index 0607ab9c..6a4bb745 100644 --- a/.github/workflows/test-containers-build.yml +++ b/.github/workflows/test-containers-build.yml @@ -60,6 +60,8 @@ jobs: - should-build-test-containers if: needs.should-build-test-containers.outputs.build-image == 'true' || contains(github.event.pull_request.labels.*.name, 'rebuild-test-container') + env: + FACT_QA_TAG: ${{ needs.determine-qa-tag.outputs.qa-tag }} steps: - uses: actions/checkout@v7 @@ -89,7 +91,6 @@ jobs: - name: Build and Push containers if: steps.images-exist.outputs.exist == 'false' env: - FACT_QA_TAG: ${{ needs.determine-qa-tag.outputs.qa-tag }} PLATFORM: linux/amd64,linux/arm64 run: | make -C "${GITHUB_WORKSPACE}/tests/containers" build-and-push diff --git a/tests/containers/base/Makefile b/tests/containers/base/Makefile index b6969172..6826022d 100644 --- a/tests/containers/base/Makefile +++ b/tests/containers/base/Makefile @@ -17,6 +17,6 @@ build-and-push: BUILD_ARGS = --push build-and-push: run exists: - $(DOCKER) manifest inspect quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_BASE_TAG) &>/dev/null + $(DOCKER) manifest inspect quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_BASE_TAG) >/dev/null 2>&1 .PHONY: build build-and-push all run exists diff --git a/tests/containers/editors/Makefile b/tests/containers/editors/Makefile index 5558e918..d9616d3c 100644 --- a/tests/containers/editors/Makefile +++ b/tests/containers/editors/Makefile @@ -17,6 +17,6 @@ build-and-push: BUILD_ARGS = --push build-and-push: run exists: - $(DOCKER) manifest inspect quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_EDITORS_TAG) &>/dev/null + $(DOCKER) manifest inspect quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_EDITORS_TAG) >/dev/null 2>&1 .PHONY: build build-and-push all run exists diff --git a/tests/containers/self-deleter/Makefile b/tests/containers/self-deleter/Makefile index fb5ca726..c10e37b8 100644 --- a/tests/containers/self-deleter/Makefile +++ b/tests/containers/self-deleter/Makefile @@ -17,6 +17,6 @@ build-and-push: BUILD_ARGS = --push build-and-push: run exists: - $(DOCKER) manifest inspect quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_SELF_DELETER_TAG) &>/dev/null + $(DOCKER) manifest inspect quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_SELF_DELETER_TAG) >/dev/null 2>&1 .PHONY: build build-and-push all run exists From 6d938ed175fcaf2a1d734ca4b58e15327b4ffaf3 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Fri, 23 Oct 2026 12:49:28 +0200 Subject: [PATCH 3/5] Don't conflate network/registry errors with manifest does not exist errors --- .github/workflows/test-containers-build.yml | 38 ++++++++++++++++++--- tests/containers/Makefile | 2 +- tests/containers/base/Makefile | 6 ++-- tests/containers/editors/Makefile | 6 ++-- tests/containers/self-deleter/Makefile | 6 ++-- 5 files changed, 44 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test-containers-build.yml b/.github/workflows/test-containers-build.yml index 6a4bb745..e5ebb128 100644 --- a/.github/workflows/test-containers-build.yml +++ b/.github/workflows/test-containers-build.yml @@ -82,14 +82,44 @@ jobs: - name: Check images already exist id: images-exist run: | - EXIST=false - if make -C "${GITHUB_WORKSPACE}/tests/containers" exists; then - EXIST=true + manifest_exists() { + local image=$1 output + if output=$(docker manifest inspect "${image}" 2>&1); then + return 0 + elif echo "${output}" | grep -Eiq 'no such manifest:|manifest unknown'; then + return 1 + else + printf '%s: %s\n' "${image}" "${output}" >&2 + return 2 + fi + } + + image_names=$(make --no-print-directory -s \ + -C "${GITHUB_WORKSPACE}/tests/containers" image-names) || exit $? + + EXIST=true + while IFS= read -r image_name; do + [[ -z "${image_name}" ]] && continue + if manifest_exists "${image_name}"; then + continue + else + status=$? + fi + + if [[ "${status}" -eq 1 ]]; then + EXIST=false + else + exit "${status}" + fi + done <<< "${image_names}" + + if [[ "${EXIST}" == false ]]; then + echo "::notice::At least one test container manifest is absent" fi echo "exist=${EXIST}" >> "${GITHUB_OUTPUT}" - name: Build and Push containers - if: steps.images-exist.outputs.exist == 'false' + if: steps.images-exist.outputs.exist == 'false' || contains(github.event.pull_request.labels.*.name, 'rebuild-test-container') env: PLATFORM: linux/amd64,linux/arm64 run: | diff --git a/tests/containers/Makefile b/tests/containers/Makefile index fb24f5da..3998bc20 100644 --- a/tests/containers/Makefile +++ b/tests/containers/Makefile @@ -1,6 +1,6 @@ include constants.mk -TARGETS := build build-and-push exists +TARGETS := build build-and-push image-names DIRS := $(wildcard ./*/) $(TARGETS): $(DIRS) diff --git a/tests/containers/base/Makefile b/tests/containers/base/Makefile index 6826022d..9065f26a 100644 --- a/tests/containers/base/Makefile +++ b/tests/containers/base/Makefile @@ -16,7 +16,7 @@ build: run build-and-push: BUILD_ARGS = --push build-and-push: run -exists: - $(DOCKER) manifest inspect quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_BASE_TAG) >/dev/null 2>&1 +image-names: + @echo quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_BASE_TAG) -.PHONY: build build-and-push all run exists +.PHONY: build build-and-push all run image-names diff --git a/tests/containers/editors/Makefile b/tests/containers/editors/Makefile index d9616d3c..384d30d6 100644 --- a/tests/containers/editors/Makefile +++ b/tests/containers/editors/Makefile @@ -16,7 +16,7 @@ build: run build-and-push: BUILD_ARGS = --push build-and-push: run -exists: - $(DOCKER) manifest inspect quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_EDITORS_TAG) >/dev/null 2>&1 +image-names: + @echo quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_EDITORS_TAG) -.PHONY: build build-and-push all run exists +.PHONY: build build-and-push all run image-names diff --git a/tests/containers/self-deleter/Makefile b/tests/containers/self-deleter/Makefile index c10e37b8..0a0fd6c7 100644 --- a/tests/containers/self-deleter/Makefile +++ b/tests/containers/self-deleter/Makefile @@ -16,7 +16,7 @@ build: run build-and-push: BUILD_ARGS = --push build-and-push: run -exists: - $(DOCKER) manifest inspect quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_SELF_DELETER_TAG) >/dev/null 2>&1 +image-names: + @echo quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_SELF_DELETER_TAG) -.PHONY: build build-and-push all run exists +.PHONY: build build-and-push all run image-names From 2de7bd6bb9e288e7971de573dd4b85dd2824865f Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Fri, 23 Oct 2026 14:29:05 +0200 Subject: [PATCH 4/5] Bump QA_TAG for testing Will revert on the next commit. --- tests/containers/QA_TAG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/containers/QA_TAG b/tests/containers/QA_TAG index 0ea3a944..0d91a54c 100644 --- a/tests/containers/QA_TAG +++ b/tests/containers/QA_TAG @@ -1 +1 @@ -0.2.0 +0.3.0 From 54744c63ac2650c9a2840505e0e3cfac76601a04 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Fri, 23 Oct 2026 15:55:27 +0200 Subject: [PATCH 5/5] Revert "Bump QA_TAG for testing" This reverts commit 2de7bd6bb9e288e7971de573dd4b85dd2824865f. --- tests/containers/QA_TAG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/containers/QA_TAG b/tests/containers/QA_TAG index 0d91a54c..0ea3a944 100644 --- a/tests/containers/QA_TAG +++ b/tests/containers/QA_TAG @@ -1 +1 @@ -0.3.0 +0.2.0