Skip to content

Commit 1150b8f

Browse files
committed
chore(ci): re-organise workflows
re-organise the workflows so that they work properly with podman credit: https://github.com/tulilirockz/taxifolia/
1 parent 66e6936 commit 1150b8f

1 file changed

Lines changed: 40 additions & 17 deletions

File tree

.github/workflows/build-bootc-image.yaml

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ on:
2323
secrets:
2424
SIGNING_SECRET:
2525
required: false
26+
GITHUB_TOKEN:
27+
required: true
2628

2729
env:
2830
IMAGE_DESC: "Experimental arch-bootc POC image"
@@ -106,8 +108,26 @@ jobs:
106108
target-dir: /var/lib/containers
107109
mount-opts: compress-force=zstd:2
108110

109-
- name: Install just
110-
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4
111+
# We need newer podman due to old podman not supporting lots of flags
112+
- name: Update podman and install just
113+
shell: bash
114+
run: |
115+
set -eux
116+
# Require the runner is ubuntu-24.04
117+
IDV=$(. /usr/lib/os-release && echo ${ID}-${VERSION_ID})
118+
test "${IDV}" = "ubuntu-24.04"
119+
# resolute is the next release. The azure.archive.ubuntu.com mirror only carries amd64.
120+
# Other architectures like arm64 use ports.ubuntu.com/ubuntu-ports.
121+
if [ "$(dpkg --print-architecture)" = "amd64" ]; then
122+
mirror="http://azure.archive.ubuntu.com/ubuntu"
123+
else
124+
mirror="http://ports.ubuntu.com/ubuntu-ports"
125+
fi
126+
echo "deb ${mirror} resolute universe main" | sudo tee /etc/apt/sources.list.d/resolute.list
127+
/bin/time -f '%E %C' sudo apt update
128+
# skopeo is currently older in resolute for some reason hence --allow-downgrades
129+
/bin/time -f '%E %C' sudo apt install -y --allow-downgrades crun/resolute buildah/resolute podman/resolute skopeo/resolute just/resolute
130+
podman --version
111131
112132
- name: Install mkosi
113133
uses: systemd/mkosi@c4c3d793d0f6f0a2f26895de5ed9382396f36bb5
@@ -140,26 +160,29 @@ jobs:
140160
done
141161
142162
- name: Login to GitHub Container Registry
143-
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
144163
if: github.event_name != 'pull_request' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
145-
with:
146-
registry: ghcr.io
147-
username: ${{ github.actor }}
148-
password: ${{ secrets.GITHUB_TOKEN }}
164+
env:
165+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
166+
LOGIN_USER: ${{ github.actor }}
167+
run: echo "${GITHUB_TOKEN}" | sudo podman login -u "${LOGIN_USER}" --password-stdin "ghcr.io"
149168

150-
- name: Push To GHCR
151-
uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2
169+
- name: Push to GHCR
152170
if: github.event_name != 'pull_request' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
153171
id: push
154172
env:
155-
REGISTRY_USER: ${{ github.actor }}
156-
REGISTRY_PASSWORD: ${{ github.token }}
157-
with:
158-
registry: ${{ env.IMAGE_REGISTRY }}
159-
image: ${{ env.IMAGE_NAME }}
160-
tags: ${{ steps.metadata.outputs.tags }}
161-
username: ${{ env.REGISTRY_USER }}
162-
password: ${{ env.REGISTRY_PASSWORD }}
173+
IMAGE_DIGEST: ${{ steps.load.outputs.digest }}
174+
MAX_RETRIES: 3
175+
PLATFORM: ${{ matrix.platform }}
176+
REPOSITORY_OWNER: ${{ github.repository_owner }}
177+
SIGNING_SECRET: ${{ secrets.SIGNING_SECRET }}
178+
run: |
179+
# HACK: push two times so layer annotations are present
180+
# TODO: remove me when https://github.com/containers/podman/issues/27796 fixed
181+
for tag in $DOCKER_METADATA_OUTPUT_TAGS; do
182+
for _ in $(seq 2); do
183+
sudo podman push --retry "${MAX_RETRIES}" --compression-format=zstd "localhost/${IMAGE_NAME}:${DEFAULT_TAG}" "${IMAGE_REGISTRY}/${IMAGE_NAME}:$tag"
184+
done
185+
done
163186
164187
- name: Install Cosign
165188
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2

0 commit comments

Comments
 (0)