[PATCH v4 06/13] Support building arbitrary Linux branch/tag/commit
From: Marek Marczykowski-Górecki <hidden>
Date: 2026-05-04 12:46:10
Subsystem:
the rest · Maintainer:
Linus Torvalds
Change how kernel version is given to the script - use arguments, to avoid confusion between pipeline level variables and job level ones. The build-linux.sh now can take either just the kernel version (used to be LINUX_VERSION variable), or git branch/tag/commit name + git URL (new feature). Go with "git init" + "git fetch" instead of "git clone" to support any of branch/tag/commit. This also defines optional linux-git-* jobs which will build the thing if LINUX_GIT_VERSION and LINUX_GIT_URL variables are provided for the pipeline. The idea is to define separate CI schedules for the test-artifacts repo with LINUX_GIT_URL/LINUX_GIT_VERSION pointing at Linux trees to be tested (for example linux-next), and then trigger matching pipelines in the xen repo for testing with that version. Signed-off-by: Marek Marczykowski-Górecki <redacted> --- Changes in v4: - Adjust error message on missing version - Extract kernel version from job name Changes in v3: - pass kernel version via script arguments, not variables --- .gitlab-ci.yml | 29 +++++++++++++++++++++++++---- scripts/build-linux.sh | 23 +++++++++++++++++------ 2 files changed, 42 insertions(+), 10 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4147be5..45006d4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml@@ -1,5 +1,9 @@ variables: REGISTRY: registry.gitlab.com/xen-project/hardware/test-artifacts + LINUX_GIT_VERSION: + description: "branch/tag/commit for the linux-git jobs" + LINUX_GIT_URL: + description: "git url for the linux-git jobs" stages: - build
@@ -30,6 +34,13 @@ stages: variables: CONTAINER: alpine:3.23-x86_64-build +.linux-tpl: + script: &linux-script + - linux_version="${CI_JOB_NAME}" + - linux_version="${linux_version#linux-}" + - linux_version="${linux_version%%-*}" + - ./scripts/build-linux.sh "${linux_version}" + # # ARM64 artifacts #
@@ -49,11 +60,16 @@ alpine-3.23-arm64-rootfs: linux-6.6.86-arm64: extends: .arm64-artifacts - script: ./scripts/build-linux.sh + script: *linux-script variables: - LINUX_VERSION: 6.6.86 CONTAINER: alpine:3.18-arm64-build +linux-git-arm64: + extends: .arm64-artifacts + script: ./scripts/build-linux.sh "$LINUX_GIT_VERSION" "$LINUX_GIT_URL" + rules: + - if: $LINUX_GIT_VERSION && $LINUX_GIT_URL + # # x86_64 artifacts #
@@ -80,13 +96,18 @@ debian-13-x86_64-rootfs: linux-6.6.56-x86_64: extends: .x86_64-artifacts - script: ./scripts/build-linux.sh + script: *linux-script variables: - LINUX_VERSION: 6.6.56 ARGO_SHA: "cf73819cacc945baca1a7421e5836d1bd481739b" ARGOEXEC_SHA: "d900429f6640acc6f68a3d3a4c945d7da60625d8" CONTAINER: alpine:3.18-x86_64-build +linux-git-x86_64: + extends: .x86_64-artifacts + script: ./scripts/build-linux.sh "$LINUX_GIT_VERSION" "$LINUX_GIT_URL" + rules: + - if: $LINUX_GIT_VERSION && $LINUX_GIT_URL + microcode-x86: extends: .x86_64-artifacts script: ./scripts/x86-microcode.sh
diff --git a/scripts/build-linux.sh b/scripts/build-linux.sh
index cf0e744..e01b517 100755
--- a/scripts/build-linux.sh
+++ b/scripts/build-linux.sh@@ -1,8 +1,11 @@ #!/usr/bin/env bash +LINUX_VERSION="$1" +LINUX_GIT_URL="$2" + if test -z "${LINUX_VERSION}" then - >&2 echo "LINUX_VERSION must be set"; exit 1 + >&2 echo "Version argument missing"; exit 1 fi set -ex -o pipefail
@@ -12,11 +15,19 @@ COPYDIR="${WORKDIR}/binaries" UNAME=$(uname -m) # Build Linux -MAJOR=${LINUX_VERSION%%.*} -curl -fsSLO \ - https://cdn.kernel.org/pub/linux/kernel/v"${MAJOR}".x/linux-"${LINUX_VERSION}".tar.xz -tar xf linux-"${LINUX_VERSION}".tar.xz -cd linux-"${LINUX_VERSION}" +if [[ -n "${LINUX_GIT_URL}" ]]; then + mkdir linux + cd linux + git init + git fetch --depth=1 "${LINUX_GIT_URL}" "${LINUX_VERSION}" + git checkout FETCH_HEAD +else + MAJOR=${LINUX_VERSION%%.*} + curl -fsSLO \ + https://cdn.kernel.org/pub/linux/kernel/v"${MAJOR}".x/linux-"${LINUX_VERSION}".tar.xz + tar xf linux-"${LINUX_VERSION}".tar.xz + cd linux-"${LINUX_VERSION}" +fi make defconfig ./scripts/config --enable BRIDGE
--
git-series 0.9.1