Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion .github/workflows/test-containers-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -77,9 +79,48 @@ jobs:
username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}

- name: Check images already exist
id: images-exist
run: |
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
Comment thread
coderabbitai[bot] marked this conversation as resolved.
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' || contains(github.event.pull_request.labels.*.name, 'rebuild-test-container')
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
2 changes: 1 addition & 1 deletion tests/containers/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include constants.mk

TARGETS := build build-and-push
TARGETS := build build-and-push image-names
DIRS := $(wildcard ./*/)

$(TARGETS): $(DIRS)
Expand Down
5 changes: 4 additions & 1 deletion tests/containers/base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ build: run
build-and-push: BUILD_ARGS = --push
build-and-push: run

.PHONY: build build-and-push all run
image-names:
@echo quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_BASE_TAG)

.PHONY: build build-and-push all run image-names
5 changes: 4 additions & 1 deletion tests/containers/editors/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ build: run
build-and-push: BUILD_ARGS = --push
build-and-push: run

.PHONY: build build-and-push all run
image-names:
@echo quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_EDITORS_TAG)

.PHONY: build build-and-push all run image-names
5 changes: 4 additions & 1 deletion tests/containers/self-deleter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ build: run
build-and-push: BUILD_ARGS = --push
build-and-push: run

.PHONY: build build-and-push all run
image-names:
@echo quay.io/rhacs-eng/qa-multi-arch:$(FACT_QA_SELF_DELETER_TAG)

.PHONY: build build-and-push all run image-names
Loading