From d7e390c4ad67aa700dc7b782b0403687d66b4162 Mon Sep 17 00:00:00 2001 From: Giles Hutton Date: Thu, 24 Aug 2023 14:54:53 +0100 Subject: [PATCH] Switches to using buildx properly for multi-arch and bumps grpc server image --- .../workflows/integration-test-containers.yml | 40 ++------- .../container/Makefile-constants.mk | 5 +- integration-tests/container/QA_TAG | 2 +- .../container/benchmark/Makefile | 16 +--- .../container/containerstats/Makefile | 15 +--- .../container/jsonlabel/Makefile | 15 +--- integration-tests/container/perf/Makefile | 81 +++++++------------ .../processes-listening-on-ports/Makefile | 17 ++-- .../container/schedule-curls/Makefile | 17 ++-- integration-tests/container/socat/Makefile | 17 ++-- integration-tests/images.yml | 2 +- 11 files changed, 68 insertions(+), 159 deletions(-) diff --git a/.github/workflows/integration-test-containers.yml b/.github/workflows/integration-test-containers.yml index 38a9380728..147f8f8ef7 100644 --- a/.github/workflows/integration-test-containers.yml +++ b/.github/workflows/integration-test-containers.yml @@ -34,10 +34,11 @@ jobs: id: variables run: | dirs=$(find integration-tests/container/ -type d -mindepth 1 -maxdepth 1) + json_dirs="$(echo "$dirs" | jq --raw-input --slurp 'split("\n") | map(select(. != ""))')" { echo "build-dirs<> "$GITHUB_OUTPUT" @@ -48,12 +49,12 @@ jobs: if: needs.test-containers.outputs.changed == 'true' runs-on: ubuntu-latest - env: - CONTAINER_DIRS: ${{ needs.common-variables.outputs.build-dirs }} strategy: fail-fast: false matrix: - arch: [amd64, ppc64le, s390x] + directory: ${{ fromJSON(needs.common-variables.outputs.build-dirs) }} + env: + PLATFORM: linux/amd64,linux/s390x,linux/ppc64le steps: - uses: actions/checkout@v3 @@ -73,34 +74,5 @@ jobs: - name: Build and Push containers run: | - for dir in $CONTAINER_DIRS; do - make -C "${dir}" build-and-push - done - env: - PLATFORM: linux/${{ matrix.arch }} - - push-manifest: - runs-on: ubuntu-latest - needs: - - rebuild-containers - - test-containers - - common-variables - if: needs.test-containers.outputs.changed == 'true' - env: - CONTAINER_DIRS: ${{ needs.common-variables.outputs.build-dirs }} - steps: - - uses: actions/checkout@v3 - - - name: Login to quay.io/rhacs-eng - uses: docker/login-action@v2 - with: - registry: quay.io - username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }} - password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }} - - - name: Make manifests - run: | - for dir in $CONTAINER_DIRS; do - make -C "${dir}" manifest - done + make -C "${{ matrix.directory }}" build-and-push diff --git a/integration-tests/container/Makefile-constants.mk b/integration-tests/container/Makefile-constants.mk index 7bd817c8bf..bcd86d2fcc 100644 --- a/integration-tests/container/Makefile-constants.mk +++ b/integration-tests/container/Makefile-constants.mk @@ -1,5 +1,8 @@ +# PLATFORM can be a comma separated list of platforms of the form linux/ +# it is passed to buildx, which will build for each one (this is important +# for pushing multi-arch images because `buildx --push` will push a manifest list +# containing all the relevant platforms) PLATFORM ?= linux/amd64 -IMAGE_ARCH = $(word 2,$(subst /, ,$(PLATFORM))) # path is relative to the build directory (i.e. subdirectories of integration-test/container) COLLECTOR_QA_TAG ?= $(shell cat "../QA_TAG") diff --git a/integration-tests/container/QA_TAG b/integration-tests/container/QA_TAG index 3eefcb9dd5..7dea76edb3 100644 --- a/integration-tests/container/QA_TAG +++ b/integration-tests/container/QA_TAG @@ -1 +1 @@ -1.0.0 +1.0.1 diff --git a/integration-tests/container/benchmark/Makefile b/integration-tests/container/benchmark/Makefile index b63164cecc..4f2c70a2f4 100644 --- a/integration-tests/container/benchmark/Makefile +++ b/integration-tests/container/benchmark/Makefile @@ -15,17 +15,9 @@ all: build .PHONY: build build: @docker buildx build --load --platform ${PLATFORM} \ - -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BENCHMARK_TAG)-$(IMAGE_ARCH) . + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BENCHMARK_TAG) . .PHONY: build-and-push -build-and-push: build - @docker push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BENCHMARK_TAG)-$(IMAGE_ARCH) - -.PHONY: manifest -manifest: - @docker manifest create quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BENCHMARK_TAG) \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BENCHMARK_TAG)-amd64 \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BENCHMARK_TAG)-s390x \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BENCHMARK_TAG)-ppc64le - - @docker manifest push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BENCHMARK_TAG) +build-and-push: + @docker buildx build --push --platform ${PLATFORM} \ + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BENCHMARK_TAG) . diff --git a/integration-tests/container/containerstats/Makefile b/integration-tests/container/containerstats/Makefile index d4c333b559..ecca32fef6 100644 --- a/integration-tests/container/containerstats/Makefile +++ b/integration-tests/container/containerstats/Makefile @@ -15,17 +15,10 @@ all: build .PHONY: build build: @docker buildx build --load --platform ${PLATFORM} \ - -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_STATS_TAG)-$(IMAGE_ARCH) . + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_STATS_TAG) . .PHONY: build-and-push -build-and-push: build - @docker push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_STATS_TAG)-$(IMAGE_ARCH) +build-and-push: + @docker buildx build --push --platform ${PLATFORM} \ + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_STATS_TAG) . -.PHONY: manifest -manifest: - @docker manifest create quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_STATS_TAG) \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_STATS_TAG)-amd64 \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_STATS_TAG)-s390x \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_STATS_TAG)-ppc64le - - @docker manifest push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_STATS_TAG) diff --git a/integration-tests/container/jsonlabel/Makefile b/integration-tests/container/jsonlabel/Makefile index 3101445935..312052d39c 100644 --- a/integration-tests/container/jsonlabel/Makefile +++ b/integration-tests/container/jsonlabel/Makefile @@ -15,17 +15,10 @@ all: build .PHONY: build build: @docker buildx build --load --platform ${PLATFORM} \ - -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_JSON_LABEL_TAG)-$(IMAGE_ARCH) . + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_JSON_LABEL_TAG) . .PHONY: build-and-push -build-and-push: build - @docker push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_JSON_LABEL_TAG)-$(IMAGE_ARCH) +build-and-push: + @docker buildx build --push --platform ${PLATFORM} \ + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_JSON_LABEL_TAG) . -.PHONY: manifest -manifest: - @docker manifest create quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_JSON_LABEL_TAG) \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_JSON_LABEL_TAG)-amd64 \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_JSON_LABEL_TAG)-s390x \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_JSON_LABEL_TAG)-ppc64le - - @docker manifest push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_JSON_LABEL_TAG) diff --git a/integration-tests/container/perf/Makefile b/integration-tests/container/perf/Makefile index b5a0360a7c..d61f62331b 100644 --- a/integration-tests/container/perf/Makefile +++ b/integration-tests/container/perf/Makefile @@ -20,57 +20,34 @@ all: build .PHONY: build build: - @docker buildx build --load --platform ${PLATFORM} \ - -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_INIT_TAG)-$(IMAGE_ARCH) --target init -f Dockerfile . - @docker buildx build --load --platform ${PLATFORM} \ - -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_PERF_TAG)-$(IMAGE_ARCH) --target perf -f Dockerfile . - @docker buildx build --load --platform ${PLATFORM} \ - -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BCC_TAG)-$(IMAGE_ARCH) --target bcc -f Dockerfile . - @docker buildx build --load --platform ${PLATFORM} \ - -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BPFTRACE_TAG)-$(IMAGE_ARCH) -f Dockerfile.bpftrace . + @docker buildx build --load --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_INIT_TAG) --target init -f Dockerfile . + @docker buildx build --load --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_PERF_TAG) --target perf -f Dockerfile . + @docker buildx build --load --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BCC_TAG) --target bcc -f Dockerfile . + @docker buildx build --load --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BPFTRACE_TAG) -f Dockerfile.bpftrace . .PHONY: build-and-push -build-and-push: build - @docker push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_INIT_TAG)-$(IMAGE_ARCH) - @docker push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_PERF_TAG)-$(IMAGE_ARCH) - @docker push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BCC_TAG)-$(IMAGE_ARCH) - @docker push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BPFTRACE_TAG)-$(IMAGE_ARCH) - -.PHONY: manifest -manifest: manifest-bcc manifest-bpftrace manifest-perf manifest-init - -.PHONY: manifest-bcc -manifest-bcc: - @docker manifest create quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BCC_TAG) \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BCC_TAG)-amd64 \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BCC_TAG)-s390x \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BCC_TAG)-ppc64le - - @docker manifest push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BCC_TAG) - -.PHONY: manifest-perf -manifest-perf: - @docker manifest create quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_PERF_TAG) \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_PERF_TAG)-amd64 \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_PERF_TAG)-s390x \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_PERF_TAG)-ppc64le - - @docker manifest push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_PERF_TAG) - -.PHONY: manifest-init -manifest-init: - @docker manifest create quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_INIT_TAG) \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_INIT_TAG)-amd64 \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_INIT_TAG)-s390x \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_INIT_TAG)-ppc64le - - @docker manifest push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_INIT_TAG) - -.PHONY: manifest-bpftrace -manifest-bpftrace: - @docker manifest create quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BPFTRACE_TAG) \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BPFTRACE_TAG)-amd64 \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BPFTRACE_TAG)-s390x \ - quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BPFTRACE_TAG)-ppc64le - - @docker manifest push quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BPFTRACE_TAG) +build-and-push: init perf bcc bpftrace + +.PHONY: init +init: + docker buildx build --push --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_INIT_TAG) --target init -f Dockerfile . + +.PHONY: perf +perf: + docker buildx build --push --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_PERF_TAG) --target perf -f Dockerfile . + +.PHONY: bcc +bcc: + docker buildx build --push --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BCC_TAG) --target bcc -f Dockerfile . + +.PHONY: bpftrace +bpftrace: + docker buildx build --push --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BPFTRACE_TAG) -f Dockerfile.bpftrace . diff --git a/integration-tests/container/processes-listening-on-ports/Makefile b/integration-tests/container/processes-listening-on-ports/Makefile index 510cb44b35..ebbe90f9f5 100644 --- a/integration-tests/container/processes-listening-on-ports/Makefile +++ b/integration-tests/container/processes-listening-on-ports/Makefile @@ -14,18 +14,11 @@ all: build .PHONY: build build: - @docker buildx build --load --platform ${PLATFORM} \ - -t quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_PROCESSES_LISTENING_ON_PORTS_TAG)-$(IMAGE_ARCH) . + @docker buildx build --load --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_PROCESSES_LISTENING_ON_PORTS_TAG) . .PHONY: build-and-push -build-and-push: build - @docker push quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_PROCESSES_LISTENING_ON_PORTS_TAG)-$(IMAGE_ARCH) +build-and-push: + @docker buildx build --push --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_PROCESSES_LISTENING_ON_PORTS_TAG) . -.PHONY: manifest -manifest: - @docker manifest create quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_PROCESSES_LISTENING_ON_PORTS_TAG) \ - quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_PROCESSES_LISTENING_ON_PORTS_TAG)-amd64 \ - quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_PROCESSES_LISTENING_ON_PORTS_TAG)-s390x \ - quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_PROCESSES_LISTENING_ON_PORTS_TAG)-ppc64le - - @docker manifest push quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_PROCESSES_LISTENING_ON_PORTS_TAG) diff --git a/integration-tests/container/schedule-curls/Makefile b/integration-tests/container/schedule-curls/Makefile index 6f967bb048..100d317291 100644 --- a/integration-tests/container/schedule-curls/Makefile +++ b/integration-tests/container/schedule-curls/Makefile @@ -14,18 +14,11 @@ all: build .PHONY: build build: - @docker buildx build --load --platform ${PLATFORM} \ - -t quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SCHEDULE_CURLS_TAG)-$(IMAGE_ARCH) . + @docker buildx build --load --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SCHEDULE_CURLS_TAG) . .PHONY: build-and-push -build-and-push: build - @docker push quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SCHEDULE_CURLS_TAG)-$(IMAGE_ARCH) +build-and-push: + @docker buildx build --push --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SCHEDULE_CURLS_TAG) . -.PHONY: manifest -manifest: - @docker manifest create quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SCHEDULE_CURLS_TAG) \ - quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SCHEDULE_CURLS_TAG)-amd64 \ - quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SCHEDULE_CURLS_TAG)-s390x \ - quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SCHEDULE_CURLS_TAG)-ppc64le - - @docker manifest push quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SCHEDULE_CURLS_TAG) diff --git a/integration-tests/container/socat/Makefile b/integration-tests/container/socat/Makefile index 8164e7ea2a..0fbc347531 100644 --- a/integration-tests/container/socat/Makefile +++ b/integration-tests/container/socat/Makefile @@ -14,18 +14,11 @@ all: build .PHONY: build build: - @docker buildx build --load --platform ${PLATFORM} \ - -t quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SOCAT_TAG)-$(IMAGE_ARCH) . + @docker buildx build --load --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SOCAT_TAG) . .PHONY: build-and-push -build-and-push: build - @docker push quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SOCAT_TAG)-$(IMAGE_ARCH) +build-and-push: + @docker buildx build --push --platform $(PLATFORM) \ + -t quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SOCAT_TAG) . -.PHONY: manifest -manifest: - @docker manifest create quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SOCAT_TAG) \ - quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SOCAT_TAG)-amd64 \ - quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SOCAT_TAG)-s390x \ - quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SOCAT_TAG)-ppc64le - - @docker manifest push quay.io/rhacs-eng/qa-multi-arch:$(COLLECTOR_QA_SOCAT_TAG) diff --git a/integration-tests/images.yml b/integration-tests/images.yml index eb8cd500c6..f3d9abb7d8 100644 --- a/integration-tests/images.yml +++ b/integration-tests/images.yml @@ -14,4 +14,4 @@ qa: non_qa: nginx: nginx:1.14-alpine curl: quay.io/rhacs-eng/qa-multi-arch:pstauffer-docker-curl - grpc-server: quay.io/rhacs-eng/grpc-server:4.0.x-658-g2922c23f34 + grpc-server: quay.io/rhacs-eng/grpc-server:4.1.x-780-g5d8b38fe4d