From 685391e7fa13248969fca58b6c1f3c5bc720d43c Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Sat, 13 Apr 2024 17:08:37 -0600 Subject: [PATCH] fix(ci): Use podman to retrieve kernel --- .github/workflows/reusable-build.yml | 44 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index fca5d609..6dcf2551 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -51,7 +51,6 @@ jobs: kernel_flavor: fsync # kernel-fsync not required for ublue-os F38 - fedora_version: 40 kernel_flavor: fsync # kernel-fsync packages are not being built for F40 yet. - steps: # Checkout push-to-registry action GitHub repository - name: Checkout Push to Registry action @@ -135,26 +134,27 @@ 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 + podman run --entrypoint /bin/bash --replace --name "${{ env.FQ_SOURCE_IMAGE }}" -dt "${{ env.FQ_SOURCE_IMAGE }}" + installed_packages=$(podman exec "${{ env.FQ_SOURCE_IMAGE }}" 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 @@ -167,7 +167,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 }} + akmods.linux=${{ env.SOURCE_IMAGE_LINUX }} 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