From c49b93c955e9dcef09b80b97d5506a4393d6e5cc Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Sun, 14 Apr 2024 12:22:11 -0600 Subject: [PATCH] fix(ci): Support version retrieval across kernel variants Signed-off-by: RJ Trujillo --- .github/workflows/reusable-build.yml | 30 +++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 04bf1f8b..a35d5e5a 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -144,10 +144,34 @@ jobs: # Get kernel version with podman container_name="fq-$(uuidgen)" + pod_exec="podman exec $container_name" + + # Start container and install dnf podman run --entrypoint /bin/bash --name "$container_name" -dt "${{ env.FQ_SOURCE_IMAGE }}" - installed_packages=$(podman exec "$container_name" rpm -qa) - kernel_suffix="linux" - linux=$(echo $installed_packages | grep -P 'kernel-(|'"$kernel_suffix"'-)(\d+\.\d+\.\d+)' | sed -E 's/kernel-(|'"$kernel_suffix"'-)//') + $pod_exec rpm-ostree install dnf dnf-plugins-core + + # Fetch kernel version + case "${{ matrix.kernel_flavor }}" in + "asus") + $pod_exec dnf copr enable -y lukenukem/asus-linux + linux=$($pod_exec dnf repoquery --repoid copr:copr.fedorainfracloud.org:lukenukem:asus-kernel --whatprovides kernel | tail -n1 | sed 's/.*://') + ;; + "fsync") + $pod_exec dnf copr enable -y sentry/kernel-fsync + linux=$($pod_exec dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-fsync --whatprovides kernel | tail -n1 | sed 's/.*://') + ;; + "fsync-lts") + $pod_exec dnf copr enable -y sentry/kernel-fsync-lts + linux=$($pod_exec dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-fsync-lts --whatprovides kernel | tail -n1 | sed 's/.*://') + ;; + "surface") + $pod_exec dnf config-manager --add-repo=https://pkg.surfacelinux.com/fedora/linux-surface.repo + linux=$($pod_exec dnf repoquery --repoid linux-surface --whatprovides kernel-surface | tail -n1 | sed 's/.*://') + ;; + *) + linux=$($pod_exec dnf repoquery --installed --whatprovides kernel | tail -n1 | sed 's/.*://') + ;; + esac skopeo inspect docker://${{ env.FQ_SOURCE_IMAGE }} > inspect.json ver=$(jq -r '.Labels["org.opencontainers.image.version"]' inspect.json)