mirror-ublue-os-akmods/.github/workflows/reusable-cache-kernel.yml
m2 00880e48db
refactor: implement local builds (#356)
* refactor: implement local builds

This has a long way to go. But at least want to get the branch published.

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* disable all workflows while iterating

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* cleanup fetch-kernel.sh

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* enable local builds

Still need to generate tags. Removal of most of the suffix Containerfiles.

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* add tags, images.yaml

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* use anchors more!

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* start on workflows

No Testing and Pushing in yet.

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* update workflows

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* more workflow modifications

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* don't cache during PRs

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* fix base64 decode

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* fix path name

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* name file

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* quotes?

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* try again.

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* try again

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* quote the env?

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* tell base64 to read from stdin

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* update workflows

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* try different way for getting json file

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* fix conditional

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* try github.workspace

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* just hardcode it

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* typo

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* main doesn't have zfs....

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* One button build

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* remove common from centos builds

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* handle defaults

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* fix package naming?

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* don't have ./

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* try using swap instead

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* path names

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* remove dnf remove

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* missing decleration

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* try allow-erasing instead

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* try reinstalling instead

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* Add testing via multistage build

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* add missing args

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* correct test tag name

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* fix VARS_KERNEL_VERSION now that the package is no longer messed up

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* always have json point to cache location

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* use a reusable cache workflow

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* Names

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* put generate workflow in justfile

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* add startpoint for multiarch

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* change the names

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* dynamic names for generating workflow

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* start appeasing the linter

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* fix kernel version detection

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* try again

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* filter for arch

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* move system76 to common

Appease the linter

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* permissions

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* more permissions

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* move system76 back

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* add arch to tags

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* add push/sign/manifest

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* silly names

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* remove secureboot just recipe, it's internal to fetch-kernel.sh

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* add CI=1 to scripts for debug output

* update warning for workflow within justfile

* remove for now

* Update dual-sign-check.sh

* Update Containerfile.in

* Update dual-sign-check.sh

* Add cosign fix

* Fix signing in push as well

* fix: hardcode internel kcwd for fetch-kernel.sh

* pass CI into fetch kernel, use cache version instead of get version for fetch kernel step

* split out bazzite workflow

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* rename name of reusable build

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* additional adds to manifest

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* allow workflow dispatch for cache/akmods build

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* add comments to Justfile

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* split mega workflow by flavors

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* Build Badges and README

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* appease the linter

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

* tiny AKMODS_VERSION string update

* fix manifest recipe

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>

---------

Signed-off-by: m2 <69128853+m2Giles@users.noreply.github.com>
Co-authored-by: Benjamin Sherman <benjamin@holyarmy.org>
2025-07-07 20:09:34 -04:00

115 lines
3.8 KiB
YAML

name: cache-kernel
run-name: Cache ${{ format('{0}-{1}', inputs.kernel_flavor, inputs.version) }} Kernel
on:
workflow_call:
inputs:
bazzite_tag:
description: "The release tag for the bazzite kernel"
required: false
type: string
kernel_flavor:
description: "The Kernel flavor: main, bazzite, coreos-stable, centos-hsk, longterm-6.12, etc"
required: true
type: string
version:
description: "Release Version: 10, 41, 42, etc"
required: true
type: string
outputs:
KCKEY:
description: Cache Key
value: ${{ jobs.cache-kernel.outputs.KCKEY }}
workflow_dispatch:
inputs:
bazzite_tag:
description: "The release tag for the bazzite kernel"
required: false
type: string
kernel_flavor:
description: "The Kernel flavor: main, bazzite, coreos-stable, centos-hsk, longterm-6.12, etc"
required: true
type: string
version:
description: "Release Version: 10, 41, 42, etc"
required: true
type: string
env:
AKMODS_BAZZITE_TAG: ${{ inputs.bazzite_tag }}
AKMODS_KERNEL: ${{ inputs.kernel_flavor }}
AKMODS_VERSION: ${{ inputs.version }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}-${{ inputs.version }}-${{ inputs.kernel_flavor }}
cancel-in-progress: true
jobs:
cache-kernel:
name: Cache ${{ matrix.platform }}
runs-on: ${{ matrix.platform == 'x86_64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }}
outputs:
KCKEY: ${{ inputs.kernel_flavor }}-${{ steps.kernel-version.outputs.kernel_major_minor_patch }}
container:
image: "ghcr.io/ublue-os/devcontainer:latest"
options: "--privileged --volume /var/lib/containers:/var/lib/containers --security-opt seccomp=unconfined --security-opt label=disable --user 0:0"
permissions:
actions: read
contents: read
packages: write
strategy:
fail-fast: false
matrix:
platform:
- x86_64
# - aarch64
env:
AKMODS_BAZZITE_TAG: ${{ inputs.bazzite_tag }}
AKMODS_KERNEL: ${{ inputs.kernel_flavor }}
AKMODS_VERSION: ${{ inputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Mark Directory as Safe
run: git config --system --ad safe.directory "$GITHUB_WORKSPACE"
- name: Get Kernel Version
id: kernel-version
run: just cache-kernel-version
- name: Cache Kernel RPMs
id: cache-kernel
uses: actions/cache@v4
with:
path: ${{ steps.kernel-version.outputs.KCPATH }}
key: ${{ inputs.kernel_flavor }}-${{ steps.kernel-version.outputs.kernel_major_minor_patch }}-${{ matrix.platform }} # job outputs KCKEY
- name: Retrieve Signing Key
if: contains(fromJSON('["schedule", "workflow_dispatch", "merge_group"]'), github.event_name) && steps.cache-kernel.outputs.cache-hit != 'true'
shell: bash
run: |
mkdir -p certs
echo "${{ secrets.KERNEL_PRIVKEY }}" > certs/private_key.priv
echo "${{ secrets.AKMOD_PRIVKEY_20230518 }}" > certs/private_key_2.priv
# DEBUG: get character count of key
wc -c certs/private_key.priv
wc -c certs/private_key_2.priv
- name: Fetch Kernel
if: steps.cache-kernel.outputs.cache-hit != 'true'
run: just fetch-kernel
- name: List Cached Kernel RPMs
run: find ${{ steps.kernel-version.outputs.KCPATH }}
check:
name: Check all ${{ format('{0}-{1}', inputs.kernel_flavor, inputs.version) }} cache successful
runs-on: ubuntu-latest
needs: [cache-kernel]
permissions:
actions: read
steps:
- name: Exit on failure
if: ${{ needs.cache-kernel.result == 'failure' }}
run: exit 1
- name: Exit
run: exit 0