From 287bc4f23b1625bcae0b008edfcc26b02469828d Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Mon, 8 Apr 2024 15:16:42 -0500 Subject: [PATCH 01/17] chore: add proper kernel version to ostree.linux label --- .github/workflows/build-38.yml | 2 +- .github/workflows/build-39.yml | 2 +- .github/workflows/reusable-build.yml | 52 ++++++++++++++-------------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build-38.yml b/.github/workflows/build-38.yml index 0496f426..3242085d 100644 --- a/.github/workflows/build-38.yml +++ b/.github/workflows/build-38.yml @@ -1,6 +1,6 @@ name: ublue akmods 38 on: - pull_request: + #pull_request: merge_group: schedule: - cron: '10 14 * * *' # 2pm-ish UTC everyday (timed against official fedora container pushes, and after 'config') diff --git a/.github/workflows/build-39.yml b/.github/workflows/build-39.yml index 11ad11f8..90596696 100644 --- a/.github/workflows/build-39.yml +++ b/.github/workflows/build-39.yml @@ -1,6 +1,6 @@ name: ublue akmods 39 on: - pull_request: + #pull_request: merge_group: schedule: - cron: '0 14 * * *' # 2pm-ish UTC everyday (timed against official fedora container pushes, and after 'config') diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 57047d10..4e0a6ed5 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -73,6 +73,8 @@ jobs: echo "SOURCE_IMAGE=base" >> $GITHUB_ENV echo "SOURCE_ORG=fedora-ostree-desktops" >> $GITHUB_ENV fi + echo "FQ_SOURCE_IMAGE=quay.io/${{ env.SOURCE_ORG }}/${{ env.SOURCE_IMAGE }}:${{ matrix.fedora_version }}" >> $GITHUB_ENV + - name: Generate tags id: generate-tags @@ -125,27 +127,35 @@ jobs: # DEBUG: get character count of key wc -c certs/private_key.priv - - name: Get current version - id: labels + - name: Pull build image uses: Wandalen/wretry.action@v2.1.0 with: attempt_limit: 3 attempt_delay: 15000 command: | - set -eo pipefail - skopeo inspect docker://quay.io/${{ env.SOURCE_ORG }}/${{ env.SOURCE_IMAGE }}:${{ matrix.fedora_version }} > inspect.json - ver=$(jq -r '.Labels["org.opencontainers.image.version"]' inspect.json) - linux=$(jq -r '.Labels["ostree.linux"]' inspect.json) - if [ -z "$ver" ] || [ "null" = "$ver" ]; then - echo "inspected image version must not be empty or null" - exit 1 - fi - if [ -z "$linux" ] || [ "null" = "$linux" ]; then - echo "inspected image linux version must not be empty or null" - exit 1 - fi - echo "SOURCE_IMAGE_VERSION=$ver" >> $GITHUB_ENV - echo "SOURCE_IMAGE_LINUX=$linux" >> $GITHUB_ENV + # pull the base image used for FROM in containerfile so + # we can retry on that unfortunately common failure case + podman pull ${{ env.FQ_SOURCE_IMAGE }} + + - name: Get current version + id: labels + uses: docker://${{ FQ_SOURCE_IMAGE }} + shell: bash + run: | + set -eo pipefail + skopeo inspect docker://${{ env.FQ_SOURCE_IMAGE }} > inspect.json + ver=$(jq -r '.Labels["org.opencontainers.image.version"]' inspect.json) + linux=$(jq -r '.Labels["ostree.linux"]' inspect.json) + if [ -z "$ver" ] || [ "null" = "$ver" ]; then + echo "inspected image version must not be empty or null" + exit 1 + fi + if [ -z "$linux" ] || [ "null" = "$linux" ]; then + echo "inspected image linux version must not be empty or null" + exit 1 + fi + echo "SOURCE_IMAGE_VERSION=$ver" >> $GITHUB_ENV + echo "SOURCE_IMAGE_LINUX=$linux" >> $GITHUB_ENV # Build metadata - name: Image Metadata @@ -162,16 +172,6 @@ jobs: io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/main/README.md io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/1728152?s=200&v=4 - - name: Pull build image - uses: Wandalen/wretry.action@v2.1.0 - with: - attempt_limit: 3 - attempt_delay: 15000 - command: | - # pull the base image used for FROM in containerfile so - # we can retry on that unfortunately common failure case - podman pull quay.io/${{ env.SOURCE_ORG }}/${{ env.SOURCE_IMAGE }}:${{ matrix.fedora_version }} - # Build image using Buildah action - name: Build Image id: build_image From 98aa72398428be053b28b72386ddaa9240293fb8 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Tue, 9 Apr 2024 09:20:03 -0500 Subject: [PATCH 02/17] chore: use docker-run-action --- .github/workflows/reusable-build.yml | 36 +++++++++++++++------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 4e0a6ed5..767fe190 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -139,23 +139,25 @@ jobs: - name: Get current version id: labels - uses: docker://${{ FQ_SOURCE_IMAGE }} - shell: bash - run: | - set -eo pipefail - skopeo inspect docker://${{ env.FQ_SOURCE_IMAGE }} > inspect.json - ver=$(jq -r '.Labels["org.opencontainers.image.version"]' inspect.json) - linux=$(jq -r '.Labels["ostree.linux"]' inspect.json) - if [ -z "$ver" ] || [ "null" = "$ver" ]; then - echo "inspected image version must not be empty or null" - exit 1 - fi - if [ -z "$linux" ] || [ "null" = "$linux" ]; then - echo "inspected image linux version must not be empty or null" - exit 1 - fi - echo "SOURCE_IMAGE_VERSION=$ver" >> $GITHUB_ENV - echo "SOURCE_IMAGE_LINUX=$linux" >> $GITHUB_ENV + uses: addnab/docker-run-action@v3 + with: + image: ${{ FQ_SOURCE_IMAGE }} + shell: bash + run: | + set -eo pipefail + skopeo inspect docker://${{ env.FQ_SOURCE_IMAGE }} > inspect.json + ver=$(jq -r '.Labels["org.opencontainers.image.version"]' inspect.json) + linux=$(jq -r '.Labels["ostree.linux"]' inspect.json) + if [ -z "$ver" ] || [ "null" = "$ver" ]; then + echo "inspected image version must not be empty or null" + exit 1 + fi + if [ -z "$linux" ] || [ "null" = "$linux" ]; then + echo "inspected image linux version must not be empty or null" + exit 1 + fi + echo "SOURCE_IMAGE_VERSION=$ver" >> $GITHUB_ENV + echo "SOURCE_IMAGE_LINUX=$linux" >> $GITHUB_ENV # Build metadata - name: Image Metadata From 0fd13c4c2f7e9cb664777b6021b47b204f8d8e29 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Tue, 9 Apr 2024 09:26:53 -0500 Subject: [PATCH 03/17] fix: typo on env FQ_SOURCE_IMAGE --- .github/workflows/reusable-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 767fe190..858ab3e2 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -141,7 +141,7 @@ jobs: id: labels uses: addnab/docker-run-action@v3 with: - image: ${{ FQ_SOURCE_IMAGE }} + image: ${{ env.FQ_SOURCE_IMAGE }} shell: bash run: | set -eo pipefail From 5614747d1460ea0adb078fa797c735ad73200499 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Tue, 9 Apr 2024 09:30:24 -0500 Subject: [PATCH 04/17] fix: context of env vars --- .github/workflows/reusable-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 858ab3e2..db8dacb2 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -73,7 +73,7 @@ jobs: echo "SOURCE_IMAGE=base" >> $GITHUB_ENV echo "SOURCE_ORG=fedora-ostree-desktops" >> $GITHUB_ENV fi - echo "FQ_SOURCE_IMAGE=quay.io/${{ env.SOURCE_ORG }}/${{ env.SOURCE_IMAGE }}:${{ matrix.fedora_version }}" >> $GITHUB_ENV + echo "FQ_SOURCE_IMAGE=quay.io/${{ SOURCE_ORG }}/${{ SOURCE_IMAGE }}:${{ matrix.fedora_version }}" >> $GITHUB_ENV - name: Generate tags From e5fae74efac9d2a7e3fceaeddd6e9362ff5d1200 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Tue, 9 Apr 2024 09:31:16 -0500 Subject: [PATCH 05/17] fix: bash not GH vars --- .github/workflows/reusable-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index db8dacb2..95d3f49a 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -73,7 +73,7 @@ jobs: echo "SOURCE_IMAGE=base" >> $GITHUB_ENV echo "SOURCE_ORG=fedora-ostree-desktops" >> $GITHUB_ENV fi - echo "FQ_SOURCE_IMAGE=quay.io/${{ SOURCE_ORG }}/${{ SOURCE_IMAGE }}:${{ matrix.fedora_version }}" >> $GITHUB_ENV + echo "FQ_SOURCE_IMAGE=quay.io/${SOURCE_ORG}/${SOURCE_IMAGE}:${{ matrix.fedora_version }}" >> $GITHUB_ENV - name: Generate tags From 55854319e8003086ad45d823712ac90264253227 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Tue, 9 Apr 2024 09:37:53 -0500 Subject: [PATCH 06/17] fix: vars are funny --- .github/workflows/reusable-build.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 95d3f49a..295a5ef4 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -67,13 +67,15 @@ jobs: run: | if [[ "${{ matrix.fedora_version }}" -ge "41" ]]; then # when we are confident of official fedora images we can switch to them - echo "SOURCE_IMAGE=fedora-silverblue" >> $GITHUB_ENV - echo "SOURCE_ORG=fedora" >> $GITHUB_ENV + export SOURCE_IMAGE=fedora-silverblue + export SOURCE_ORG=fedora else - echo "SOURCE_IMAGE=base" >> $GITHUB_ENV - echo "SOURCE_ORG=fedora-ostree-desktops" >> $GITHUB_ENV + export SOURCE_IMAGE=base + export SOURCE_ORG=fedora-ostree-desktops fi echo "FQ_SOURCE_IMAGE=quay.io/${SOURCE_ORG}/${SOURCE_IMAGE}:${{ matrix.fedora_version }}" >> $GITHUB_ENV + echo "SOURCE_IMAGE=${SOURCE_IMAGE}" >> $GITHUB_ENV + echo "SOURCE_ORG=${SOURCE_ORG}" >> $GITHUB_ENV - name: Generate tags From e21e235b10f1b80c25cd9540bed7762bf279f040 Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Sat, 13 Apr 2024 17:08:37 -0600 Subject: [PATCH 07/17] fix(ci): Use podman to retrieve kernel Signed-off-by: RJ Trujillo --- .github/workflows/reusable-build.yml | 43 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 295a5ef4..04bf1f8b 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -56,7 +56,6 @@ jobs: kernel_flavor: fsync # kernel-fsync packages are not being built for F40 yet. - fedora_version: 40 kernel_flavor: fsync-lts - steps: # Checkout push-to-registry action GitHub repository - name: Checkout Push to Registry action @@ -140,26 +139,28 @@ jobs: podman pull ${{ env.FQ_SOURCE_IMAGE }} - name: Get current version - id: labels - uses: addnab/docker-run-action@v3 - with: - image: ${{ env.FQ_SOURCE_IMAGE }} - shell: bash - run: | - set -eo pipefail - skopeo inspect docker://${{ env.FQ_SOURCE_IMAGE }} > inspect.json - ver=$(jq -r '.Labels["org.opencontainers.image.version"]' inspect.json) - linux=$(jq -r '.Labels["ostree.linux"]' inspect.json) - if [ -z "$ver" ] || [ "null" = "$ver" ]; then - echo "inspected image version must not be empty or null" - exit 1 - fi - if [ -z "$linux" ] || [ "null" = "$linux" ]; then - echo "inspected image linux version must not be empty or null" - exit 1 - fi - echo "SOURCE_IMAGE_VERSION=$ver" >> $GITHUB_ENV - echo "SOURCE_IMAGE_LINUX=$linux" >> $GITHUB_ENV + run: | + set -eo pipefail + + # Get kernel version with podman + container_name="fq-$(uuidgen)" + 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"'-)//') + + skopeo inspect docker://${{ env.FQ_SOURCE_IMAGE }} > inspect.json + ver=$(jq -r '.Labels["org.opencontainers.image.version"]' inspect.json) + if [ -z "$ver" ] || [ "null" = "$ver" ]; then + echo "inspected image version must not be empty or null" + exit 1 + fi + if [ -z "$linux" ] || [ "null" = "$linux" ]; then + echo "inspected image linux version must not be empty or null" + exit 1 + fi + echo "SOURCE_IMAGE_VERSION=$ver" >> $GITHUB_ENV + echo "SOURCE_IMAGE_LINUX=$linux" >> $GITHUB_ENV # Build metadata - name: Image Metadata From b2d55f49549a5ca8085136629d9f598f7cd319e4 Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Sun, 14 Apr 2024 12:22:11 -0600 Subject: [PATCH 08/17] fix(ci): Support version retrieval across kernel variants Signed-off-by: RJ Trujillo --- .github/workflows/reusable-build.yml | 30 ++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 04bf1f8b..2bab2787 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -142,12 +142,34 @@ jobs: run: | set -eo pipefail - # Get kernel version with podman + # Start container and install dnf container_name="fq-$(uuidgen)" 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"'-)//') + podman exec $container_name rpm-ostree install dnf dnf-plugins-core + + # Fetch kernel version + dnf="podman exec $container_name dnf" + case "${{ matrix.kernel_flavor }}" in + "asus") + $dnf copr enable -y lukenukem/asus-kernel + linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:lukenukem:asus-kernel --whatprovides kernel | tail -n1 | sed 's/.*://') + ;; + "fsync") + $dnf copr enable -y sentry/kernel-fsync + linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-fsync --whatprovides kernel | tail -n1 | sed 's/.*://') + ;; + "fsync-lts") + $dnf copr enable -y sentry/kernel-fsync-lts + linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-fsync-lts --whatprovides kernel | tail -n1 | sed 's/.*://') + ;; + "surface") + $dnf config-manager --add-repo=https://pkg.surfacelinux.com/fedora/linux-surface.repo + linux=$($dnf repoquery --repoid linux-surface --whatprovides kernel-surface | tail -n1 | sed 's/.*://') + ;; + *) + linux=$($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) From 12900ce00ebb0cb5ecd1039b1461aadc625786fa Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Sun, 14 Apr 2024 19:31:04 -0500 Subject: [PATCH 09/17] conditional query of dnf vs skopeo --- .github/workflows/reusable-build.yml | 65 +++++++++++++++------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 2bab2787..4dd329d0 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -142,41 +142,48 @@ jobs: run: | set -eo pipefail - # Start container and install dnf - container_name="fq-$(uuidgen)" - podman run --entrypoint /bin/bash --name "$container_name" -dt "${{ env.FQ_SOURCE_IMAGE }}" - podman exec $container_name rpm-ostree install dnf dnf-plugins-core - - # Fetch kernel version - dnf="podman exec $container_name dnf" - case "${{ matrix.kernel_flavor }}" in - "asus") - $dnf copr enable -y lukenukem/asus-kernel - linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:lukenukem:asus-kernel --whatprovides kernel | tail -n1 | sed 's/.*://') - ;; - "fsync") - $dnf copr enable -y sentry/kernel-fsync - linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-fsync --whatprovides kernel | tail -n1 | sed 's/.*://') - ;; - "fsync-lts") - $dnf copr enable -y sentry/kernel-fsync-lts - linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-fsync-lts --whatprovides kernel | tail -n1 | sed 's/.*://') - ;; - "surface") - $dnf config-manager --add-repo=https://pkg.surfacelinux.com/fedora/linux-surface.repo - linux=$($dnf repoquery --repoid linux-surface --whatprovides kernel-surface | tail -n1 | sed 's/.*://') - ;; - *) - linux=$($dnf repoquery --installed --whatprovides kernel | tail -n1 | sed 's/.*://') - ;; - esac - + # skopeo must always run to inspect image labels for build version skopeo inspect docker://${{ env.FQ_SOURCE_IMAGE }} > inspect.json ver=$(jq -r '.Labels["org.opencontainers.image.version"]' inspect.json) if [ -z "$ver" ] || [ "null" = "$ver" ]; then echo "inspected image version must not be empty or null" exit 1 fi + + if [ "main" == "${{ matrix.kernel_flavor }}" ]; then + # main kernel_flavor: use ostree.linux to determine kernel version + linux=$(jq -r '.Labels["ostree.linux"]' inspect.json) + else + # other kernel_flavor: start container use dnf to find kernel version + container_name="fq-$(uuidgen)" + podman run --entrypoint /bin/bash --name "$container_name" -dt "${{ env.FQ_SOURCE_IMAGE }}" + podman exec $container_name rpm-ostree install dnf dnf-plugins-core + + # Fetch kernel version + dnf="podman exec $container_name dnf" + case "${{ matrix.kernel_flavor }}" in + "asus") + $dnf copr enable -y lukenukem/asus-kernel + linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:lukenukem:asus-kernel --whatprovides kernel | tail -n1 | sed 's/.*://') + ;; + "fsync") + $dnf copr enable -y sentry/kernel-fsync + linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-fsync --whatprovides kernel | tail -n1 | sed 's/.*://') + ;; + "fsync-lts") + $dnf copr enable -y sentry/kernel-fsync-lts + linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-fsync-lts --whatprovides kernel | tail -n1 | sed 's/.*://') + ;; + "surface") + $dnf config-manager --add-repo=https://pkg.surfacelinux.com/fedora/linux-surface.repo + linux=$($dnf repoquery --repoid linux-surface --whatprovides kernel-surface | tail -n1 | sed 's/.*://') + ;; + *) + echo "unexpected kernel_flavor '${{ matrix.kernel_flavor }}' for dnf repoquery" + ;; + esac + fi + if [ -z "$linux" ] || [ "null" = "$linux" ]; then echo "inspected image linux version must not be empty or null" exit 1 From df2d41accaa648cb5143db52e5a4b6c76472d1ea Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Sun, 14 Apr 2024 21:22:15 -0500 Subject: [PATCH 10/17] use coreos pool to support older KERNEL_VERSION arg --- .github/workflows/reusable-build.yml | 5 +++-- Containerfile.common | 1 + Containerfile.nvidia | 1 + build-prep.sh | 11 ++++++++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 4dd329d0..554ddd86 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -189,7 +189,7 @@ jobs: exit 1 fi echo "SOURCE_IMAGE_VERSION=$ver" >> $GITHUB_ENV - echo "SOURCE_IMAGE_LINUX=$linux" >> $GITHUB_ENV + echo "KERNEL_VERSION=$linux" >> $GITHUB_ENV # Build metadata - name: Image Metadata @@ -202,7 +202,7 @@ jobs: org.opencontainers.image.title=${{ env.IMAGE_NAME }} org.opencontainers.image.description=A caching layer for pre-built akmod RPMs org.opencontainers.image.version=${{ env.SOURCE_IMAGE_VERSION }} - ostree.linux=${{ env.SOURCE_IMAGE_LINUX }} + ostree.linux=${{ env.KERNEL_VERSION }} io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/main/README.md io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/1728152?s=200&v=4 @@ -220,6 +220,7 @@ jobs: SOURCE_IMAGE=${{ env.SOURCE_IMAGE }} SOURCE_ORG=${{ env.SOURCE_ORG }} KERNEL_FLAVOR=${{ matrix.kernel_flavor }} + KERNEL_VERSION=${{ env.KERNEL_VERSION }} FEDORA_MAJOR_VERSION=${{ matrix.fedora_version }} NVIDIA_MAJOR_VERSION=${{ matrix.nvidia_version }} RPMFUSION_MIRROR=${{ vars.RPMFUSION_MIRROR }} diff --git a/Containerfile.common b/Containerfile.common index 755faee3..91ac3955 100644 --- a/Containerfile.common +++ b/Containerfile.common @@ -11,6 +11,7 @@ ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-39}" FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS builder ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-39}" ARG KERNEL_FLAVOR="{KERNEL_FLAVOR:-main}" +ARG KERNEL_VERSION="" ARG RPMFUSION_MIRROR="" COPY build*.sh /tmp diff --git a/Containerfile.nvidia b/Containerfile.nvidia index be0fad5f..fcbd9d41 100644 --- a/Containerfile.nvidia +++ b/Containerfile.nvidia @@ -12,6 +12,7 @@ FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS builder ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-39}" ARG NVIDIA_MAJOR_VERSION="${NVIDIA_MAJOR_VERSION:-550}" ARG KERNEL_FLAVOR="{KERNEL_FLAVOR:-main}" +ARG KERNEL_VERSION="" ARG RPMFUSION_MIRROR="" COPY build*.sh /tmp diff --git a/build-prep.sh b/build-prep.sh index d29f186d..49f4bce0 100755 --- a/build-prep.sh +++ b/build-prep.sh @@ -103,8 +103,17 @@ elif [[ "surface" == "${KERNEL_FLAVOR}" ]]; then --install kernel-surface-modules \ --install kernel-surface-modules-core \ --install kernel-surface-modules-extra +elif [[ "main" == "${KERNEL_FLAVOR}" ]] && \ + [[ "" != "${KERNEL_VERSION}" ]]; then + echo "main kernel with version to avoid upgrading kernel beyond what is in the image." + curl -L https://raw.githubusercontent.com/coreos/fedora-coreos-config/testing-devel/fedora-coreos-pool.repo \ + -o /etc/yum.repos.d/fedora-coreos-pool.repo + rpm-ostree cliwrap install-to-root / + rpm-ostree install \ + kernel-devel-${KERNEL_VERSION} \ + kernel-devel-matched-${KERNEL_VERSION} else - echo "Default main kernel needs no customization." + echo "Default main kernel without a specific version." fi From ba3e48bb9fa97bd5ccdb8a8fdc117c58c5749a2a Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Sun, 14 Apr 2024 21:27:09 -0500 Subject: [PATCH 11/17] need coreos-pool for surface, not just main --- build-prep.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build-prep.sh b/build-prep.sh index 49f4bce0..35c78574 100755 --- a/build-prep.sh +++ b/build-prep.sh @@ -42,6 +42,10 @@ if [ -n "${RPMFUSION_MIRROR}" ]; then sed -i "s%^#baseurl=http://download1.rpmfusion.org%baseurl=${RPMFUSION_MIRROR}%" /etc/yum.repos.d/rpmfusion-*.repo fi +# required for main and surface when fedora repo has updated kernel beyond what was in the image +curl -L https://raw.githubusercontent.com/coreos/fedora-coreos-config/testing-devel/fedora-coreos-pool.repo \ + -o /etc/yum.repos.d/fedora-coreos-pool.repo + ### PREPARE CUSTOM KERNEL SUPPORT if [[ "asus" == "${KERNEL_FLAVOR}" ]]; then echo "Installing ASUS Kernel:" @@ -106,8 +110,6 @@ elif [[ "surface" == "${KERNEL_FLAVOR}" ]]; then elif [[ "main" == "${KERNEL_FLAVOR}" ]] && \ [[ "" != "${KERNEL_VERSION}" ]]; then echo "main kernel with version to avoid upgrading kernel beyond what is in the image." - curl -L https://raw.githubusercontent.com/coreos/fedora-coreos-config/testing-devel/fedora-coreos-pool.repo \ - -o /etc/yum.repos.d/fedora-coreos-pool.repo rpm-ostree cliwrap install-to-root / rpm-ostree install \ kernel-devel-${KERNEL_VERSION} \ From 5531632b8e6cbc4deb0d4b8e6904f83d1a22dad6 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Sun, 14 Apr 2024 21:33:56 -0500 Subject: [PATCH 12/17] chore: restore F38/F39 builds before moerging --- .github/workflows/build-38.yml | 2 +- .github/workflows/build-39.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-38.yml b/.github/workflows/build-38.yml index 3242085d..0496f426 100644 --- a/.github/workflows/build-38.yml +++ b/.github/workflows/build-38.yml @@ -1,6 +1,6 @@ name: ublue akmods 38 on: - #pull_request: + pull_request: merge_group: schedule: - cron: '10 14 * * *' # 2pm-ish UTC everyday (timed against official fedora container pushes, and after 'config') diff --git a/.github/workflows/build-39.yml b/.github/workflows/build-39.yml index 90596696..11ad11f8 100644 --- a/.github/workflows/build-39.yml +++ b/.github/workflows/build-39.yml @@ -1,6 +1,6 @@ name: ublue akmods 39 on: - #pull_request: + pull_request: merge_group: schedule: - cron: '0 14 * * *' # 2pm-ish UTC everyday (timed against official fedora container pushes, and after 'config') From cf3849c60e4bd24b2352df698ab8400a0f5d935f Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Sun, 14 Apr 2024 21:48:50 -0500 Subject: [PATCH 13/17] chore: fix fsync-lts get version --- .github/workflows/reusable-build.yml | 4 ++-- build-prep.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 554ddd86..b60e23cb 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -171,8 +171,8 @@ jobs: linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-fsync --whatprovides kernel | tail -n1 | sed 's/.*://') ;; "fsync-lts") - $dnf copr enable -y sentry/kernel-fsync-lts - linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-fsync-lts --whatprovides kernel | tail -n1 | sed 's/.*://') + $dnf copr enable -y sentry/kernel-ba + linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-ba --whatprovides kernel | tail -n1 | sed 's/.*://') ;; "surface") $dnf config-manager --add-repo=https://pkg.surfacelinux.com/fedora/linux-surface.repo diff --git a/build-prep.sh b/build-prep.sh index 35c78574..e234eb0c 100755 --- a/build-prep.sh +++ b/build-prep.sh @@ -109,7 +109,7 @@ elif [[ "surface" == "${KERNEL_FLAVOR}" ]]; then --install kernel-surface-modules-extra elif [[ "main" == "${KERNEL_FLAVOR}" ]] && \ [[ "" != "${KERNEL_VERSION}" ]]; then - echo "main kernel with version to avoid upgrading kernel beyond what is in the image." + echo "main kernel version ${KERNEL_VERSION} to avoid upgrading kernel beyond what is in the image." rpm-ostree cliwrap install-to-root / rpm-ostree install \ kernel-devel-${KERNEL_VERSION} \ From b6fecb66b52d196cadec7bc49d2c1bf295ac342b Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Thu, 18 Apr 2024 20:17:36 -0500 Subject: [PATCH 14/17] chore: cleanup build a bit given single nvidia version --- .github/workflows/reusable-build.yml | 27 ++++++++++----------------- Containerfile.nvidia | 7 +++---- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index b60e23cb..a02087f1 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -7,7 +7,7 @@ on: required: true type: string env: - IMAGE_NAME: akmods + IMAGE_BASE_NAME: akmods IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} concurrency: @@ -36,14 +36,7 @@ jobs: cfile_suffix: - common - nvidia - nvidia_version: - - 0 - - 550 exclude: - - cfile_suffix: common - nvidia_version: 550 - - cfile_suffix: nvidia - nvidia_version: 0 - kernel_flavor: asus fedora_version: 38 - kernel_flavor: surface @@ -64,6 +57,11 @@ jobs: - name: Matrix Variables shell: bash run: | + if [ "common" == "${{ matrix.cfile_suffix }}" ]; then + echo "IMAGE_NAME=${{ env.IMAGE_BASE_NAME }}" >> $GITHUB_ENV + else + echo "IMAGE_NAME=${{ env.IMAGE_BASE_NAME }}-${{ matrix.cfile_suffix }}" >> $GITHUB_ENV + fi if [[ "${{ matrix.fedora_version }}" -ge "41" ]]; then # when we are confident of official fedora images we can switch to them export SOURCE_IMAGE=fedora-silverblue @@ -83,11 +81,7 @@ jobs: run: | # Generate a timestamp for creating an image version history TIMESTAMP="$(date +%Y%m%d)" - if [[ "${{ matrix.cfile_suffix }}" == "nvidia" ]]; then - VARIANT="${{ matrix.kernel_flavor }}-${{ matrix.fedora_version }}-${{ matrix.nvidia_version }}" - else - VARIANT="${{ matrix.kernel_flavor }}-${{ matrix.fedora_version }}" - fi + VARIANT="${{ matrix.kernel_flavor }}-${{ matrix.fedora_version }}" COMMIT_TAGS=() BUILD_TAGS=() @@ -197,9 +191,9 @@ jobs: id: meta with: images: | - ${{ 'nvidia' == matrix.cfile_suffix && format('{0}-nvidia', env.IMAGE_NAME) || format('{0}', env.IMAGE_NAME) }} + ${{ env.IMAGE_NAME }} labels: | - org.opencontainers.image.title=${{ env.IMAGE_NAME }} + org.opencontainers.image.title=${{ env.IMAGE_BASE_NAME }} org.opencontainers.image.description=A caching layer for pre-built akmod RPMs org.opencontainers.image.version=${{ env.SOURCE_IMAGE_VERSION }} ostree.linux=${{ env.KERNEL_VERSION }} @@ -213,7 +207,7 @@ jobs: with: containerfiles: | ./Containerfile.${{ matrix.cfile_suffix }} - image: ${{ 'nvidia' == matrix.cfile_suffix && format('{0}-nvidia', env.IMAGE_NAME) || format('{0}', env.IMAGE_NAME) }} + image: ${{ env.IMAGE_NAME }} tags: | ${{ steps.generate-tags.outputs.alias_tags }} build-args: | @@ -222,7 +216,6 @@ jobs: KERNEL_FLAVOR=${{ matrix.kernel_flavor }} KERNEL_VERSION=${{ env.KERNEL_VERSION }} FEDORA_MAJOR_VERSION=${{ matrix.fedora_version }} - NVIDIA_MAJOR_VERSION=${{ matrix.nvidia_version }} RPMFUSION_MIRROR=${{ vars.RPMFUSION_MIRROR }} labels: ${{ steps.meta.outputs.labels }} oci: false diff --git a/Containerfile.nvidia b/Containerfile.nvidia index fcbd9d41..fffeb0b8 100644 --- a/Containerfile.nvidia +++ b/Containerfile.nvidia @@ -1,8 +1,8 @@ ### -### Containerfile.nvidia - used to build ONLY NVIDIA kmods (one driver version per build) +### Containerfile.nvidia - used to build ONLY NVIDIA kmods ### -#Build from base, simpley because it's the smallest image +#Build from base, simply because it's the smallest image ARG SOURCE_IMAGE="${SOURCE_IMAGE:-base}" ARG SOURCE_ORG="${SOURCE_ORG:-fedora-ostree-desktops}" ARG BASE_IMAGE="quay.io/${SOURCE_ORG}/${SOURCE_IMAGE}" @@ -10,7 +10,6 @@ ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-39}" FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS builder ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-39}" -ARG NVIDIA_MAJOR_VERSION="${NVIDIA_MAJOR_VERSION:-550}" ARG KERNEL_FLAVOR="{KERNEL_FLAVOR:-main}" ARG KERNEL_VERSION="" ARG RPMFUSION_MIRROR="" @@ -40,7 +39,7 @@ RUN if grep -qv "surface" <<< "${KERNEL_FLAVOR}"; then \ ; else \ export KERNEL_NAME="kernel-surface" \ ; fi && \ - /tmp/build-kmod-nvidia.sh ${NVIDIA_MAJOR_VERSION} + /tmp/build-kmod-nvidia.sh 550 RUN cp /tmp/ublue-os-nvidia-addons/rpmbuild/RPMS/noarch/ublue-os-nvidia-addons*.rpm \ /var/cache/rpms/ublue-os/ From ac3107d9b2c82ecf4a9827af7e9aa411fb665067 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Thu, 18 Apr 2024 22:11:10 -0500 Subject: [PATCH 15/17] chore: consistent curl use and main kernel support --- .github/workflows/reusable-build.yml | 3 +++ build-prep.sh | 23 +++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index a02087f1..64f5fc0a 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -168,6 +168,9 @@ jobs: $dnf copr enable -y sentry/kernel-ba linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-ba --whatprovides kernel | tail -n1 | sed 's/.*://') ;; + "main") + linux=$($dnf repoquery --whatprovides kernel | tail -n1 | sed 's/.*://') + ;; "surface") $dnf config-manager --add-repo=https://pkg.surfacelinux.com/fedora/linux-surface.repo linux=$($dnf repoquery --repoid linux-surface --whatprovides kernel-surface | tail -n1 | sed 's/.*://') diff --git a/build-prep.sh b/build-prep.sh index e234eb0c..e1b5be00 100755 --- a/build-prep.sh +++ b/build-prep.sh @@ -43,13 +43,14 @@ if [ -n "${RPMFUSION_MIRROR}" ]; then fi # required for main and surface when fedora repo has updated kernel beyond what was in the image -curl -L https://raw.githubusercontent.com/coreos/fedora-coreos-config/testing-devel/fedora-coreos-pool.repo \ - -o /etc/yum.repos.d/fedora-coreos-pool.repo +curl -L -o /etc/yum.repos.d/fedora-coreos-pool.repo \ + https://raw.githubusercontent.com/coreos/fedora-coreos-config/testing-devel/fedora-coreos-pool.repo ### PREPARE CUSTOM KERNEL SUPPORT if [[ "asus" == "${KERNEL_FLAVOR}" ]]; then echo "Installing ASUS Kernel:" - wget https://copr.fedorainfracloud.org/coprs/lukenukem/asus-kernel/repo/fedora-$(rpm -E %fedora)/lukenukem-asus-kernel-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_lukenukem-asus-kernel.repo + curl -L -o /etc/yum.repos.d/_copr_lukenukem-asus-kernel.repo \ + https://copr.fedorainfracloud.org/coprs/lukenukem/asus-kernel/repo/fedora-$(rpm -E %fedora)/lukenukem-asus-kernel-fedora-$(rpm -E %fedora).repo rpm-ostree cliwrap install-to-root / rpm-ostree override replace \ --experimental \ @@ -63,7 +64,8 @@ if [[ "asus" == "${KERNEL_FLAVOR}" ]]; then kernel-modules-extra elif [[ "fsync-lts" == "${KERNEL_FLAVOR}" ]]; then echo "Installing fsync-lts kernel:" - wget https://copr.fedorainfracloud.org/coprs/sentry/kernel-ba/repo/fedora-$(rpm -E %fedora)/sentry-kernel-ba-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_sentry-kernel-ba.repo + curl -L -o /etc/yum.repos.d/_copr_sentry-kernel-ba.repo \ + https://copr.fedorainfracloud.org/coprs/sentry/kernel-ba/repo/fedora-$(rpm -E %fedora)/sentry-kernel-ba-fedora-$(rpm -E %fedora).repo rpm-ostree cliwrap install-to-root / rpm-ostree override replace \ --experimental \ @@ -77,7 +79,8 @@ elif [[ "fsync-lts" == "${KERNEL_FLAVOR}" ]]; then kernel-modules-extra elif [[ "fsync" == "${KERNEL_FLAVOR}" ]]; then echo "Installing fsync kernel:" - wget https://copr.fedorainfracloud.org/coprs/sentry/kernel-fsync/repo/fedora-$(rpm -E %fedora)/sentry-kernel-fsync-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_sentry-kernel-fsync.repo + curl -L -o /etc/yum.repos.d/_copr_sentry-kernel-fsync.repo \ + https://copr.fedorainfracloud.org/coprs/sentry/kernel-fsync/repo/fedora-$(rpm -E %fedora)/sentry-kernel-fsync-fedora-$(rpm -E %fedora).repo rpm-ostree cliwrap install-to-root / rpm-ostree override replace \ --experimental \ @@ -92,9 +95,10 @@ elif [[ "fsync" == "${KERNEL_FLAVOR}" ]]; then elif [[ "surface" == "${KERNEL_FLAVOR}" ]]; then echo "Installing Surface Kernel:" # Add Linux Surface repo - wget https://pkg.surfacelinux.com/fedora/linux-surface.repo -P /etc/yum.repos.d - wget https://github.com/linux-surface/linux-surface/releases/download/silverblue-20201215-1/kernel-20201215-1.x86_64.rpm -O \ - /tmp/surface-kernel.rpm + curl -L -o /etc/yum.repos.d/linux-surface.repo \ + https://pkg.surfacelinux.com/fedora/linux-surface.repo + curl -L -o /tmp/surface-kernel.rpm \ + https://github.com/linux-surface/linux-surface/releases/download/silverblue-20201215-1/kernel-20201215-1.x86_64.rpm rpm-ostree cliwrap install-to-root / rpm-ostree override replace /tmp/surface-kernel.rpm \ --remove kernel-core \ @@ -116,6 +120,9 @@ elif [[ "main" == "${KERNEL_FLAVOR}" ]] && \ kernel-devel-matched-${KERNEL_VERSION} else echo "Default main kernel without a specific version." + rpm-ostree install \ + kernel-devel \ + kernel-devel-matched fi From c1fb0d577c655c93a96aa7af76a9016d6e32a6fa Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Thu, 18 Apr 2024 22:28:29 -0500 Subject: [PATCH 16/17] docs: remove specific nvidia driver version --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 96f82e6f..76ea0f59 100644 --- a/README.md +++ b/README.md @@ -40,21 +40,21 @@ The [`akmods` image](https://github.com/orgs/ublue-os/packages/container/package Here's a rundown on how it's organized. -We do our best to support all current builds of Fedora, current versions of the kernel modules listed, and in the case of NVIDIA current (550). -**Note: NVIDIA legacy driver version 470 is no longer provided as RPMfusion has ceased updates to the package and it no longer builds with kernel 6.8 which has now released for Fedora 38 and 39.** +We do our best to support all current builds of Fedora, current versions of the kernel modules listed, and the latest NVIDIA driver. +**Note: NVIDIA legacy driver version 470 is no longer provided as RPMfusion has ceased updates to the package and it no longer builds with kernel 6.8 which has now released for Fedora 38 and 39. Also the `-550` extra driver version tag has been removed as the latest driver will always be included.** The majority of the drivers are tagged with `KERNEL_TYPE-FEDORA_RELEASE`. NVIDIA drivers are bundled distinctly with tag `KERNEL_TYPE-FEDORA_RELEASE-NVIDIA_VERSION`. | KERNEL_TYPE | FEDORA_RELEASE | TAG | | - | - | - | -| Fedora stock kernel | 38 | `main-38`, `main-38-550` | -| | 39 | `main-39`, `main-39-550` | -| | 40 | `main-40`, `main-40-550` | -| [patched for ASUS devices](https://copr.fedorainfracloud.org/coprs/lukenukem/asus-kernel) | 39 | `asus-39`, `asus-39-550` | -| | 40 | `asus-40`, `asus-40-550` | -| [patched fsync](https://copr.fedorainfracloud.org/coprs/sentry/kernel-fsync) | 39 | `fsync-39`, `fsync-39-550` | -| [patched Microsoft Surface devices](https://github.com/linux-surface/linux-surface/) | 39 | `surface-39`, `surface-39-550` | -| | 40 | `surface-40`, `surface-40-550` | +| Fedora stock kernel | 38 | `main-38` | +| | 39 | `main-39` | +| | 40 | `main-40` | +| [patched for ASUS devices](https://copr.fedorainfracloud.org/coprs/lukenukem/asus-kernel) | 39 | `asus-39`| +| | 40 | `asus-40` | +| [patched fsync](https://copr.fedorainfracloud.org/coprs/sentry/kernel-fsync) | 39 | `fsync-39` | +| [patched Microsoft Surface devices](https://github.com/linux-surface/linux-surface/) | 39 | `surface-39` | +| | 40 | `surface-40` | From db669fd7431f1520a58cd69443fd12ddd5db0cd6 Mon Sep 17 00:00:00 2001 From: Benjamin Sherman Date: Thu, 18 Apr 2024 22:34:15 -0500 Subject: [PATCH 17/17] chore: remove version from nvidia-vars --- build-kmod-nvidia.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-kmod-nvidia.sh b/build-kmod-nvidia.sh index 2948701e..0113481c 100755 --- a/build-kmod-nvidia.sh +++ b/build-kmod-nvidia.sh @@ -34,7 +34,7 @@ akmods --force --kernels "${KERNEL_VERSION}" --kmod "${NVIDIA_PACKAGE_NAME}" modinfo /usr/lib/modules/${KERNEL_VERSION}/extra/${NVIDIA_PACKAGE_NAME}/nvidia{,-drm,-modeset,-peermem,-uvm}.ko.xz > /dev/null || \ (cat /var/cache/akmods/${NVIDIA_PACKAGE_NAME}/${NVIDIA_AKMOD_VERSION}-for-${KERNEL_VERSION}.failed.log && exit 1) -cat < /var/cache/rpms/kmods/nvidia-vars.${NVIDIA_MAJOR_VERSION} +cat < /var/cache/rpms/kmods/nvidia-vars KERNEL_VERSION=${KERNEL_VERSION} RELEASE=${RELEASE} NVIDIA_PACKAGE_NAME=${NVIDIA_PACKAGE_NAME}