Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switches to using buildx properly for multi-arch #1307

Merged
merged 1 commit into from
Aug 25, 2023
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
40 changes: 6 additions & 34 deletions .github/workflows/integration-test-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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<<EOS"
echo "$dirs"
echo "$json_dirs"
echo "EOS"
} >> "$GITHUB_OUTPUT"

Expand All @@ -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
Expand All @@ -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

5 changes: 4 additions & 1 deletion integration-tests/container/Makefile-constants.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# PLATFORM can be a comma separated list of platforms of the form linux/<arch>
# 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")
2 changes: 1 addition & 1 deletion integration-tests/container/QA_TAG
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.0.1
16 changes: 4 additions & 12 deletions integration-tests/container/benchmark/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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) .
15 changes: 4 additions & 11 deletions integration-tests/container/containerstats/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
15 changes: 4 additions & 11 deletions integration-tests/container/jsonlabel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
81 changes: 29 additions & 52 deletions integration-tests/container/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Original file line number Diff line number Diff line change
Expand Up @@ -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)
17 changes: 5 additions & 12 deletions integration-tests/container/schedule-curls/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
17 changes: 5 additions & 12 deletions integration-tests/container/socat/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion integration-tests/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading