Skip to content

Commit 3c877e7

Browse files
committed
Add workflow steps to build and push bootc qcow2 container image
Also refactors some of the targets in the bootc/Makefile so that it is more re-usable from the github workflow. Signed-off-by: James Slagle <[email protected]>
1 parent 7ea2054 commit 3c877e7

File tree

2 files changed

+59
-6
lines changed

2 files changed

+59
-6
lines changed

.github/workflows/edpm-bootc.yaml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,17 @@ jobs:
4949
run: |
5050
echo "latesttag=${{ steps.branch-name.outputs.current_branch }}-latest" >> $GITHUB_ENV
5151
52+
- name: Set EDPM_* env vars
53+
run: |
54+
echo "EDPM_BOOTC_REPO=${{ env.imageregistry }}/${{ env.imagenamespace }}/edpm-bootc" >> $GITHUB_ENV
55+
echo "EDPM_BOOTC_TAG=${{ env.latesttag }}" >> $GITHUB_ENV
56+
5257
- name: Build output/yum.repos.d
5358
id: build-output-yum-repos-d
5459
run: |
55-
export EDPM_BOOTC_TAG=${latesttag}
5660
podman run --rm -it -v .:/bootc:rw,z quay.io/centos/centos:stream9 /bin/bash -c "cd bootc; dnf -y install make; make output/yum.repos.d"
5761
58-
- name: Build and tag
62+
- name: Build and tag edpm-bootc container image
5963
id: buildah-build-edpm-bootc
6064
uses: redhat-actions/buildah-build@v2
6165
with:
@@ -65,7 +69,7 @@ jobs:
6569
./bootc/Containerfile.centos9
6670
context: bootc
6771

68-
- name: Push edpm-bootc To ${{ env.imageregistry }}
72+
- name: Push edpm-bootc container image to ${{ env.imageregistry }}
6973
id: push-edpm-bootc
7074
uses: redhat-actions/push-to-registry@v2
7175
with:
@@ -79,3 +83,43 @@ jobs:
7983
run: |
8084
echo "Image pushed to ${{ steps.push-edpm-bootc.outputs.registry-paths }}"
8185
echo "Image digest: ${{ steps.push-edpm-bootc.outputs.digest }}"
86+
87+
- name: bootc-image-builder edpm-bootc qcow2 image
88+
id: edpm-bootc-qcow2-image-builder
89+
run: |
90+
# workaround https://github.com/containers/podman/issues/21683
91+
sudo apt install -y sqlite3
92+
echo "update DBConfig set GraphDriver = 'overlay' where GraphDriver = '';" | sudo sh -c '(cd /var/lib/containers/storage && sqlite3 db.sql)'
93+
make output
94+
# Pull the edpm-bootc container image as sudo. Previous build commands
95+
# don't use sudo.
96+
sudo podman pull ${{ env.imageregistry }}/${{ env.imagenamespace }}/edpm-bootc:${{ env.latesttag }}
97+
make edpm-bootc.qcow2-no-build
98+
make package-cp-deps
99+
100+
- name: Build and tag edpm-bootc qcow2 container image
101+
id: buildah-build-edpm-bootc-qcow2
102+
uses: redhat-actions/buildah-build@v2
103+
with:
104+
image: edpm-bootc
105+
tags: ${{ env.latesttag }}-qcow2 ${{ github.sha }}-qcow2
106+
containerfiles: |
107+
./bootc/output/Containerfile.image
108+
context: bootc/output
109+
build-args: |
110+
IMAGE_NAME=edpm-bootc
111+
112+
- name: Push edpm-bootc qcow2 container image to ${{ env.imageregistry }}
113+
id: push-edpm-bootc-qcow2
114+
uses: redhat-actions/push-to-registry@v2
115+
with:
116+
image: edpm-bootc
117+
tags: ${{ env.latesttag }}-qcow2
118+
registry: ${{ env.imageregistry }}/${{ env.imagenamespace }}
119+
username: ${{ secrets.QUAY_USERNAME }}
120+
password: ${{ secrets.QUAY_PASSWORD }}
121+
122+
- name: Print qcow2 image url and digest
123+
run: |
124+
echo "Image pushed to ${{ steps.push-edpm-bootc-qcow2.outputs.registry-paths }}"
125+
echo "Image digest: ${{ steps.push-edpm-bootc-qcow2.outputs.digest }}"

bootc/Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ build-push: build
4848
sudo podman push ${EDPM_BOOTC_IMAGE}
4949

5050
.PHONY: edpm-bootc.qcow2
51-
edpm-bootc.qcow2: build
51+
edpm-bootc.qcow2: build edpm-bootc.qcow2-no-build
52+
53+
.PHONY: edpm-bootc.qcow2-no-build
54+
edpm-bootc.qcow2-no-build:
5255
ls output/edpm-bootc.qcow2 && exit 0 || true
5356
sudo podman run --rm -it --privileged \
5457
--security-opt label=type:unconfined_t \
@@ -63,10 +66,16 @@ edpm-bootc.qcow2: build
6366
sudo sha256sum edpm-bootc.qcow2 > edpm-bootc.qcow2.sha256
6467

6568
.PHONY: package
66-
package: edpm-bootc.qcow2
67-
sudo buildah inspect ${EDPM_QCOW2_IMAGE} > /dev/null && exit 0 || true
69+
package: edpm-bootc.qcow2 package-no-qcow2
70+
71+
.PHONY: package-cp-deps
72+
package-cp-deps:
6873
cp ../copy_out.sh output/
6974
cp ../Containerfile.image output/
75+
76+
.PHONY: package-no-qcow2
77+
package-no-qcow2: package-cp-deps
78+
sudo buildah inspect ${EDPM_QCOW2_IMAGE} > /dev/null && exit 0 || true
7079
cd output
7180
sudo buildah bud --build-arg IMAGE_NAME=edpm-bootc -f ./Containerfile.image -t ${EDPM_QCOW2_IMAGE}
7281

0 commit comments

Comments
 (0)