Skip to content

Commit b55e484

Browse files
authored
Merge pull request #55 from alicefr/fix-digest-label
Use remote digest for BOOTC_DIGEST label
2 parents 140f2f7 + 6aa4ebe commit b55e484

2 files changed

Lines changed: 31 additions & 10 deletions

File tree

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

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ jobs:
4444
working-directory: node-images/fedora
4545
run: make build-bootc-image
4646

47-
- name: Build disk image
48-
working-directory: node-images/fedora
49-
run: make build-disk-image
50-
5147
- name: Determine image tag
5248
id: meta
5349
working-directory: node-images/fedora
@@ -56,22 +52,42 @@ jobs:
5652
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
5753
echo "Image tag: ${TAG}"
5854
59-
- name: Tag and push
55+
- name: Push bootc image
56+
id: push-bootc
6057
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push)
6158
working-directory: node-images/fedora
6259
run: |
6360
TAG=${{ steps.meta.outputs.tag }}
6461
BOOTC_SRC=$(make -s print-bootc-image)
65-
DISK_SRC=$(make -s print-node-image)
6662
PUSH_DEST=${{ env.PUSH_REGISTRY }}/${{ env.PUSH_IMAGE }}
6763
68-
# push bootc image under both :latest and versioned tags
6964
podman tag ${BOOTC_SRC} ${PUSH_DEST}:${TAG}
70-
podman push ${PUSH_DEST}:${TAG}
65+
podman push --digestfile=/tmp/bootc-digest ${PUSH_DEST}:${TAG}
7166
podman tag ${BOOTC_SRC} ${PUSH_DEST}:latest
7267
podman push ${PUSH_DEST}:latest
7368
74-
# push disk image under both :latest-disk and versioned tags
69+
BOOTC_DIGEST=$(cat /tmp/bootc-digest)
70+
echo "digest=${BOOTC_DIGEST}" >> "$GITHUB_OUTPUT"
71+
echo "Bootc image pushed with digest: ${BOOTC_DIGEST}"
72+
73+
- name: Build disk image
74+
working-directory: node-images/fedora
75+
run: |
76+
BOOTC_DIGEST="${{ steps.push-bootc.outputs.digest }}"
77+
if [ -n "${BOOTC_DIGEST}" ]; then
78+
make build-disk-image BOOTC_DIGEST="${BOOTC_DIGEST}"
79+
else
80+
make build-disk-image
81+
fi
82+
83+
- name: Push disk image
84+
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push)
85+
working-directory: node-images/fedora
86+
run: |
87+
TAG=${{ steps.meta.outputs.tag }}
88+
DISK_SRC=$(make -s print-node-image)
89+
PUSH_DEST=${{ env.PUSH_REGISTRY }}/${{ env.PUSH_IMAGE }}
90+
7591
podman tag ${DISK_SRC} ${PUSH_DEST}:${TAG}-disk
7692
podman push ${PUSH_DEST}:${TAG}-disk
7793
podman tag ${DISK_SRC} ${PUSH_DEST}:latest-disk

node-images/fedora/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ IMAGE_TAG ?= v$(KUBE_MINOR)-fedora-$(FEDORA_VERSION)
99
REGISTRY ?= ghcr.io/alicefr/bink
1010
BOOTC_IMAGE ?= $(REGISTRY)/node:$(IMAGE_TAG)
1111
NODE_IMAGE ?= $(REGISTRY)/node:$(IMAGE_TAG)-disk
12+
BOOTC_DIGEST ?=
1213

1314
# Build the OCI bootc image (k8s + cri-o)
1415
build-bootc-image:
@@ -27,7 +28,11 @@ build-bootc-image:
2728
build-disk-image: build-bootc-image
2829
@echo "=== Building node image with qcow2 disk ==="
2930
STORAGE_PATH=$$(podman info --format '{{.Store.GraphRoot}}') && \
30-
BOOTC_DIGEST=$$(podman inspect --format '{{.Digest}}' $(BOOTC_IMAGE)) && \
31+
if [ -z "$(BOOTC_DIGEST)" ]; then \
32+
BOOTC_DIGEST=$$(podman inspect --format '{{.Digest}}' $(BOOTC_IMAGE)); \
33+
else \
34+
BOOTC_DIGEST="$(BOOTC_DIGEST)"; \
35+
fi && \
3136
podman build \
3237
--cap-add=SYS_ADMIN \
3338
--cap-add=DAC_READ_SEARCH \

0 commit comments

Comments
 (0)