Skip to content
This repository was archived by the owner on Jan 31, 2024. It is now read-only.

Commit bd09b91

Browse files
authored
Merge pull request #21 from cgwalters/layered-cloud-images
ci: Add workflow to build disk image
2 parents a33d310 + ff78291 commit bd09b91

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build and Push Cloud qcow2 Image
2+
3+
on:
4+
schedule:
5+
- cron: "50 */4 * * *"
6+
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY_NS: quay.io/centos-bootc
11+
# TODO use quay once it supports artifacts
12+
DISKIMAGE_REGISTRY: ghcr.io
13+
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
jobs:
19+
build-and-push-cloud-qcow2-image:
20+
runs-on: ubuntu-latest
21+
22+
strategy:
23+
matrix:
24+
# os: [fedora, centos]
25+
os: [fedora]
26+
include:
27+
- os: fedora
28+
tag: eln
29+
#- os: centos
30+
# tag: stream9
31+
32+
env:
33+
dir: cloud
34+
35+
steps:
36+
# TODO replace with https://github.com/containers/buildah/issues/5091
37+
- name: Install oras
38+
run: |
39+
VERSION="1.1.0"
40+
curl -L "https://github.com/oras-project/oras/releases/download/v${VERSION}/oras_${VERSION}_linux_amd64.tar.gz" | tar zxvf -
41+
sudo mv oras /usr/bin
42+
43+
- name: Install podman
44+
run: sudo apt install podman
45+
46+
- name: Checkout repository
47+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
48+
49+
- name: Login to quay.io
50+
run: podman login --authfile auth.json -u ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} ${{ env.DISKIMAGE_REGISTRY }}
51+
52+
- name: Build
53+
run: |
54+
mkdir -p output
55+
sudo podman run --rm -it --privileged --pull=newer \
56+
-v $(pwd)/output:/output \
57+
${{ env.REGISTRY_NS }}/bootc-image-builder:latest \
58+
--type qcow2 \
59+
${{ env.REGISTRY_NS }}/${{ matrix.os }}-bootc-cloud:${{ matrix.tag }}
60+
61+
- name: Post b-i-b fixups
62+
run: |
63+
set -xeuo pipefail
64+
# TODO: change b-i-b to support this in a nicer way
65+
sudo chown -R -h $USER: output
66+
# TODO: change b-i-b to have more intelligent naming and optionally handle compression etc.
67+
zstd < output/qcow2/disk.qcow2 > ${{ matrix.os }}-bootc-cloud-${{ matrix.tag }}.qcow2.zst
68+
rm output -rf
69+
70+
- name: Push
71+
run: |
72+
oras push --debug --registry-config auth.json ${{ env.DISKIMAGE_REGISTRY }}/${{ github.actor }}/${{ matrix.os }}-bootc-cloud-disk:${{ matrix.tag }} \
73+
${{ matrix.os }}-bootc-cloud-${{ matrix.tag }}.qcow2.zst:application/x-qemu-qcow2+zstd

0 commit comments

Comments
 (0)