Skip to content

Commit

Permalink
fix(ci): Use podman to retrieve kernel
Browse files Browse the repository at this point in the history
Signed-off-by: RJ Trujillo <eyecantcu@pm.me>
  • Loading branch information
EyeCantCU committed Apr 13, 2024
1 parent dacfda2 commit 82bfd6a
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -135,26 +134,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
Expand Down

0 comments on commit 82bfd6a

Please sign in to comment.