Skip to contentSkip to conversation

CI: Turn debian/12-x86_64 into a non-root container

PATCH In review Andrew Cooper 2 participants 3 messages Aug 12, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CI: Turn debian/12-x86_64 into a non-root container

From: Javi Merino <[email protected]>

Since commit 4611ae6fb8f9 ("CI: save toolstack artifact as cpio.gz"), the various automation/scripts/* no longer need to be root to correctly repack the initrd for test.

---
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Anthony PERARD <[email protected]>

Xen 4.20 and later uses debian:12-x86_64 and also contains 4611ae6fb8f9 so this is safe to change generally.

---
 automation/build/debian/12-x86_64.dockerfile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
automation/build/debian/12-x86_64.dockerfile +3 -1
index e26a19079e38..3cf99c730b61 100644
@@ -9,6 +9,8 @@ RUN <<EOF
 #!/bin/bash
     set -eu
 
+    useradd --create-home user
+
     apt-get update
 
     DEPS=(
@@ -70,5 +72,5 @@ RUN <<EOF
     rm -rf /var/lib/apt/lists*
 EOF
 
-USER root
+USER user
 WORKDIR /build
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Andrew Cooper

From: Javi Merino <[email protected]>

Since commit 4611ae6fb8f9 ("CI: save toolstack artifact as cpio.gz"), the various automation/scripts/* no longer need to be root to correctly repack the initrd for test.

Quoted 7 lines

---
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Anthony PERARD <[email protected]>

Xen 4.20 and later uses debian:12-x86_64 and also contains 4611ae6fb8f9 so this is safe to change generally.

I gave it a try, just to be sure:

    https://gitlab.com/xen-project/people/anthonyper/xen/-/pipelines/1980442689
and staging-4.20:
    https://gitlab.com/xen-project/people/anthonyper/xen/-/pipelines/1980621317

(all the failed build should be because I was lazy and didn't rebuild all containers or didn't select a subset of the builds. All test passed or are skipped, which is what I was looking for)

So:

Thanks,

Signature · 1 line
Anthony PERARD
#2 lore raw
Quoted 21 lines · Anthony PERARD
Quoted 8 lines · Andrew Cooper

From: Javi Merino <[email protected]>

Since commit 4611ae6fb8f9 ("CI: save toolstack artifact as cpio.gz"), the various automation/scripts/* no longer need to be root to correctly repack the initrd for test.

Quoted 7 lines

---
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Anthony PERARD <[email protected]>

Xen 4.20 and later uses debian:12-x86_64 and also contains 4611ae6fb8f9 so this is safe to change generally.

I gave it a try, just to be sure:

    https://gitlab.com/xen-project/people/anthonyper/xen/-/pipelines/1980442689
and staging-4.20:
    https://gitlab.com/xen-project/people/anthonyper/xen/-/pipelines/1980621317
Quoted 6 lines

(all the failed build should be because I was lazy and didn't rebuild all containers or didn't select a subset of the builds. All test passed or are skipped, which is what I was looking for)

So:

Thanks.  I'll commit and deploy this now.

~Andrew