Skip to content

Commit 22ba68b

Browse files
authored
gha / build.sh: switch to ghcr.io for OCI artifacts + better CI self-hosted/GH-hosted runner usage + required fixes (#306)
#### gha / build.sh: switch to ghcr.io for OCI artifacts - 🍀 gha: build-all-matrix: eat trailing whitespace - no changes - 🌳 gha / build.sh: switch to ghcr.io for OCI artifacts - Hook Linuxkit containers: - `ghcr.io/tinkerbell/hook/linuxkit/hook-bootkit:d06cdd1d-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-docker:6c15b5fd-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-udev:20b3dbd4-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-acpid:b535e04e-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-containerd:b4fb2d41-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-runc:d278063c-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-embedded:e1820943-arm64` - Linuxkit mirror images: - `ghcr.io/tinkerbell/hook/linuxkit/hook-linuxkit-rngd:c3b9a5b1-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-linuxkit-getty:c09b5e45-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-linuxkit-sysctl:852d65cc-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-linuxkit-modprobe:891b0d0e-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-linuxkit-openntpd:f9f38cc1-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-linuxkit-init:6decbe88-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-linuxkit-dhcpcd:08150d1f-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-linuxkit-sshd:8c605071-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-linuxkit-ca_certificates:75b188ff-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-linuxkit-sysfs:2b7cfc05-arm64` - `ghcr.io/tinkerbell/hook/linuxkit/hook-linuxkit-firmware:6ffe7264-arm64` - Kernels - `ghcr.io/tinkerbell/hook/kernel/hook-kernel:5.10.247-03b1a1ff` (arm64) - `ghcr.io/tinkerbell/hook/kernel/hook-kernel:5.10.247-ec172109` (amd64) - `ghcr.io/tinkerbell/hook/kernel/hook-kernel:6.6.119-2f8a324d` (arm64) - `ghcr.io/tinkerbell/hook/kernel/hook-kernel:6.6.119-14c9b75d` (amd64) - `ghcr.io/tinkerbell/hook/kernel/hook-kernel-armbian:6.19-c0e83ecc-rockchip64-edge` (arm64) - `ghcr.io/tinkerbell/hook/kernel/hook-kernel-armbian:6.19-fe11ee11-uefi-x86-edge` (amd64) - .... - 🌱 containerd/runc: alpine 3.22 updated default go to 1.24.11-r0, remove pin to fix build - 🌵 gha: json-matrix: consider all 'ubuntu-*' as GH-hosted runners - 🍃 gha: json-matrix: use GitHub's arm64 runners for arm64 builds by default - See https://github.blog/changelog/2025-01-16-linux-arm64-hosted-runners-now-available-for-free-in-public-repositories-public-preview/ - 🌿 gha: runs-on should be compatible with GH-hosted runners - "group" isn't - 🌴 inventory: add `TYPE` info for each kernel (`source` for built-from-source, `external` for pulled-from-elsewhere) - different types build-best on different hardware - `external` ones benefit from GH-hosted runners, as they mostly do pulls from ghcr.io - `source` ones benefit from beefy, multiple-core runners as they crunch a lot of C code - 🐸 gha: json-matrix: allow specific runners per kernel type (source/external) - will look-up runners to use in vars like `CI_RUNNER_KERNEL_SOURCE_AMD64` and `CI_RUNNER_KERNEL_EXTERNAL_AMD64` - in _addition_ to what was already used before - 🍀 gha: build-all-matrix: use CNCF runners only for kernels built from source - `external` ones are a waste, since they only pull stuff and require no real horsepower - same for LK containers and Hooks themselves; mostly small stuff that can easily run GH-hosted - 🌳 gha: build-all-matrix: use smaller / readily available / existing CNCF runners for kernel-from-source builds - See https://github.com/cncf/automation/blob/main/ci/README.md - 🌱 gha: build-all-matrix: include runner in job names; enable debug for gha-matrix - that way it's easy to see where each job runs - and to debug any misspellings in env vars etc - 🌵 gha: json-matrix: allow `CI_RUNNERS_SELF_HOSTED_TAG` for non-GH-hosted runners - CNCF runners don't have the semi-standard `"self-hosted"` tag - setting it to `none` is needed to skip it, otherwise CNCF hosted-jobs are pending forever - also allows setting it to something else, if ever needed - 🍃 gha: build-all-matrix: use `CI_RUNNERS_SELF_HOSTED_TAG=none` - CNCF runners don't have the semi-standard `"self-hosted"` tag - so this is needed to skip it, otherwise CNCF hosted-jobs are pending forever - 🌿 bash: common: add timeouts for (host) apt operations - sometimes GHA runners are a bit inconvenienced by network issues, and hang forever on this - let `apt update` fail, `apt install ..` not
2 parents da3e653 + 2db542d commit 22ba68b

7 files changed

Lines changed: 86 additions & 54 deletions

File tree

.github/workflows/build-all-matrix.yaml

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,34 @@ on:
88
push:
99

1010
env: # Global environment, passed to all jobs & all steps
11-
# Default to quay.io, which is also the default for the CLI.
12-
# Allow to use ghcr.io as an alternative, change & uncomment below:
13-
REGISTRY: "quay.io" # or ghcr.io, determines which will be logged-in to
14-
#HOOK_KERNEL_OCI_BASE: "ghcr.io/${{ github.repository_owner }}/tinkerbell/kernel-"
15-
#HOOK_LK_CONTAINERS_OCI_BASE: "ghcr.io/${{ github.repository_owner }}/tinkerbell/linuxkit-"
16-
11+
# Default to ghcr.io. quay.io was used previously, but requires manual creation for new images.
12+
REGISTRY: "ghcr.io" # or quay.io, determines which will be logged-in to; quay requires secrets.
13+
HOOK_KERNEL_OCI_BASE: "ghcr.io/${{ github.repository_owner }}/hook/kernel/hook-kernel"
14+
HOOK_LK_CONTAINERS_OCI_BASE: "ghcr.io/${{ github.repository_owner }}/hook/linuxkit/"
15+
1716
# Apart from the quay/ghcr coordinates above (used for both pulling & pushing), we might also want to
1817
# log in to DockerHub (with a read-only token) so we aren't hit by rate limits when pulling the linuxkit pkgs.
1918
# To do so, set the secret DOCKERHUB_USERNAME and DOCKERHUB_PASSWORD in the repo secrets, and set the below to yes.
2019
LOGIN_TO_DOCKERHUB: "yes"
21-
20+
2221
HOOK_VERSION: "0.11.1-build-${{github.run_number}}" # Use a forced Hook version
23-
22+
2423
# Which flavors to build? space separated list, must match one of the TAG='s in flavors (this is used by matrix_prep job in gha-matrix command)
2524
CI_TAGS: "standard armbian-sbc armbian-uefi lts" # 'dev' is not included
26-
27-
# GHA runner configuration. See bash/json-matrix.sh for more details.
28-
CI_RUNNER_LK_CONTAINERS_ARM64: "oracle-vm-32cpu-128gb-arm64" # Use a self-hosted runner with the "ARM64" tag for the ARM64 builds of LK containers
29-
CI_RUNNER_LK_CONTAINERS_AMD64: "oracle-vm-32cpu-128gb-x86-64" # Use a self-hosted runner with the "X86" tag for the AMD64 builds of LK containers
30-
CI_RUNNER_LK_ARM64: "oracle-vm-32cpu-128gb-arm64" # Use a self-hosted runner with the "ARM64" tag for the ARM64 linuxkit builds
31-
CI_RUNNER_LK_AMD64: "oracle-vm-32cpu-128gb-x86-64" # Use a self-hosted runner with the "X86" tag for the AMD64 linuxkit builds
32-
CI_RUNNER_KERNEL_AMD64: "oracle-24cpu-384gb-x86-64" # Use a self-hosted runner with the "X86" tag for the AMD64 kernel builds
33-
CI_RUNNER_KERNEL_ARM64: "oracle-24cpu-384gb-arm64" # Use a self-hosted runner with the "ARM64" tag for the ARM64 kernel builds
3425

26+
# GHA runner configuration. See bash/json-matrix.sh for more details.
27+
CI_RUNNERS_SELF_HOSTED_TAG: "none" # CNCF runners don't have the semi-standard 'self-hosted' tag
28+
CI_RUNNER_LK_CONTAINERS_ARM64: "ubuntu-24.04-arm" # lk containers are small and relatively quick to build
29+
CI_RUNNER_LK_CONTAINERS_AMD64: "ubuntu-latest" # lk containers are small and relatively quick to build
30+
CI_RUNNER_LK_ARM64: "ubuntu-24.04-arm" # Hook itself (linuxkit etc.) is small and relatively quick to build once we've the lk containers & kernel ready
31+
CI_RUNNER_LK_AMD64: "ubuntu-latest" # Hook itself (linuxkit etc.) is small and relatively quick to build once we've the lk containers & kernel ready
32+
CI_RUNNER_KERNEL_SOURCE_AMD64: "oracle-16cpu-64gb-x86-64" # Kernels that are built _from source_ benefit from beefy self-hosted CNCF runners
33+
CI_RUNNER_KERNEL_SOURCE_ARM64: "oracle-16cpu-64gb-arm64" # Kernels that are built _from source_ benefit from beefy self-hosted CNCF runners
34+
CI_RUNNER_KERNEL_EXTERNAL_AMD64: "ubuntu-latest" # kernels that pull binaries from elsewhere (eg Armbian) can be built on normal runners (CNCF runners are actually worse at this)
35+
CI_RUNNER_KERNEL_EXTERNAL_ARM64: "ubuntu-24.04-arm" # kernels that pull binaries from elsewhere (eg Armbian) can be built on normal runners (CNCF runners are actually worse at this)
3536

3637
jobs:
37-
38+
3839
matrix_prep:
3940
name: "Prepare matrix JSON"
4041
runs-on: ubuntu-latest
@@ -56,18 +57,16 @@ jobs:
5657

5758
- name: Run the matrix JSON preparation bash script
5859
id: prepare-matrix
59-
run: bash build.sh gha-matrix # This sets the output "kernels_json" & "lkcontainers_json" & "lk_hooks_json" internally
60-
60+
run: bash build.sh gha-matrix DEBUG=yes # This sets the output "kernels_json" & "lkcontainers_json" & "lk_hooks_json" internally
61+
6162
build-linuxkit-containers:
6263
needs: [ matrix_prep ]
63-
runs-on:
64-
group: Default
65-
labels: "${{ matrix.runner }}" # the runner to use is determined by the 'gha-matrix' code
64+
runs-on: "${{ matrix.runner }}" # "groups" are only for self-hosted setups! TODO: group should be determined by matrix code # the runner to use is determined by the 'gha-matrix' code
6665
strategy:
6766
fail-fast: true
6867
matrix:
6968
include: ${{ fromJSON(needs.matrix_prep.outputs.lkcontainers_json) }}
70-
name: "LinuxKit containers for ${{ matrix.docker_arch }}"
69+
name: "LinuxKit containers for ${{ matrix.docker_arch }} (on ${{ join(matrix.runner) }})"
7170
steps:
7271
- name: Checkout build repo
7372
uses: actions/checkout@v6
@@ -109,14 +108,12 @@ jobs:
109108

110109
build-kernels:
111110
needs: [ matrix_prep ] # depend on the previous job...
112-
runs-on:
113-
group: Default
114-
labels: "${{ matrix.runner }}" # the runner to use is determined by the 'gha-matrix' code
111+
runs-on: "${{ matrix.runner }}" # "groups" are only for self-hosted setups! TODO: group should be determined by matrix code # # the runner to use is determined by the 'gha-matrix' code
115112
strategy:
116113
fail-fast: false # let other jobs try to complete if one fails, kernels might take long, and they'd be skipped on the next run
117114
matrix:
118115
include: ${{ fromJSON(needs.matrix_prep.outputs.kernels_json) }}
119-
name: "Kernel ${{ matrix.kernel }}"
116+
name: "Kernel ${{ matrix.kernel }} (on ${{ join(matrix.runner) }})"
120117
steps:
121118
- name: Checkout build repo
122119
uses: actions/checkout@v6
@@ -154,14 +151,12 @@ jobs:
154151

155152
build-hook-ensemble:
156153
needs: [ matrix_prep, build-linuxkit-containers, build-kernels ] # depend on the previous job...
157-
runs-on:
158-
group: Default
159-
labels: "${{ matrix.runner }}" # the runner to use is determined by the 'gha-matrix' code
154+
runs-on: "${{ matrix.runner }}" # "groups" are only for self-hosted setups! TODO: group should be determined by matrix code # # the runner to use is determined by the 'gha-matrix' code
160155
strategy:
161156
fail-fast: false # let other jobs try to complete if one fails
162157
matrix:
163158
include: ${{ fromJSON(needs.matrix_prep.outputs.lk_hooks_json) }}
164-
name: "Hook ${{ matrix.kernel }}"
159+
name: "Hook ${{ matrix.kernel }} (on ${{ join(matrix.runner) }})"
165160
steps:
166161
- name: Checkout build repo
167162
uses: actions/checkout@v6
@@ -384,4 +379,4 @@ jobs:
384379
*.iso
385380
checksum.txt
386381
prerelease: true
387-
tag_name: ${{github.ref}}
382+
tag_name: ${{github.ref}}

bash/common.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ function install_dependencies() {
100100
# If running on Debian or Ubuntu...
101101
if [[ -f /etc/debian_version ]]; then
102102
log info "Installing apt dependencies: ${debian_pkgs[*]}"
103-
sudo DEBIAN_FRONTEND=noninteractive apt -o "Dpkg::Use-Pty=0" -y update
104-
sudo DEBIAN_FRONTEND=noninteractive apt -o "Dpkg::Use-Pty=0" -y install "${debian_pkgs[@]}"
103+
timeout --verbose 5m sudo DEBIAN_FRONTEND=noninteractive apt -o "Dpkg::Use-Pty=0" -y update || true # sometimes apt update hangs forever; timeout after 5 minutes; don't fail
104+
timeout --verbose 10m sudo DEBIAN_FRONTEND=noninteractive apt -o "Dpkg::Use-Pty=0" -y install "${debian_pkgs[@]}" # sometimes apt install hangs forever; timeout after 10 minutes; fail if this fails
105105
elif [[ "$(uname)" == "Darwin" ]]; then
106106
log info "Skipping Debian deps installation for Darwin..."
107107
else

bash/inventory.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@ function produce_default_kernel_inventory() {
2626
##### METHOD=default; Hook's own kernel, in kernel/ directory
2727
## Hook default kernel, source code stored in `kernel` dir in this repo -- currently 5.10.y
2828
define_id "hook-default-amd64" METHOD='default' ARCH='x86_64' TAG='standard' SUPPORTS_ISO='yes' \
29-
KERNEL_MAJOR='5' KERNEL_MINOR='10' KCONFIG='generic'
29+
KERNEL_MAJOR='5' KERNEL_MINOR='10' KCONFIG='generic' TYPE='source'
3030
add_bootable_id "grub-amd64" HANDLER='grub' SERIAL_CONSOLE='ttyS0' TAG='standard'
3131

3232
define_id "hook-default-arm64" METHOD='default' ARCH='aarch64' TAG='standard' SUPPORTS_ISO='yes' \
33-
KERNEL_MAJOR='5' KERNEL_MINOR='10' KCONFIG='generic'
33+
KERNEL_MAJOR='5' KERNEL_MINOR='10' KCONFIG='generic' TYPE='source'
3434
add_bootable_id "grub-arm64" HANDLER='grub' SERIAL_CONSOLE='ttyAMA0' TAG='standard'
3535

3636
## A 'peg' is not really a 'hook': for development purposes; testing new LK version and simpler LK configurations, using the default kernel
3737
define_id "peg-default-amd64" METHOD='default' ARCH='x86_64' TAG='dev' \
3838
USE_KERNEL_ID='hook-default-amd64' TEMPLATE='peg' \
39-
KERNEL_MAJOR='5' KERNEL_MINOR='10' KCONFIG='generic'
39+
KERNEL_MAJOR='5' KERNEL_MINOR='10' KCONFIG='generic' TYPE='source'
4040

4141
## development purposes: trying out kernel 6.6.y
4242
define_id "hook-latest-lts-amd64" METHOD='default' ARCH='x86_64' TAG='lts' SUPPORTS_ISO='yes' \
43-
KERNEL_MAJOR='6' KERNEL_MINOR='6' KCONFIG='generic' FORCE_OUTPUT_ID='latest-lts'
43+
KERNEL_MAJOR='6' KERNEL_MINOR='6' KCONFIG='generic' FORCE_OUTPUT_ID='latest-lts' TYPE='source'
4444
add_bootable_id "grub-latest-lts-amd64" SERIAL_CONSOLE='ttyS0' HANDLER='grub' TAG='lts'
4545

4646
define_id "hook-latest-lts-arm64" METHOD='default' ARCH='aarch64' TAG='lts' SUPPORTS_ISO='yes' \
47-
KERNEL_MAJOR='6' KERNEL_MINOR='6' KCONFIG='generic' FORCE_OUTPUT_ID='latest-lts'
47+
KERNEL_MAJOR='6' KERNEL_MINOR='6' KCONFIG='generic' FORCE_OUTPUT_ID='latest-lts' TYPE='source'
4848
add_bootable_id "grub-latest-lts-arm64" SERIAL_CONSOLE='ttyAMA0' HANDLER='grub' TAG='lts'
4949
}
5050

@@ -58,28 +58,28 @@ function produce_default_kernel_inventory() {
5858
function produce_armbian_kernel_inventory() {
5959
### SBC-oriented:
6060
## Armbian meson64 (Amlogic) edge Khadas VIM3/3L, Radxa Zero/2, LibreComputer Potatos, and many more
61-
define_id "armbian-meson64-edge" METHOD='armbian' ARCH='aarch64' TAG='armbian-sbc' ARMBIAN_KERNEL_ARTIFACT='kernel-meson64-edge'
61+
define_id "armbian-meson64-edge" METHOD='armbian' ARCH='aarch64' TAG='armbian-sbc' ARMBIAN_KERNEL_ARTIFACT='kernel-meson64-edge' TYPE='external'
6262
add_bootable_id "uboot-aml" HANDLER='armbian_uboot_amlogic' TAG='armbian-sbc' UBOOT_TYPE='extlinux' CONSOLE_EXTRA_ARGS=',115200' # all meson64, mainline kernel and u-boot, uses extlinux to boot
6363

6464
## Armbian bcm2711 (Broadcom) current, from RaspberryPi Foundation with many CNCF-landscape fixes and patches; for the RaspberryPi 3b+/4b/5
65-
define_id "armbian-bcm2711-current" METHOD='armbian' ARCH='aarch64' TAG='armbian-sbc' ARMBIAN_KERNEL_ARTIFACT='kernel-bcm2711-current'
65+
define_id "armbian-bcm2711-current" METHOD='armbian' ARCH='aarch64' TAG='armbian-sbc' ARMBIAN_KERNEL_ARTIFACT='kernel-bcm2711-current' TYPE='external'
6666
add_bootable_id "rpi" HANDLER='rpi_firmware' TAG='armbian-sbc'
6767

6868
## Armbian rockchip64 (Rockchip) edge, for many rk356x/3399 SoCs. As of late December 2024, also for rk3588.
69-
define_id "armbian-rockchip64-edge" METHOD='armbian' ARCH='aarch64' TAG='armbian-sbc' ARMBIAN_KERNEL_ARTIFACT='kernel-rockchip64-edge'
69+
define_id "armbian-rockchip64-edge" METHOD='armbian' ARCH='aarch64' TAG='armbian-sbc' ARMBIAN_KERNEL_ARTIFACT='kernel-rockchip64-edge' TYPE='external'
7070
add_bootable_id "uboot-rk" HANDLER='armbian_uboot_rockchip' TAG='armbian-sbc' UBOOT_TYPE='extlinux' CONSOLE_EXTRA_ARGS=',1500000' # rk3588, mainline u-boot, uses extlinux to boot
7171

7272
## Armbian rk35xx (Rockchip) vendor, for rk3566, rk3568, rk3588, rk3588s SoCs -- 6.1-rkr4.1 - BSP / vendor kernel, roughly equivalent to Android's 6.1.84
7373
# Use with edk2 (v0.9.1+) or mainline u-boot + EFI: matches the DT included in https://github.com/edk2-porting/edk2-rk3588 _after_ v0.9.1
74-
define_id "armbian-rk35xx-vendor" METHOD='armbian' ARCH='aarch64' TAG='armbian-sbc' ARMBIAN_KERNEL_ARTIFACT='kernel-rk35xx-vendor'
74+
define_id "armbian-rk35xx-vendor" METHOD='armbian' ARCH='aarch64' TAG='armbian-sbc' ARMBIAN_KERNEL_ARTIFACT='kernel-rk35xx-vendor' TYPE='external'
7575
add_bootable_id "uboot-rk35xx-vendor" HANDLER='armbian_uboot_rockchip_vendor' TAG='armbian-sbc' CONSOLE_EXTRA_ARGS=',1500000'
7676

7777
### Armbian mainline Generic UEFI kernels, for EFI capable machines might use those:
7878
## Armbian generic edge UEFI kernel for arm64
79-
define_id "armbian-uefi-arm64-edge" METHOD='armbian' ARCH='aarch64' TAG='standard armbian-uefi' ARMBIAN_KERNEL_ARTIFACT='kernel-arm64-edge'
79+
define_id "armbian-uefi-arm64-edge" METHOD='armbian' ARCH='aarch64' TAG='standard armbian-uefi' ARMBIAN_KERNEL_ARTIFACT='kernel-arm64-edge' TYPE='external'
8080
add_bootable_id "grub-armbian-uefi-arm64" HANDLER='grub' SERIAL_CONSOLE='ttyAMA0' DTB='yes' TAG='standard'
8181

8282
## Armbian generic edge UEFI kernel (Armbian calls it x86)
83-
define_id "armbian-uefi-x86-edge" METHOD='armbian' ARCH='x86_64' TAG='standard armbian-uefi' ARMBIAN_KERNEL_ARTIFACT='kernel-x86-edge'
83+
define_id "armbian-uefi-x86-edge" METHOD='armbian' ARCH='x86_64' TAG='standard armbian-uefi' ARMBIAN_KERNEL_ARTIFACT='kernel-x86-edge' TYPE='external'
8484
add_bootable_id "grub-armbian-uefi-amd64" HANDLER='grub' SERIAL_CONSOLE='ttyS0' TAG='standard'
8585
}

bash/json-matrix.sh

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212

1313
# GH Runner selection, using environment variables (in order of specificity, for AMD64, same applies to ARM64 variant):
1414
## Kernels: (1)
15+
# - CI_RUNNER_KERNEL_SOURCE_AMD64 is the runner to use for amd64 kernel builds for kernels built from source
16+
# - CI_RUNNER_KERNEL_EXTERNAL_AMD64 is the runner to use for amd64 kernel builds for kernels obtained externally
1517
# - CI_RUNNER_KERNEL_AMD64 is the runner to use for amd64 kernel builds
18+
# - CI_RUNNER_KERNEL_SOURCE is the runner to use for kernels built from source
19+
# - CI_RUNNER_KERNEL_EXTERNAL is the runner to use for kernels obtained externally
1620
# - CI_RUNNER_KERNEL is the runner to use for all kernels
1721
# - CI_RUNNER_AMD64 is the runner to use for all AMD64 things
1822
# - CI_RUNNER is the runner to use for everything
@@ -78,16 +82,24 @@ function prepare_json_matrix() {
7882
declare -A kernel_info
7983
get_kernel_info_dict "${kernel}"
8084

81-
if [[ "${matrix_type}" == "KERNEL" ]]; then # special case for kernel builds, if USE_KERNEL_ID is set, skip this kernel
82-
if [[ -n "${kernel_info[USE_KERNEL_ID]}" ]]; then
85+
declare -a find_runner_params=("${matrix_type}" "${kernel_info[DOCKER_ARCH]}")
86+
87+
if [[ "${matrix_type}" == "KERNEL" ]]; then # special case for kernel builds
88+
# if TYPE is set, add it as extra param to find_runner
89+
if [[ -n "${kernel_info[TYPE]}" ]]; then
90+
log debug "Adding TYPE='${kernel_info[TYPE]}' to runner search for kernel '${kernel}'"
91+
find_runner_params+=("${kernel_info[TYPE]}")
92+
fi
93+
94+
if [[ -n "${kernel_info[USE_KERNEL_ID]}" ]]; then # if USE_KERNEL_ID is set, skip this kernel
8395
log info "Skipping build of kernel '${kernel}' due to it having USE_KERNEL_ID set to '${kernel_info[USE_KERNEL_ID]}'"
8496
continue
8597
fi
8698
fi
8799

88100
if json_matrix_tag_match "${kernel_info[TAG]}"; then
89101
declare runner="unknown-runner"
90-
runner="$(json_matrix_find_runner "${matrix_type}" "${kernel_info[DOCKER_ARCH]}")"
102+
runner="$(json_matrix_find_runner "${find_runner_params[@]}")"
91103
declare gha_cache="yes" # always use GH cache; hitting DockerHub for linuxkit images is prone to rate limiting
92104

93105
all_arches["${kernel_info[DOCKER_ARCH]}"]=1
@@ -193,9 +205,24 @@ function json_matrix_tag_match() {
193205
function json_matrix_find_runner() {
194206
declare matrix_type="${1}"
195207
declare docker_arch="${2}"
208+
declare matrix_extra="${3:-""}"
196209
declare runner="ubuntu-latest"
197-
#log debug "Finding runner for matrix type '${matrix_type}' and docker arch '${docker_arch}'"
198-
declare -a vars_to_try=("CI_RUNNER_${matrix_type^^}_${docker_arch^^}" "CI_RUNNER_${matrix_type^^}" "CI_RUNNER_${docker_arch^^}" "CI_RUNNER")
210+
if [[ "${docker_arch}" == "arm64" ]]; then
211+
runner="ubuntu-24.04-arm"
212+
fi
213+
log debug "Finding runner for matrix type '${matrix_type}' and docker arch '${docker_arch}'"
214+
declare -a vars_to_try=(
215+
"CI_RUNNER_${matrix_type^^}_${docker_arch^^}" "CI_RUNNER_${matrix_type^^}"
216+
"CI_RUNNER_${docker_arch^^}" "CI_RUNNER"
217+
)
218+
if [[ -n "${matrix_extra}" ]]; then
219+
log debug "Including matrix extra '${matrix_extra}' in runner search"
220+
vars_to_try=(
221+
"CI_RUNNER_${matrix_type^^}_${matrix_extra^^}_${docker_arch^^}" "CI_RUNNER_${matrix_type^^}_${matrix_extra^^}"
222+
"CI_RUNNER_${matrix_type^^}_${docker_arch^^}" "CI_RUNNER_${matrix_type^^}"
223+
"CI_RUNNER_${docker_arch^^}" "CI_RUNNER"
224+
)
225+
fi
199226
for var in "${vars_to_try[@]}"; do
200227
log debug "Checking var '${var}'"
201228
if [[ -n "${!var}" && "${!var}" != "" ]]; then # if var is set, and not empty...
@@ -210,6 +237,16 @@ function json_matrix_find_runner() {
210237
declare -a json_items_bare=(${runner})
211238
# wrap each json_items array item in double quotes
212239
declare -a json_items=()
240+
if [[ "${runner}" == "ubuntu-"* ]]; then # if not using a GH-hosted runner, auto-add the "self-hosted" member
241+
:
242+
else
243+
if [[ "${CI_RUNNERS_SELF_HOSTED_TAG:-"self-hosted"}" != "none" ]]; then
244+
log debug "Adding 'self-hosted' tag to runner '${runner}'"
245+
json_items+=("\"${CI_RUNNERS_SELF_HOSTED_TAG:-"self-hosted"}\"")
246+
else
247+
log debug "Not adding 'self-hosted' tag to runner '${runner}' due to CI_RUNNERS_SELF_HOSTED_TAG being set to 'none'"
248+
fi
249+
fi
213250
for item in "${json_items_bare[@]}"; do
214251
json_items+=("\"${item}\"")
215252
done

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ if [[ "${DEBUG}" == "yes" ]]; then
3434
fi
3535

3636
### Configuration
37-
declare -g HOOK_KERNEL_OCI_BASE="${HOOK_KERNEL_OCI_BASE:-"quay.io/tinkerbell/hook-kernel"}"
38-
declare -g HOOK_LK_CONTAINERS_OCI_BASE="${HOOK_LK_CONTAINERS_OCI_BASE:-"quay.io/tinkerbell/"}"
37+
declare -g HOOK_KERNEL_OCI_BASE="${HOOK_KERNEL_OCI_BASE:-"ghcr.io/tinkerbell/hook/kernel/hook-kernel"}"
38+
declare -g HOOK_LK_CONTAINERS_OCI_BASE="${HOOK_LK_CONTAINERS_OCI_BASE:-"ghcr.io/tinkerbell/hook/linuxkit/"}"
3939

4040
declare -g SKOPEO_IMAGE="${SKOPEO_IMAGE:-"quay.io/skopeo/stable:v1.17.0"}" # See https://quay.io/repository/skopeo/stable?tab=tags&tag=latest
4141

images/hook-containerd/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ENV CONTAINERD_REPO=https://github.com/containerd/containerd.git
1010
ENV CONTAINERD_COMMIT=v2.1.3
1111
ENV NERDCTL_VERSION=2.1.2
1212
ENV GOPATH=/go
13-
RUN apk add go=1.24.6-r0 git
13+
RUN apk add go git
1414
RUN mkdir -p $GOPATH/src/github.com/containerd && \
1515
cd $GOPATH/src/github.com/containerd && \
1616
git clone https://github.com/containerd/containerd.git && \

images/hook-runc/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ RUN \
55
bash \
66
gcc \
77
git \
8-
go=1.24.4-r0 \
8+
go \
99
libc-dev \
1010
libseccomp-dev \
1111
libseccomp-static \

0 commit comments

Comments
 (0)