Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add proper kernel version to ostree.linux label #167

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-38.yml
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-39.yml
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
89 changes: 58 additions & 31 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -67,12 +66,16 @@ 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
id: generate-tags
Expand Down Expand Up @@ -125,27 +128,61 @@ 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/[email protected]
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
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 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 All @@ -162,16 +199,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/[email protected]
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
Expand Down
Loading