Skip to content

Commit 3ebb2b8

Browse files
authored
Rework arm artifact build (#3117)
Signed-off-by: Itxaka <[email protected]>
1 parent c419e8d commit 3ebb2b8

9 files changed

+282
-849
lines changed

.github/workflows/image-arm-pr.yaml

-65
This file was deleted.

.github/workflows/image-arm.yaml .github/workflows/image-master-arm.yaml

+34-185
Original file line numberDiff line numberDiff line change
@@ -22,82 +22,45 @@ jobs:
2222
git fetch --prune --unshallow
2323
- id: set-matrix
2424
run: |
25-
content=`cat ./.github/flavors.json | jq -r 'map(select(.arch == "arm64" and .variant == "core" and .model != "generic"))'`
26-
# the following lines are only required for multi line json
27-
content="${content//'%'/'%25'}"
28-
content="${content//$'\n'/'%0A'}"
29-
content="${content//$'\r'/'%0D'}"
30-
# end of optional handling for multi line json
31-
echo "::set-output name=matrix::{\"include\": $content }"
32-
33-
get-core-matrix-generic:
34-
runs-on: ubuntu-latest
35-
outputs:
36-
matrix: ${{ steps.set-matrix.outputs.matrix }}
37-
steps:
38-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
39-
with:
40-
fetch-depth: 0
41-
- id: set-matrix
42-
run: |
43-
content=`cat ./.github/flavors.json | jq -r 'map(select(.arch == "arm64" and .variant == "core" and .model == "generic"))'`
44-
# the following lines are only required for multi line json
45-
content="${content//'%'/'%25'}"
46-
content="${content//$'\n'/'%0A'}"
47-
content="${content//$'\r'/'%0D'}"
48-
# end of optional handling for multi line json
49-
echo "::set-output name=matrix::{\"include\": $content }"
50-
51-
# The matrix for standard (provider) images
52-
get-standard-matrix:
53-
runs-on: ubuntu-latest
54-
outputs:
55-
matrix: ${{ steps.set-matrix.outputs.matrix }}
56-
steps:
57-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
58-
with:
59-
fetch-depth: 0
60-
- run: |
61-
sudo apt update && sudo apt install -y jq
62-
- name: Set up QEMU
63-
uses: docker/setup-qemu-action@master
64-
with:
65-
platforms: all
66-
- name: Set up Docker Buildx
67-
id: buildx
68-
uses: docker/setup-buildx-action@master
69-
- name: Install earthly
70-
uses: Luet-lab/luet-install-action@cec77490c3f2416d7d07a47cfab04d448641d7ce # v1.1
71-
with:
72-
repository: quay.io/kairos/packages
73-
packages: utils/earthly
74-
- id: set-matrix
75-
run: |
76-
docker run --name luet quay.io/luet/base && docker cp luet:/usr/bin/luet ./
77-
chmod +x luet
78-
sudo mv luet /usr/bin/luet
79-
# Construct an array like this from the found versions:
80-
earthly --platform=linux/arm64 +extract-framework-profile
81-
# fetch "k3s-openrc" versions
82-
sudo luet --config framework-profile.yaml search -o json k8s/k3s | jq '.packages | map(select(.name == "k3s-openrc")) | map(.version) | unique' > k3s_openrc.json
83-
# fetch alpine flavors
84-
jq 'map(select(.arch == "arm64" and .variant == "standard" and .model != "generic" and .flavor == "alpine"))' .github/flavors.json > flavors_openrc.json
85-
# generate combinations
86-
jq -s '. | [combinations | .[0] + {"k3s_version": .[1]}]' flavors_openrc.json k3s_openrc.json > combinations_openrc.json
87-
# fetch "k3s-systemd" versions
88-
sudo luet --config framework-profile.yaml search -o json k8s/k3s | jq '.packages | map(select(.name == "k3s-systemd")) | map(.version) | unique' > k3s_systemd.json
89-
# fetch non-alpine flavors
90-
jq 'map(select(.arch == "arm64" and .variant == "standard" and .model != "generic" and .flavor != "alpine"))' .github/flavors.json > flavors_systemd.json
91-
# generate combinations
92-
jq -s '. | [combinations | .[0] + {"k3s_version": .[1]}]' flavors_systemd.json k3s_systemd.json > combinations_systemd.json
93-
# merge the two combinations
94-
content=$(jq -s 'add' combinations_openrc.json combinations_systemd.json)
25+
content=`cat ./.github/flavors.json | jq -r 'map(select(.arch == "arm64" and .variant == "core"))'`
9526
# the following lines are only required for multi line json
9627
content="${content//'%'/'%25'}"
9728
content="${content//$'\n'/'%0A'}"
9829
content="${content//$'\r'/'%0D'}"
9930
# end of optional handling for multi line json
10031
echo "::set-output name=matrix::{\"include\": $content }"
32+
build-arm-core:
33+
uses: ./.github/workflows/reusable-docker-arm-build.yaml
34+
name: ${{ matrix.variant }}-${{ matrix.model }}
35+
permissions:
36+
id-token: write # OIDC support
37+
contents: write
38+
security-events: write
39+
actions: read
40+
attestations: read
41+
checks: read
42+
deployments: read
43+
discussions: read
44+
issues: read
45+
packages: read
46+
pages: read
47+
pull-requests: read
48+
repository-projects: read
49+
statuses: read
50+
secrets: inherit
51+
with:
52+
flavor: ${{ matrix.flavor }}
53+
flavor_release: ${{ matrix.flavorRelease }}
54+
family: ${{ matrix.family }}
55+
model: ${{ matrix.model }}
56+
base_image: ${{ matrix.baseImage }}
57+
worker: ${{ matrix.worker }}
58+
variant: ${{ matrix.variant }}
59+
needs:
60+
- get-core-matrix
61+
strategy:
62+
fail-fast: false
63+
matrix: ${{fromJson(needs.get-core-matrix.outputs.matrix)}}
10164
build-nvidia-base:
10265
runs-on: fast
10366
steps:
@@ -211,121 +174,7 @@ jobs:
211174
base_image: quay.io/kairos/cache:nvidia-base
212175
model: nvidia-jetson-agx-orin
213176
worker: ARM64
214-
build-arm-core:
215-
uses: ./.github/workflows/reusable-docker-arm-build.yaml
216-
permissions:
217-
id-token: write # OIDC support
218-
contents: write
219-
security-events: write
220-
actions: read
221-
attestations: read
222-
checks: read
223-
deployments: read
224-
discussions: read
225-
issues: read
226-
packages: read
227-
pages: read
228-
pull-requests: read
229-
repository-projects: read
230-
statuses: read
231-
secrets: inherit
232-
with:
233-
flavor: ${{ matrix.flavor }}
234-
flavor_release: ${{ matrix.flavorRelease }}
235-
family: ${{ matrix.family }}
236-
model: ${{ matrix.model }}
237-
base_image: ${{ matrix.baseImage }}
238-
worker: ${{ matrix.worker }}
239-
needs:
240-
- get-core-matrix
241-
strategy:
242-
fail-fast: false
243-
matrix: ${{fromJson(needs.get-core-matrix.outputs.matrix)}}
244-
build-arm-generic:
245-
needs:
246-
- get-core-matrix-generic
247-
runs-on: ARM64
248-
permissions:
249-
id-token: write # OIDC support
250-
contents: write
251-
security-events: write
252-
actions: read
253-
attestations: read
254-
checks: read
255-
deployments: read
256-
discussions: read
257-
issues: read
258-
packages: read
259-
pages: read
260-
pull-requests: read
261-
repository-projects: read
262-
statuses: read
263-
strategy:
264-
fail-fast: false
265-
matrix: ${{fromJson(needs.get-core-matrix-generic.outputs.matrix)}}
266-
steps:
267-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
268-
with:
269-
fetch-depth: 0
270-
- name: Install Cosign
271-
uses: sigstore/cosign-installer@main
272-
- name: Install earthly
273-
uses: Luet-lab/luet-install-action@cec77490c3f2416d7d07a47cfab04d448641d7ce # v1.1
274-
with:
275-
repository: quay.io/kairos/packages-arm64
276-
packages: utils/earthly
277-
- name: Set up Docker Buildx
278-
id: buildx
279-
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3
280-
- name: Login to Quay Registry
281-
run: echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USERNAME }} --password-stdin quay.io
282-
- name: Set local mirror
283-
if: ${{ matrix.worker == 'ARM64' }}
284-
run: |
285-
# Configure earthly to use the docker mirror in CI
286-
# https://docs.earthly.dev/ci-integration/pull-through-cache#configuring-earthly-to-use-the-cache
287-
mkdir -p ~/.earthly/
288-
cat << EOF > ~/.earthly/config.yml
289-
global:
290-
buildkit_additional_config: |
291-
[registry."docker.io"]
292-
mirrors = ["registry.docker-mirror.svc.cluster.local:5000"]
293-
[registry."registry.docker-mirror.svc.cluster.local:5000"]
294-
insecure = true
295-
http = true
296-
EOF
297-
- name: Install kairos-agent
298-
uses: Luet-lab/luet-install-action@cec77490c3f2416d7d07a47cfab04d448641d7ce # v1.1
299-
with:
300-
repository: quay.io/kairos/packages
301-
packages: system/kairos-agent
302-
- name: Set Image name (master)
303-
if: ${{ github.ref == 'refs/heads/master' }}
304-
run: |
305-
IMAGE_REF=$(FLAVOR=${{ matrix.flavor }} FLAVOR_RELEASE="${{ matrix.flavorRelease }}" MODEL=${{ matrix.model }} TARGETARCH=arm64 VARIANT=core REGISTRY_AND_ORG="quay.io/kairos" RELEASE=master kairos-agent versioneer container-artifact-name)
306-
echo "IMAGE_REF=${IMAGE_REF}" >> $GITHUB_ENV
307-
- name: Build container 🔧
308-
run: |
309-
earthly -P +arm-container-image \
310-
--FLAVOR=${{ matrix.flavor }} \
311-
--FLAVOR_RELEASE=${{ matrix.flavorRelease }} \
312-
--FAMILY=${{ matrix.family }} \
313-
--BASE_IMAGE=${{ matrix.baseImage}} \
314-
--MODEL=${{ matrix.model }} \
315-
--VARIANT=${{ matrix.variant }}
316-
- name: Push 🔧
317-
if: ${{ github.ref == 'refs/heads/master' }}
318-
run: |
319-
docker tag $(cat build/IMAGE) ${{ env.IMAGE_REF }}
320-
docker push ${{ env.IMAGE_REF }}
321-
- name: Sign image
322-
if: ${{ github.ref == 'refs/heads/master' }}
323-
env:
324-
COSIGN_YES: true
325-
run: |
326-
docker push "${{ env.IMAGE_REF }}" # Otherwise .RepoDigests will be empty for some reason
327-
cosign sign $(docker image inspect --format='{{index .RepoDigests 0}}' "${{ env.IMAGE_REF }}")
328-
177+
variant: core
329178
notify:
330179
runs-on: ubuntu-latest
331180
if: failure()
File renamed without changes.

