7
7
required : true
8
8
type : string
9
9
env :
10
- IMAGE_NAME : akmods
10
+ IMAGE_BASE_NAME : akmods
11
11
IMAGE_REGISTRY : ghcr.io/${{ github.repository_owner }}
12
12
13
13
concurrency :
36
36
cfile_suffix :
37
37
- common
38
38
- nvidia
39
- nvidia_version :
40
- - 0
41
- - 550
42
39
exclude :
43
- - cfile_suffix : common
44
- nvidia_version : 550
45
- - cfile_suffix : nvidia
46
- nvidia_version : 0
47
40
- kernel_flavor : asus
48
41
fedora_version : 38
49
42
- kernel_flavor : surface
56
49
kernel_flavor : fsync # kernel-fsync packages are not being built for F40 yet.
57
50
- fedora_version : 40
58
51
kernel_flavor : fsync-lts
59
-
60
52
steps :
61
53
# Checkout push-to-registry action GitHub repository
62
54
- name : Checkout Push to Registry action
@@ -65,26 +57,31 @@ jobs:
65
57
- name : Matrix Variables
66
58
shell : bash
67
59
run : |
60
+ if [ "common" == "${{ matrix.cfile_suffix }}" ]; then
61
+ echo "IMAGE_NAME=${{ env.IMAGE_BASE_NAME }}" >> $GITHUB_ENV
62
+ else
63
+ echo "IMAGE_NAME=${{ env.IMAGE_BASE_NAME }}-${{ matrix.cfile_suffix }}" >> $GITHUB_ENV
64
+ fi
68
65
if [[ "${{ matrix.fedora_version }}" -ge "41" ]]; then
69
66
# when we are confident of official fedora images we can switch to them
70
- echo " SOURCE_IMAGE=fedora-silverblue" >> $GITHUB_ENV
71
- echo " SOURCE_ORG=fedora" >> $GITHUB_ENV
67
+ export SOURCE_IMAGE=fedora-silverblue
68
+ export SOURCE_ORG=fedora
72
69
else
73
- echo " SOURCE_IMAGE=base" >> $GITHUB_ENV
74
- echo " SOURCE_ORG=fedora-ostree-desktops" >> $GITHUB_ENV
70
+ export SOURCE_IMAGE=base
71
+ export SOURCE_ORG=fedora-ostree-desktops
75
72
fi
73
+ echo "FQ_SOURCE_IMAGE=quay.io/${SOURCE_ORG}/${SOURCE_IMAGE}:${{ matrix.fedora_version }}" >> $GITHUB_ENV
74
+ echo "SOURCE_IMAGE=${SOURCE_IMAGE}" >> $GITHUB_ENV
75
+ echo "SOURCE_ORG=${SOURCE_ORG}" >> $GITHUB_ENV
76
+
76
77
77
78
- name : Generate tags
78
79
id : generate-tags
79
80
shell : bash
80
81
run : |
81
82
# Generate a timestamp for creating an image version history
82
83
TIMESTAMP="$(date +%Y%m%d)"
83
- if [[ "${{ matrix.cfile_suffix }}" == "nvidia" ]]; then
84
- VARIANT="${{ matrix.kernel_flavor }}-${{ matrix.fedora_version }}-${{ matrix.nvidia_version }}"
85
- else
86
- VARIANT="${{ matrix.kernel_flavor }}-${{ matrix.fedora_version }}"
87
- fi
84
+ VARIANT="${{ matrix.kernel_flavor }}-${{ matrix.fedora_version }}"
88
85
89
86
COMMIT_TAGS=()
90
87
BUILD_TAGS=()
@@ -125,69 +122,103 @@ jobs:
125
122
# DEBUG: get character count of key
126
123
wc -c certs/private_key.priv
127
124
128
- - name : Get current version
129
- id : labels
125
+ - name : Pull build image
130
126
uses : Wandalen/wretry.action@v2.1.0
131
127
with :
132
128
attempt_limit : 3
133
129
attempt_delay : 15000
134
130
command : |
135
- set -eo pipefail
136
- skopeo inspect docker://quay.io/${{ env.SOURCE_ORG }}/${{ env.SOURCE_IMAGE }}:${{ matrix.fedora_version }} > inspect.json
137
- ver=$(jq -r '.Labels["org.opencontainers.image.version"]' inspect.json)
131
+ # pull the base image used for FROM in containerfile so
132
+ # we can retry on that unfortunately common failure case
133
+ podman pull ${{ env.FQ_SOURCE_IMAGE }}
134
+
135
+ - name : Get current version
136
+ run : |
137
+ set -eo pipefail
138
+
139
+ # skopeo must always run to inspect image labels for build version
140
+ skopeo inspect docker://${{ env.FQ_SOURCE_IMAGE }} > inspect.json
141
+ ver=$(jq -r '.Labels["org.opencontainers.image.version"]' inspect.json)
142
+ if [ -z "$ver" ] || [ "null" = "$ver" ]; then
143
+ echo "inspected image version must not be empty or null"
144
+ exit 1
145
+ fi
146
+
147
+ if [ "main" == "${{ matrix.kernel_flavor }}" ]; then
148
+ # main kernel_flavor: use ostree.linux to determine kernel version
138
149
linux=$(jq -r '.Labels["ostree.linux"]' inspect.json)
139
- if [ -z "$ver" ] || [ "null" = "$ver" ]; then
140
- echo "inspected image version must not be empty or null"
141
- exit 1
142
- fi
143
- if [ -z "$linux" ] || [ "null" = "$linux" ]; then
144
- echo "inspected image linux version must not be empty or null"
145
- exit 1
146
- fi
147
- echo "SOURCE_IMAGE_VERSION=$ver" >> $GITHUB_ENV
148
- echo "SOURCE_IMAGE_LINUX=$linux" >> $GITHUB_ENV
150
+ else
151
+ # other kernel_flavor: start container use dnf to find kernel version
152
+ container_name="fq-$(uuidgen)"
153
+ podman run --entrypoint /bin/bash --name "$container_name" -dt "${{ env.FQ_SOURCE_IMAGE }}"
154
+ podman exec $container_name rpm-ostree install dnf dnf-plugins-core
155
+
156
+ # Fetch kernel version
157
+ dnf="podman exec $container_name dnf"
158
+ case "${{ matrix.kernel_flavor }}" in
159
+ "asus")
160
+ $dnf copr enable -y lukenukem/asus-kernel
161
+ linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:lukenukem:asus-kernel --whatprovides kernel | tail -n1 | sed 's/.*://')
162
+ ;;
163
+ "fsync")
164
+ $dnf copr enable -y sentry/kernel-fsync
165
+ linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-fsync --whatprovides kernel | tail -n1 | sed 's/.*://')
166
+ ;;
167
+ "fsync-lts")
168
+ $dnf copr enable -y sentry/kernel-ba
169
+ linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-ba --whatprovides kernel | tail -n1 | sed 's/.*://')
170
+ ;;
171
+ "main")
172
+ linux=$($dnf repoquery --whatprovides kernel | tail -n1 | sed 's/.*://')
173
+ ;;
174
+ "surface")
175
+ $dnf config-manager --add-repo=https://pkg.surfacelinux.com/fedora/linux-surface.repo
176
+ linux=$($dnf repoquery --repoid linux-surface --whatprovides kernel-surface | tail -n1 | sed 's/.*://')
177
+ ;;
178
+ *)
179
+ echo "unexpected kernel_flavor '${{ matrix.kernel_flavor }}' for dnf repoquery"
180
+ ;;
181
+ esac
182
+ fi
183
+
184
+ if [ -z "$linux" ] || [ "null" = "$linux" ]; then
185
+ echo "inspected image linux version must not be empty or null"
186
+ exit 1
187
+ fi
188
+ echo "SOURCE_IMAGE_VERSION=$ver" >> $GITHUB_ENV
189
+ echo "KERNEL_VERSION=$linux" >> $GITHUB_ENV
149
190
150
191
# Build metadata
151
192
- name : Image Metadata
152
193
uses : docker/metadata-action@v5
153
194
id : meta
154
195
with :
155
196
images : |
156
- ${{ 'nvidia' == matrix.cfile_suffix && format('{0}-nvidia', env.IMAGE_NAME) || format('{0}', env.IMAGE_NAME) }}
197
+ ${{ env.IMAGE_NAME }}
157
198
labels : |
158
- org.opencontainers.image.title=${{ env.IMAGE_NAME }}
199
+ org.opencontainers.image.title=${{ env.IMAGE_BASE_NAME }}
159
200
org.opencontainers.image.description=A caching layer for pre-built akmod RPMs
160
201
org.opencontainers.image.version=${{ env.SOURCE_IMAGE_VERSION }}
161
- ostree.linux=${{ env.SOURCE_IMAGE_LINUX }}
202
+ ostree.linux=${{ env.KERNEL_VERSION }}
162
203
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/main/README.md
163
204
io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/1728152?s=200&v=4
164
205
165
- - name : Pull build image
166
- uses : Wandalen/wretry.action@v2.1.0
167
- with :
168
- attempt_limit : 3
169
- attempt_delay : 15000
170
- command : |
171
- # pull the base image used for FROM in containerfile so
172
- # we can retry on that unfortunately common failure case
173
- podman pull quay.io/${{ env.SOURCE_ORG }}/${{ env.SOURCE_IMAGE }}:${{ matrix.fedora_version }}
174
-
175
206
# Build image using Buildah action
176
207
- name : Build Image
177
208
id : build_image
178
209
uses : redhat-actions/buildah-build@v2
179
210
with :
180
211
containerfiles : |
181
212
./Containerfile.${{ matrix.cfile_suffix }}
182
- image : ${{ 'nvidia' == matrix.cfile_suffix && format('{0}-nvidia', env.IMAGE_NAME) || format('{0}', env.IMAGE_NAME) }}
213
+ image : ${{ env.IMAGE_NAME }}
183
214
tags : |
184
215
${{ steps.generate-tags.outputs.alias_tags }}
185
216
build-args : |
186
217
SOURCE_IMAGE=${{ env.SOURCE_IMAGE }}
187
218
SOURCE_ORG=${{ env.SOURCE_ORG }}
188
219
KERNEL_FLAVOR=${{ matrix.kernel_flavor }}
220
+ KERNEL_VERSION=${{ env.KERNEL_VERSION }}
189
221
FEDORA_MAJOR_VERSION=${{ matrix.fedora_version }}
190
- NVIDIA_MAJOR_VERSION=${{ matrix.nvidia_version }}
191
222
RPMFUSION_MIRROR=${{ vars.RPMFUSION_MIRROR }}
192
223
labels : ${{ steps.meta.outputs.labels }}
193
224
oci : false
0 commit comments