All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: xen-devel@lists.xenproject.org,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH v2 07/12] Support building arbitrary Linux branch/tag/commit
Date: Wed, 10 Dec 2025 03:03:04 +0100	[thread overview]
Message-ID: <aTjU2GJFw9WcaR9X@mail-itl> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2512091625190.19429@ubuntu-linux-20-04-desktop>

[-- Attachment #1: Type: text/plain, Size: 4820 bytes --]

On Tue, Dec 09, 2025 at 04:29:02PM -0800, Stefano Stabellini wrote:
> On Thu, 4 Dec 2025, Marek Marczykowski-Górecki wrote:
> > If LINUX_URL is set, fetch LINUX_VERSION from there. 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.
> > 
> > Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> > ---
> > The script variable and job variable need to have different names, so a
> > pipeline variable won't override it for all jobs. While LINUX_VERSION /
> > LINUX_GIT_VERSION is IMO okay, I'm not very happy about LINUX_URL /
> > LINUX_GIT_URL. Any better ideas?
> 
> The problem is not LINUX_GIT_URL and LINUX_GIT_VERSION, those are good
> names. The issue is ...
> 
> > ---
> >  .gitlab-ci.yml         | 22 ++++++++++++++++++++++
> >  scripts/build-linux.sh | 18 +++++++++++++-----
> >  2 files changed, 35 insertions(+), 5 deletions(-)
> > 
> > diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> > index 184d0b3..8d1deee 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
> > @@ -53,6 +57,15 @@ linux-6.6.86-arm64:
> >    variables:
> >      LINUX_VERSION: 6.6.86
> >  
> > +linux-git-arm64:
> > +  extends: .arm64-artifacts
> > +  script: ./scripts/build-linux.sh
> > +  variables:
> > +    LINUX_VERSION: $LINUX_GIT_VERSION
> > +    LINUX_URL: $LINUX_GIT_URL
> > +  rules:
> > +  - if: $LINUX_GIT_VERSION && $LINUX_GIT_URL
> > +
> >  #
> >  # x86_64 artifacts
> >  #
> > @@ -91,6 +104,15 @@ linux-6.12.60-x86_64:
> >    variables:
> >      LINUX_VERSION: 6.12.60
> >  
> > +linux-git-x86_64:
> > +  extends: .x86_64-artifacts
> > +  script: ./scripts/build-linux.sh
> > +  variables:
> > +    LINUX_VERSION: $LINUX_GIT_VERSION
> > +    LINUX_URL: $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..1fc96d1 100755
> > --- a/scripts/build-linux.sh
> > +++ b/scripts/build-linux.sh
> > @@ -12,11 +12,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_URL}" ]]; then
> > +    mkdir linux
> > +    cd linux
> > +    git init
> > +    git fetch --depth=1 "${LINUX_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
> 
> ... the issue is detecting to fetch via git or via curl based on the
> presence of a variable called "LINUX_URL". Technically 
> 
> https://cdn.kernel.org/pub/linux/kernel/v"${MAJOR}".x/linux-"${LINUX_VERSION}".tar.xz
> 
> is a a valid URL as well.
> 
> So I think you should keep LINUX_GIT_URL and LINUX_GIT_VERSION named as
> they are, expose them to scripts/build-linux.sh, and detect the fetch
> program based on the presence of LINUX_GIT_URL.
> 
> Ideally, we should not have LINUX_GIT_VERSION. Instead we should have a
> a common LINUX_VERSION used in both git and curl cases.

The problem here is conflicting variables for different jobs. If you
specify a variable when starting a pipeline (either manually, or via
schedule, or via settings), the variable will be set for all the jobs.
So, to be able to schedule a pipeline with both linux-6.12.60-x86_64 and
linux-git-x86_64 (for example based on linux-next, or maybe some rc),
the pipeline variable needs to be named differently than the one used by
this script. And IMO it's more important to have clear naming
(LINUX_GIT_VERSION+LINUX_GIT_URL) at the pipeline level.

I can change this script to use arguments instead of variables to avoid
this issue, but it will result in slightly more duplication (in
.gitlab-ci.yml file).

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2025-12-10  2:03 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04 16:37 [PATCH v2 00/12] Changes for several CI improvements Marek Marczykowski-Górecki
2025-12-04 16:37 ` [PATCH v2 02/12] Switch Linux builds to use Alpine 3.22 container Marek Marczykowski-Górecki
2025-12-12 21:15   ` Andrew Cooper
2025-12-12 21:34     ` Marek Marczykowski-Górecki
2025-12-04 16:37 ` [PATCH v2 04/12] Add linux-6.12.60-x86_64 Marek Marczykowski-Górecki
2025-12-10  0:17   ` Stefano Stabellini
2025-12-04 16:37 ` [PATCH v2 05/12] Enable CONFIG_USB_RTL8152 in kernel for hw12 runner Marek Marczykowski-Górecki
2025-12-10  0:18   ` Stefano Stabellini
2025-12-04 16:37 ` [PATCH v2 06/12] Include git in the ARM64 build container too Marek Marczykowski-Górecki
2025-12-10  0:20   ` Stefano Stabellini
2025-12-04 16:37 ` [PATCH v2 07/12] Support building arbitrary Linux branch/tag/commit Marek Marczykowski-Górecki
2025-12-10  0:29   ` Stefano Stabellini
2025-12-10  2:03     ` Marek Marczykowski-Górecki [this message]
2025-12-10 20:33       ` Stefano Stabellini
2025-12-04 16:37 ` [PATCH v2 08/12] Save Linux config to artifacts too Marek Marczykowski-Górecki
2025-12-10  0:29   ` Stefano Stabellini
2025-12-04 16:37 ` [PATCH v2 09/12] Add linux-stubdom dependencies Marek Marczykowski-Górecki
2025-12-04 16:38 ` [PATCH v2 10/12] Prepare grub for booting x86_64 HVM domU from a disk Marek Marczykowski-Górecki
2025-12-10  0:41   ` Stefano Stabellini
2025-12-04 16:38 ` [PATCH v2 11/12] Prepare grub for booting x86_64 HVM domU from a cdrom Marek Marczykowski-Górecki
2025-12-04 16:38 ` [PATCH v2 12/12] Setup ssh access to test systems Marek Marczykowski-Górecki
2025-12-10  0:36   ` Stefano Stabellini
2025-12-05  7:34 ` [PATCH v2 00/12] Changes for several CI improvements Jan Beulich
2025-12-05  9:51   ` Marek Marczykowski-Górecki
2025-12-05  9:59     ` Jan Beulich
2025-12-05 10:44       ` Juergen Gross
     [not found] ` <08274c26cc710d3bfa87a66431f441b5703df272.1764866136.git-series.marmarek@invisiblethingslab.com>
2025-12-12 21:12   ` [PATCH v2 01/12] Add Alpine 3.22 containers Andrew Cooper
2025-12-12 21:32     ` Marek Marczykowski-Górecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aTjU2GJFw9WcaR9X@mail-itl \
    --to=marmarek@invisiblethingslab.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.