.github/workflows/image-pr-arm.yaml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: 'Push latest ARM images (PR)'
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**'
7+
8+
permissions: read-all
9+
concurrency:
10+
group: ci-arm-${{ github.head_ref || github.ref }}-${{ github.repository }}
11+
cancel-in-progress: true
12+
env:
13+
FORCE_COLOR: 1
14+
EARTHLY_TOKEN: ${{ secrets.EARTHLY_TOKEN }}
15+
jobs:
16+
get-core-matrix:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
matrix: ${{ steps.set-matrix.outputs.matrix }}
20+
steps:
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
22+
- run: |
23+
git fetch --prune --unshallow
24+
- id: set-matrix
25+
run: |
26+
content=`cat ./.github/flavors.json | jq -r 'map(select(.arch == "arm64" and .variant == "core"))'`
27+
# the following lines are only required for multi line json
28+
content="${content//'%'/'%25'}"
29+
content="${content//$'\n'/'%0A'}"
30+
content="${content//$'\r'/'%0D'}"
31+
# end of optional handling for multi line json
32+
echo "::set-output name=matrix::{\"include\": $content }"
33+
build-arm-core:
34+
uses: ./.github/workflows/reusable-docker-arm-build.yaml
35+
name: ${{ matrix.variant }}-${{ matrix.model }}
36+
permissions:
37+
id-token: write # OIDC support
38+
contents: write
39+
security-events: write
40+
actions: read
41+
attestations: read
42+
checks: read
43+
deployments: read
44+
discussions: read
45+
issues: read
46+
packages: read
47+
pages: read
48+
pull-requests: read
49+
repository-projects: read
50+
statuses: read
51+
secrets: inherit
52+
with:
53+
flavor: ${{ matrix.flavor }}
54+
flavor_release: ${{ matrix.flavorRelease }}
55+
family: ${{ matrix.family }}
56+
model: ${{ matrix.model }}
57+
base_image: ${{ matrix.baseImage }}
58+
worker: ${{ matrix.worker }}
59+
variant: ${{ matrix.variant }}
60+
needs:
61+
- get-core-matrix
62+
strategy:
63+
fail-fast: false
64+
matrix: ${{fromJson(needs.get-core-matrix.outputs.matrix)}}

.github/workflows/pages-releases.yml.disable

-23
This file was deleted.

0 commit comments

Comments
 (0)