Skip to content

Commit

Permalink
Automates integration test container builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Stringy committed Aug 16, 2023
1 parent 5ca200b commit 2551e0f
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 24 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/integration-test-containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
on:
push:
pull_request:

jobs:
test-containers:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.filter.outputs.container }}
changed_files: ${{ steps.filter.outputs.container_files }}
steps:
- uses: actions/checkout@v3

- uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
filters: |
container:
- integration-tests/container/**
rebuild-containers:
needs: test-containers
if: ${{ needs.test-containers.outputs.changed == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [amd64, ppc64le, s390x]

steps:
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Get changed containers
run: |
dirs=$(dirname ${{ needs.test-containers.outputs.changed_files }} | sort | uniq )
echo "CONTAINER_DIRS=$dirs" >> "$GITHUB_ENV"
- name: Build containers
run: |
for dir in $CONTAINER_DIRS; do
make -C "integration-tests/container/$dir" build
done
env:
PLATFORM: linux/${{ matrix.arch }}
IMAGE_SUFFIX: ${{ matrix.arch }}

- name: Push containers
if: github.event_name == 'push'
run: |
for dir in $CONTAINER_DIRS; do
make -C "integration-tests/container/$dir" push
done
env:
PLATFORM: linux/${{ matrix.arch }}
IMAGE_SUFFIX: ${{ matrix.arch }}

push-manifest:
runs-on: ubuntu-latest
needs:
- rebuild-containers
- test-containers
if: needs.test-containers.outputs.changed == 'true' && github.event_name == 'push'
steps:
- uses: actions/checkout@v3

- name: Get changed containers
run: |
dirs=$(dirname ${{ needs.test-containers.outputs.changed_files }} | sort | uniq )
echo "CONTAINER_DIRS=$dirs" >> "$GITHUB_ENV"
- name: Make manifests
run: |
for dir in $CONTAINER_DIRS; do
make -C "integration-tests/container/$dir" manifest
done
2 changes: 2 additions & 0 deletions integration-tests/container/Makefile-constants.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PLATFORM ?= linux/amd64
IMAGE_SUFFIX ?=
21 changes: 15 additions & 6 deletions integration-tests/container/benchmark/Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
BASE_PATH = .
include ../Makefile-constants.mk

DEFAULT_GOAL = all

COLLECTOR_QA_BENCHMARK_TAG := phoronix

ifneq ($(COLLECTOR_QA_TAG),)
COLLECTOR_QA_BENCHMARK_TAG=phoronix-$(COLLECTOR_QA_TAG)
COLLECTOR_QA_BENCHMARK_TAG=phoronix-$(COLLECTOR_QA_TAG)$(IMAGE_SUFFIX)
endif

PLATFORM ?= linux/amd64


.PHONY: all
all:
@docker buildx build --load --platform ${PLATFORM} \
-t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BENCHMARK_TAG) .
-t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BENCHMARK_TAG)$(IMAGE_SUFFIX) .

.PHONY: push
push:
@docker buildx build --push --platform ${PLATFORM} \
-t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BENCHMARK_TAG) .
-t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BENCHMARK_TAG)$(IMAGE_SUFFIX) .

.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)
16 changes: 13 additions & 3 deletions integration-tests/container/containerstats/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
BASE_PATH = .
include ../Makefile-constants.mk

.DEFAULT_GOAL = all

COLLECTOR_QA_STATS_TAG := stats

ifneq ($(COLLECTOR_QA_TAG),)
COLLECTOR_QA_STATS_TAG=stats-$(COLLECTOR_QA_TAG)
COLLECTOR_QA_STATS_TAG=stats-$(COLLECTOR_QA_TAG)$(IMAGE_SUFFIX)
endif

PLATFORM ?= linux/amd64

.PHONY: all
all:
@docker buildx build --load --platform ${PLATFORM} \
Expand All @@ -17,3 +18,12 @@ all:
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)
16 changes: 13 additions & 3 deletions integration-tests/container/jsonlabel/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
BASE_PATH = .
include ../Makefile-constants.mk

.DEFAULT_GOAL = all

COLLECTOR_QA_JSON_LABEL_TAG := json-label

ifneq ($(COLLECTOR_QA_TAG),)
COLLECTOR_QA_JSON_LABEL_TAG=json-label-$(COLLECTOR_QA_TAG)
COLLECTOR_QA_JSON_LABEL_TAG=json-label-$(COLLECTOR_QA_TAG)$(IMAGE_SUFFIX)
endif

PLATFORM ?= linux/amd64

.PHONY: all
all:
@docker buildx build --load --platform ${PLATFORM} \
Expand All @@ -17,3 +18,12 @@ all:
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)
52 changes: 46 additions & 6 deletions integration-tests/container/perf/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
BASE_PATH = .
include ../Makefile-constants.mk

.DEFAULT_GOAL = all

COLLECTOR_QA_INIT_TAG := init
Expand All @@ -6,14 +9,12 @@ COLLECTOR_QA_BCC_TAG := bcc
COLLECTOR_QA_BPFTRACE_TAG := bpftrace

ifneq ($(COLLECTOR_QA_TAG),)
COLLECTOR_QA_INIT_TAG=init-$(COLLECTOR_QA_TAG)
COLLECTOR_QA_PERF_TAG=perf-$(COLLECTOR_QA_TAG)
COLLECTOR_QA_BCC_TAG=bcc-$(COLLECTOR_QA_TAG)
COLLECTOR_QA_BPFTRACE_TAG=bpftrace-$(COLLECTOR_QA_TAG)
COLLECTOR_QA_INIT_TAG=init-$(COLLECTOR_QA_TAG)$(IMAGE_SUFFIX)
COLLECTOR_QA_PERF_TAG=perf-$(COLLECTOR_QA_TAG)$(IMAGE_SUFFIX)
COLLECTOR_QA_BCC_TAG=bcc-$(COLLECTOR_QA_TAG)$(IMAGE_SUFFIX)
COLLECTOR_QA_BPFTRACE_TAG=bpftrace-$(COLLECTOR_QA_TAG)$(IMAGE_SUFFIX)
endif

PLATFORM ?= linux/amd64

.PHONY: all
all:
@docker buildx build --load --platform ${PLATFORM} \
Expand All @@ -35,3 +36,42 @@ push:
-t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BCC_TAG) --target bcc -f Dockerfile .
@docker buildx build --push --platform ${PLATFORM} \
-t quay.io/rhacs-eng/collector-performance:$(COLLECTOR_QA_BPFTRACE_TAG) -f Dockerfile.bpftrace .

.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)
16 changes: 13 additions & 3 deletions integration-tests/container/processes-listening-on-ports/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
BASE_PAT = .
include ../Makefile-constants.mk

.DEFAULT_GOAL = all

COLLECTOR_QA_PROCESSES_LISTENING_ON_PORTS_TAG := collector-processes-listening-on-ports

ifneq ($(COLLECTOR_QA_TAG),)
COLLECTOR_QA_PROCESSES_LISTENING_ON_PORTS_TAG=collector-processes-listening-on-ports-$(COLLECTOR_QA_TAG)
COLLECTOR_QA_PROCESSES_LISTENING_ON_PORTS_TAG=collector-processes-listening-on-ports-$(COLLECTOR_QA_TAG)$(IMAGE_SUFFIX)
endif

PLATFORM ?= linux/amd64

.PHONY: all
all:
@docker buildx build --load --platform ${PLATFORM} \
Expand All @@ -17,3 +18,12 @@ all:
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)
16 changes: 13 additions & 3 deletions integration-tests/container/schedule-curls/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
BASE_PATH = .
include ../Makefile-constants.mk

.DEFAULT_GOAL = all

COLLECTOR_QA_SCHEDULE_CURLS_TAG := collector-schedule-curls

ifneq ($(COLLECTOR_QA_TAG),)
COLLECTOR_QA_SCHEDULE_CURLS_TAG=collector-schedule-curls-$(COLLECTOR_QA_TAG)
COLLECTOR_QA_SCHEDULE_CURLS_TAG=collector-schedule-curls-$(COLLECTOR_QA_TAG)$(IMAGE_SUFFIX)
endif

PLATFORM ?= linux/amd64

.PHONY: all
all:
@docker buildx build --load --platform ${PLATFORM} \
Expand All @@ -17,3 +18,12 @@ all:
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)

0 comments on commit 2551e0f

Please sign in to comment.