-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): combining kernel-cache and akmods (#295)
- Loading branch information
Showing
13 changed files
with
599 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
--- | ||
name: Get Kernel Version | ||
inputs: | ||
fedora_version: | ||
description: "The Fedora release version: 40, 41, etc" | ||
required: true | ||
type: string | ||
kernel_flavor: | ||
description: "The Kernel flavor: main, bazzite, coreos-stable, etc" | ||
required: true | ||
type: string | ||
outputs: | ||
kernel_build_tag: | ||
description: "Optional (bazzite specific) tag" | ||
value: ${{ steps.kernel.outputs.build_tag }} | ||
kernel_major_minor_patch: | ||
description: "Simple version eg, 6.12.9" | ||
value: ${{ steps.kernel.outputs.major_minor_patch }} | ||
kernel_release: | ||
description: "Full kernel release eg, 6.12.9-200.fc41.x86_64" | ||
value: ${{ steps.kernel.outputs.release }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Get Kernel Version | ||
id: kernel | ||
shell: bash | ||
run: | | ||
if [[ ${{ inputs.kernel_flavor }} =~ asus|surface ]]; then | ||
build_image="quay.io/fedora/fedora:${{ inputs.fedora_version }}" | ||
podman pull "$build_image" | ||
container_name="fq-$(uuidgen)" | ||
dnf="podman exec $container_name dnf" | ||
podman run --entrypoint /bin/bash --name "$container_name" -dt "$build_image" | ||
$dnf install -y --setopt=install_weak_deps=False dnf-plugins-core | ||
fi | ||
coreos_kernel () { | ||
coreos_version=${1} | ||
image_linux=$(skopeo inspect docker://quay.io/fedora/fedora-coreos:${coreos_version} | jq -r '.Labels["ostree.linux"]') | ||
# Pin a kernel here, gross workaround TODO: Make this cleaner | ||
# if [[ "${{ inputs.kernel_flavor }}" == "coreos-stable" ]]; then | ||
# image_linux="6.11.3-300.fc41.x86_64" | ||
# fi | ||
major_minor_patch=$(echo $image_linux | grep -oP '^\d+\.\d+\.\d+') | ||
kernel_rel_part=$(echo $image_linux | grep -oP '^\d+\.\d+\.\d+\-\K([123][0]{2})') | ||
arch=$(echo $image_linux | grep -oP 'fc\d+\.\K.*$') | ||
kernel_rel="$kernel_rel_part.fc${{ inputs.fedora_version }}" | ||
kernel_version="$major_minor_patch-$kernel_rel.$arch" | ||
URL="https://kojipkgs.fedoraproject.org/packages/kernel/"$major_minor_patch"/"$kernel_rel"/"$arch"/kernel-"$kernel_version".rpm" | ||
echo "Querying koji for ${coreos_version} kernel: $kernel_version" | ||
echo "$URL" | ||
HTTP_RESP=$(curl -sI "$URL" | grep ^HTTP) | ||
linux="" | ||
if grep -qv "200 OK" <<< "${HTTP_RESP}"; then | ||
echo "Koji failed to find $coreos_version kernel: $kernel_version" | ||
case "$kernel_rel_part" in | ||
"300") | ||
kernel_rel_part="200" | ||
;; | ||
"200") | ||
kernel_rel_part="100" | ||
;; | ||
"100") | ||
;; | ||
*) | ||
echo "unexpected kernel_rel_part ${kernel_rel_part}" | ||
;; | ||
esac | ||
kernel_rel="$kernel_rel_part.fc${{ inputs.fedora_version }}" | ||
kernel_version="$major_minor_patch-$kernel_rel.$arch" | ||
URL="https://kojipkgs.fedoraproject.org/packages/kernel/"$major_minor_patch"/"$kernel_rel"/"$arch"/kernel-"$kernel_version".rpm" | ||
echo "Re-querying koji for ${coreos_version} kernel: $kernel_version" | ||
echo "$URL" | ||
HTTP_RESP=$(curl -sI "$URL" | grep ^HTTP) | ||
if grep -qv "200 OK" <<< "${HTTP_RESP}"; then | ||
echo "Koji failed to find $coreos_version kernel: $kernel_version" | ||
fi | ||
fi | ||
if grep -q "200 OK" <<< "${HTTP_RESP}"; then | ||
linux=$kernel_version | ||
fi | ||
} | ||
case ${{ inputs.kernel_flavor }} in | ||
"asus") | ||
$dnf copr enable -y lukenukem/asus-kernel | ||
linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:lukenukem:asus-kernel --whatprovides kernel | sort -V | 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 | sort -V | tail -n1 | sed 's/.*://') | ||
;; | ||
"fsync-ba") | ||
$dnf copr enable -y sentry/kernel-ba | ||
linux=$($dnf repoquery --repoid copr:copr.fedorainfracloud.org:sentry:kernel-ba --whatprovides kernel | sort -V | tail -n1 | sed 's/.*://') | ||
;; | ||
"bazzite") | ||
latest="$(curl "https://api.github.com/repos/hhd-dev/kernel-bazzite/releases/latest" )" | ||
linux=$(echo -E "$latest" | jq -r '.assets[].name' | grep -E 'kernel-.*.rpm' | grep "fc${{ inputs.fedora_version }}.x86_64" | head -1 | sed "s/kernel-//g" | sed "s/.rpm//g" ) | ||
build_tag=$(echo -E $latest | jq -r '.tag_name') | ||
;; | ||
"surface") | ||
if [[ "${{ inputs.fedora_version }}" < 41 ]]; then | ||
$dnf config-manager --add-repo=https://pkg.surfacelinux.com/fedora/linux-surface.repo | ||
else | ||
$dnf config-manager addrepo --from-repofile=https://pkg.surfacelinux.com/fedora/linux-surface.repo | ||
fi | ||
linux=$($dnf repoquery --repoid linux-surface --whatprovides kernel-surface | sort -V | tail -n1 | sed 's/.*://') | ||
;; | ||
"main") | ||
base_image_name="base" | ||
if [[ ${{ inputs.fedora_version }} > 40 ]]; then | ||
base_image_name+="-atomic" | ||
fi | ||
linux=$(skopeo inspect docker://quay.io/fedora-ostree-desktops/$base_image_name:${{ inputs.fedora_version }} | jq -r '.Labels["ostree.linux"]' ) | ||
;; | ||
"coreos-stable") | ||
coreos_kernel stable | ||
;; | ||
"coreos-testing") | ||
coreos_kernel testing | ||
;; | ||
*) | ||
echo "unexpected kernel_flavor '${{ inputs.kernel_flavor }}' for query" | ||
;; | ||
esac | ||
if [ -z "$linux" ] || [ "null" = "$linux" ]; then | ||
echo "inspected image linux version must not be empty or null" | ||
exit 1 | ||
fi | ||
major=$(echo "$linux" | cut -d '.' -f 1) | ||
minor=$(echo "$linux" | cut -d '.' -f 2) | ||
patch=$(echo "$linux" | cut -d '.' -f 3) | ||
kernel_major_minor_patch="${major}.${minor}.${patch}" | ||
# Debug Output | ||
echo "kernel_build_tag: ${build_tag}" | ||
echo "kernel_flavor: ${{ inputs.kernel_flavor }}" | ||
echo "kernel_major_minor_patch: ${kernel_major_minor_patch}" | ||
echo "kernel_release: ${linux}" | ||
# Action Output | ||
echo "build_tag=${build_tag}" >> $GITHUB_OUTPUT | ||
echo "major_minor_patch=${kernel_major_minor_patch}" >> $GITHUB_OUTPUT | ||
echo "release=${linux}" >> $GITHUB_OUTPUT | ||
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.