Skip to content

Commit 6f813b7

Browse files
allisonkarlitskayamartinpitt
authored andcommitted
workflows: build a multi-arch tasks container
Build a tasks container for arm64 in addition to amd64. We do this by splitting the build process into multiple jobs. For the arm one, we make use of the arm runners from BuildJet. At the end, we write the manifest and upload that with the "public" tag name. Remove the local infrastructure and rules for pushing the container; it's not so easy anymore.
1 parent 8669352 commit 6f813b7

File tree

3 files changed

+56
-28
lines changed

3 files changed

+56
-28
lines changed

.github/workflows/build-tasks.yml

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,68 @@
11
name: build-tasks
2+
23
on:
34
# this is meant to be run on an approved PR branch for convenience
45
workflow_dispatch:
6+
7+
# We derive a unique ID here to make sure that we don't get into a situation
8+
# where different runners pick different tags (eg: for builds near midnight, or
9+
# in different time zones). The manifest job picks the final name.
10+
env:
11+
tag: quay.io/cockpit/tasks
12+
tmptag: quay.io/cockpit/tasks-tmp:${{ github.run_id }}.${{ github.run_attempt }}
13+
514
jobs:
615
build:
7-
runs-on: ubuntu-22.04
16+
strategy:
17+
matrix:
18+
build:
19+
- label: amd64
20+
runner: buildjet-2vcpu-ubuntu-2204
21+
- label: arm64
22+
runner: buildjet-2vcpu-ubuntu-2204-arm
23+
24+
runs-on: ${{ matrix.build.runner }}
825
environment: quay.io
9-
timeout-minutes: 30
26+
timeout-minutes: 10
27+
1028
steps:
11-
- name: Clone repository
29+
# NB: no podman on buildjet arm runners
30+
-
31+
name: Log in to container registry
32+
uses: docker/login-action@v3
33+
with:
34+
registry: quay.io
35+
username: ${{ secrets.QUAY_BOTUSER }}
36+
password: ${{ secrets.QUAY_TOKEN }}
37+
-
38+
name: Checkout
1239
uses: actions/checkout@v4
40+
-
41+
name: Build and push
42+
uses: docker/build-push-action@v5
43+
with:
44+
push: true
45+
tags: ${{ env.tmptag }}-${{ matrix.build.label }}
46+
context: tasks/container
47+
file: tasks/container/Containerfile
1348

14-
- name: Log into container registry
15-
run: podman login -u ${{ secrets.QUAY_BOTUSER }} -p ${{ secrets.QUAY_TOKEN }} quay.io
49+
manifest:
50+
needs: build
1651

17-
- name: Build tasks container
18-
run: make tasks-container
52+
runs-on: buildjet-2vcpu-ubuntu-2204
53+
environment: quay.io
54+
timeout-minutes: 5
1955

20-
- name: Push container to registry
21-
run: make tasks-push
56+
steps:
57+
-
58+
name: Login in to container registry
59+
run: podman login -u ${{ secrets.QUAY_BOTUSER }} -p ${{ secrets.QUAY_TOKEN }} quay.io
60+
-
61+
name: Create manifest
62+
run: podman manifest create tasks '${{ env.tmptag }}'-{amd,arm}64
63+
-
64+
name: Push with versioned tag
65+
run: podman manifest push tasks "${{ env.tag }}:$(date --iso-8601)"
66+
-
67+
name: Push :latest tag
68+
run: podman manifest push tasks "${{ env.tag }}:latest"

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
all:
22
@echo "usage: make containers" >&2
33
@echo " make tasks-container" >&2
4-
@echo " make tasks-push" >&2
54
@echo " make check" >&2
65

76
check:
@@ -19,8 +18,5 @@ tasks-container:
1918
$(DOCKER) build -t quay.io/cockpit/tasks:$(TAG) tasks/container
2019
$(DOCKER) tag quay.io/cockpit/tasks:$(TAG) quay.io/cockpit/tasks:latest
2120

22-
tasks-push:
23-
./push-container quay.io/cockpit/tasks
24-
2521
tasks-secrets:
2622
@cd tasks && ./build-secrets $(TASK_SECRETS)

push-container

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)