Skip to content

Commit ae45ddd

Browse files
committed
Makefile: pull kernel and efW versions from ci.yml
Update scripts to pull version information directly from ci.yml. This means that only a single place needs to be updated now. Putting it in the CI config isn't particularly pretty, but it's the simplest thing to do because GH Actions has terrible support for pulling data from other files. Signed-off-by: Lorenz Bauer <[email protected]>
1 parent ec9b1be commit ae45ddd

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
env:
99
TMPDIR: /tmp
1010
CI_MAX_KERNEL_VERSION: '6.16'
11-
CI_MAX_EFW_VERSION: '0.21.0'
11+
CI_MAX_EFW_VERSION: '1.0.0-rc1'
1212
CI_MIN_CLANG_VERSION: '13'
1313
go_version: '~1.25'
1414
prev_go_version: '~1.24'

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ testdata/loader-%-eb.elf: testdata/loader.c
120120
$(STRIP) -g $@
121121

122122
.PHONY: update-external-deps
123-
update-external-deps: export KERNEL_VERSION=6.16.0
124-
update-external-deps: export EFW_VERSION=v1.0.0-rc1
125123
update-external-deps:
126124
./scripts/update-kernel-deps.sh
127125
./scripts/update-efw-deps.sh

scripts/update-efw-deps.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
set -euo pipefail
44

5+
# Extract EFW version from CI workflow file
6+
efw_version=$(awk -F': ' '/CI_MAX_EFW_VERSION:/ {gsub(/['\''"]/, "", $2); print $2}' .github/workflows/ci.yml)
7+
8+
if [ -z "$efw_version" ]; then
9+
echo "Error: Could not extract CI_MAX_EFW_VERSION from .github/workflows/ci.yml" >&2
10+
exit 1
11+
fi
12+
13+
echo "Using EFW version: $efw_version"
14+
515
tmp=$(mktemp -d)
616

717
cleanup() {
@@ -11,5 +21,5 @@ cleanup() {
1121
trap cleanup EXIT
1222

1323
# Download and process ebpf_structs.h
14-
curl -fL "https://github.com/microsoft/ebpf-for-windows/raw/refs/tags/${EFW_VERSION}/include/ebpf_structs.h" -o "$tmp/ebpf_structs.h"
24+
curl -fL "https://github.com/microsoft/ebpf-for-windows/raw/refs/tags/Release-v${efw_version}/include/ebpf_structs.h" -o "$tmp/ebpf_structs.h"
1525
"./internal/cmd/genwinfunctions.awk" "$tmp/ebpf_structs.h" | gofmt > "./asm/func_win.go"

scripts/update-kernel-deps.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
set -euo pipefail
44

5+
# Extract kernel version from CI workflow file
6+
kernel_version=$(awk -F': ' '/CI_MAX_KERNEL_VERSION:/ {gsub(/['\''"]/, "", $2); print $2}' .github/workflows/ci.yml)
7+
8+
if [ -z "$kernel_version" ]; then
9+
echo "Error: Could not extract CI_MAX_KERNEL_VERSION from .github/workflows/ci.yml" >&2
10+
exit 1
11+
fi
12+
13+
echo "Using kernel version: $kernel_version"
14+
515
tmp=$(mktemp -d)
616

717
cleanup() {
@@ -12,15 +22,15 @@ trap cleanup EXIT
1222

1323
# Download and process libbpf.c
1424
# Truncate .0 patch versions (e.g., 6.16.0 -> 6.16, but leave 7.0 as 7.0)
15-
kernel_version_for_url="$KERNEL_VERSION"
16-
if [[ $KERNEL_VERSION =~ ^([0-9]+\.[0-9]+)\.0$ ]]; then
25+
kernel_version_for_url="$kernel_version"
26+
if [[ $kernel_version =~ ^([0-9]+\.[0-9]+)\.0$ ]]; then
1727
kernel_version_for_url="${BASH_REMATCH[1]}"
1828
fi
1929
curl -fL "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/plain/tools/lib/bpf/libbpf.c?h=v$kernel_version_for_url" -o "$tmp/libbpf.c"
2030
"./internal/cmd/gensections.awk" "$tmp/libbpf.c" | gofmt > "./elf_sections.go"
2131

2232
# Download and process vmlinux and btf_testmod
23-
go tool crane export "ghcr.io/cilium/ci-kernels:$KERNEL_VERSION" | tar -x -C "$tmp"
33+
go tool crane export "ghcr.io/cilium/ci-kernels:$kernel_version" | tar -x -C "$tmp"
2434

2535
extract-vmlinux "$tmp/boot/vmlinuz" > "$tmp/vmlinux"
2636

0 commit comments

Comments
 (0)