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 <marmarek@invisiblethingslab.com>
---
Changes in v3:
- pass kernel version via script arguments, not variables
---
.gitlab-ci.yml | 23 ++++++++++++++++++-----
scripts/build-linux.sh | 21 ++++++++++++++++-----
2 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 58f7571f5366..62b2a24e7faf 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
@@ -49,9 +53,13 @@ alpine-3.22-arm64-rootfs:
linux-6.6.86-arm64:
extends: .arm64-artifacts
- script: ./scripts/build-linux.sh
- variables:
- LINUX_VERSION: 6.6.86
+ script: ./scripts/build-linux.sh "6.6.86"
+
+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
@@ -79,9 +87,8 @@ debian-13-x86_64-rootfs:
linux-6.6.56-x86_64:
extends: .x86_64-artifacts
- script: ./scripts/build-linux.sh
+ script: ./scripts/build-linux.sh "6.6.56"
variables:
- LINUX_VERSION: 6.6.56
ARGO_SHA: "cf73819cacc945baca1a7421e5836d1bd481739b"
ARGOEXEC_SHA: "d900429f6640acc6f68a3d3a4c945d7da60625d8"
@@ -89,6 +96,12 @@ linux-6.12.60-x86_64:
extends: .x86_64-artifacts
script: ./scripts/build-linux.sh "6.12.60"
+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 cf0e744bd232..882bac2189a6 100755
--- a/scripts/build-linux.sh
+++ b/scripts/build-linux.sh
@@ -1,5 +1,8 @@
#!/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
@@ -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