-
-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (132 loc) · 5.1 KB
/
build-process.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: build containers - podman-machine-bootc
run-name: Building containers - podman-machine-bootc
on:
schedule:
- cron: "0 2 */2 * *"
workflow_dispatch:
env:
DISK_TYPE: qcow2
ROOTFS: xfs
ARCH: amd64
BIB_IMAGE: quay.io/centos-bootc/bootc-image-builder:latest
BODY: "Podman Machine OS disk images"
jobs:
build-containers-podman-machine-bootc:
name: build-containers-podman-machine-bootc
permissions:
contents: read
packages: write
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Workaround podman issues in GH actions
run: |
# see https://github.com/osbuild/bootc-image-builder/issues/446
sudo rm -rf /var/lib/containers/storage
sudo mkdir -p /etc/containers
echo -e "[storage]\ndriver = \"overlay\"\nrunroot = \"/run/containers/storage\"\ngraphroot = \"/var/lib/containers/storage\"" | sudo tee /etc/containers/storage.conf
- name: Workarounds for GH runner diskspace
run: |
sudo mkdir -p /mnt/var/lib/containers
sudo mount -o bind /mnt/var/lib/containers /var/lib/containers
sudo mkdir /var/lib/containers/storage
- name: Run podman build - podman-machine-bootc
run: |
podman build -t ghcr.io/gbraad-devenv/fedora/podman-machine-bootc:41 \
--build-arg=BASE_IMAGE="ghcr.io/gbraad-dotfiles/fedora-bootc" \
--build-arg=BASE_VERSION=41 \
-f containers/Containerfile .
- name: Login to ghcr.io
run: |
podman login ghcr.io -u ${{ github.actor }} \
-p ${{ secrets.GITHUB_TOKEN }}
- name: Push image to ghcr.io - podman-machine-bootc
run: |
podman push ghcr.io/gbraad-devenv/fedora/podman-machine-bootc:41
- name: Create user configuration
run: touch config.toml
- name: Build image - systemd
id: build-image-systemd
run: |
mkdir -p ./output
sudo podman pull ${{ env.IMAGE_NAME }}
sudo podman run \
--rm \
-it \
--privileged \
--pull=newer \
--security-opt label=type:unconfined_t \
-v ./config.toml:/config.toml:ro \
-v ./output:/output \
-v /var/lib/containers/storage:/var/lib/containers/storage \
${{ env.BIB_IMAGE }} \
--target-arch ${{ env.ARCH }} \
--type ${{ env.DISK_TYPE }} \
--rootfs ${{ env.ROOTFS }} \
--local \
${{ env.IMAGE_NAME }}
env:
IMAGE_NAME: ghcr.io/gbraad-devenv/fedora/podman-machine-bootc:41
- uses: actions/upload-artifact@v4
with:
name: disk-amd64
path: output/qcow2/disk.qcow2
retention-days: 7
build-imagecontainer-podman-machine-bootc:
name: build-imagecontainer-podman-machine-bootc
needs:
- build-containers-podman-machine-bootc
permissions:
contents: read
packages: write
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
container:
image: ghcr.io/gbraad-actions/fedora:stable
options: --privileged
steps:
- name: Download amd64
uses: actions/download-artifact@v4
with:
name: disk-amd64
path: disk-amd64/
- name: Set release tag
id: get-tag
run: |
echo "TAG=$(date +'%y%m%d')" >> $GITHUB_OUTPUT
- name: Prepare and compress disk image
run: |
mv ./disk-amd64/disk.qcow2 ./disk-amd64/podman-machine.x86_64.qemu.qcow2
zstd --rm -T0 -14 ./disk-amd64/podman-machine.x86_64.qemu.qcow2
- name: Wrap disk image in container
run: |
buildah manifest create podman-machine-os
buildah manifest add --artifact --artifact-type="" \
--os=linux --arch="x86_64" --annotation "disktype=qemu" \
localhost/podman-machine-os \
./disk-amd64/podman-machine.x86_64.qemu.qcow2.zst
- name: Login to ghcr.io
run: |
podman login ghcr.io -u ${{ github.actor }} \
-p ${{ secrets.GITHUB_TOKEN }}
- name: Tag and push image container to registry
run: |
podman tag podman-machine-os:latest \
ghcr.io/gbraad-devenv/fedora/podman-machine-os:latest
podman tag podman-machine-os:latest \
ghcr.io/gbraad-devenv/fedora/podman-machine-os:41
podman tag podman-machine-os:latest \
ghcr.io/gbraad-devenv/fedora/podman-machine-os:${{ steps.get-tag.outputs.TAG }}
podman push ghcr.io/gbraad-devenv/fedora/podman-machine-os:latest
podman push ghcr.io/gbraad-devenv/fedora/podman-machine-os:41
podman push ghcr.io/gbraad-devenv/fedora/podman-machine-os:${{ steps.get-tag.outputs.TAG }}