Skip to contentSkip to conversation

CI: part 3 (improvments to PPC)

PATCH Superseded Andrew Cooper 2 participants 7 messages Jul 8, 2024 – Jul 9, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover CI: part 3 (improvments to PPC)

Here is a run with these improvements in place:

https://gitlab.com/xen-project/people/andyhhp/xen/-/jobs/7277624801

Jan: I hope to backport this series to 4.18 so we can remove qemu-system-ppc64/8.1.0-ppc64 entirely. This will simplify changes in the future by making the testing more consistent.

Andrew Cooper (4):
CI: Fix CONTAINER_UID0=1 scripts/containerize
CI: Introduce a bookworm-ppc64le container
CI: Use bookworm-ppc64le for both build and test
CI: Refresh bullseye-ppc64le

 .../build/debian/bookworm-ppc64le.dockerfile  | 36 +++++++++++++
 .../build/debian/bullseye-ppc64le.dockerfile  | 51 ++++++++++---------
 automation/gitlab-ci/build.yaml               | 22 ++++++--
 automation/gitlab-ci/test.yaml                |  3 +-
 automation/scripts/containerize               |  2 +-
 automation/scripts/qemu-smoke-ppc64le.sh      |  4 +-
 .../qemu-system-ppc64/8.1.0-ppc64.dockerfile  | 38 --------------
 7 files changed, 84 insertions(+), 72 deletions(-)
 create mode 100644 automation/build/debian/bookworm-ppc64le.dockerfile
 delete mode 100644 automation/tests-artifacts/qemu-system-ppc64/8.1.0-ppc64.dockerfile

base-commit: 64cee188376e52a154475a86a9d2adc85f029870

Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/4 CI: Fix CONTAINER_UID0=1 scripts/containerize

Right now, most build containers use root. Archlinux, Fedora and Yocto set up a regular user called user.

For those containers, trying to containerize as root fails, because CONTAINER_UID0=1 does nothing, whereas CONTAINER_UID0=0 forces the user away from root.

To make CONTAINER_UID0=1 work reliably, force to root if requested.

---
CC: Anthony PERARD <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Shawn Anastasio <[email protected]>

---
 automation/scripts/containerize | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
automation/scripts/containerize +1 -1
index acdef1b54813..03bc4837350c 100755
@@ -51,7 +51,7 @@ esac
 
 # Use this variable to control whether root should be used
 case "_${CONTAINER_UID0}" in
-    _1)   userarg= ;;
+    _1)   userarg="-u 0" ;;
     _0|_) userarg="-u $(id -u) $userns_podman" ;;
 esac
 
Signature · 1 line
2.39.2
#2 lore raw

PATCH 2/4 CI: Introduce a bookworm-ppc64le container

In reply to Andrew Cooper

Make it non-root by default, and set XEN_TARGET_ARCH=ppc64 too.

---
CC: Anthony PERARD <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Shawn Anastasio <[email protected]>

---
 .../build/debian/bookworm-ppc64le.dockerfile  | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 automation/build/debian/bookworm-ppc64le.dockerfile
automation/build/debian/bookworm-ppc64le.dockerfile new file +36 -0
new file mode 100644
index 000000000000..3b311e675ef5
@@ -0,0 +1,36 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/amd64 debian:bookworm-slim
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="[email protected]"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV CROSS_COMPILE=powerpc64le-linux-gnu-
+ENV XEN_TARGET_ARCH=ppc64
+
+RUN <<EOF
+#!/bin/bash
+    set -e
+
+    useradd --create-home user
+
+    apt-get -y update
+
+    DEPS=(
+        # Xen
+        bison
+        build-essential
+        checkpolicy
+        flex
+        gcc-powerpc64le-linux-gnu
+        python3-minimal
+
+        # Qemu for test phase
+        qemu-system-ppc
+    )
+
+    apt-get -y --no-install-recommends install "${DEPS[@]}"
+    rm -rf /var/lib/apt/lists/*
+EOF
+
+USER user
+WORKDIR /build
Signature · 1 line
2.39.2
#3 lore raw

PATCH 3/4 CI: Use bookworm-ppc64le for both build and test

In reply to Andrew Cooper

qemu-system-ppc64/8.1.0-ppc64 was added because bullseye's Qemu didn't understand the powernv9 machine.

However, bookworm's Qemu does, and this is preforable to maintaining a random build of Qemu ourselves.

Add bookworm builds, and retain bullseye to keep our lower-bound toolchain testing.

---
CC: Anthony PERARD <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Shawn Anastasio <[email protected]>

---
 automation/gitlab-ci/build.yaml               | 22 +++++++++--
 automation/gitlab-ci/test.yaml                |  3 +-
 automation/scripts/qemu-smoke-ppc64le.sh      |  4 +-
 .../qemu-system-ppc64/8.1.0-ppc64.dockerfile  | 38 -------------------
 4 files changed, 21 insertions(+), 46 deletions(-)
 delete mode 100644 automation/tests-artifacts/qemu-system-ppc64/8.1.0-ppc64.dockerfile
automation/gitlab-ci/build.yaml +18 -4
index ff5c9055d1f0..d6da156a5c85 100644
@@ -534,17 +534,17 @@ archlinux-current-gcc-riscv64-debug-randconfig:
     <<: *riscv-fixed-randconfig
 
 # Power cross-build
-debian-bullseye-gcc-ppc64le:
+debian-bookworm-gcc-ppc64le:
   extends: .gcc-ppc64le-cross-build
   variables:
-    CONTAINER: debian:bullseye-ppc64le
+    CONTAINER: debian:bookworm-ppc64le
     KBUILD_DEFCONFIG: ppc64_defconfig
     HYPERVISOR_ONLY: y
 
-debian-bullseye-gcc-ppc64le-debug:
+debian-bookworm-gcc-ppc64le-debug:
   extends: .gcc-ppc64le-cross-build-debug
   variables:
-    CONTAINER: debian:bullseye-ppc64le
+    CONTAINER: debian:bookworm-ppc64le
     KBUILD_DEFCONFIG: ppc64_defconfig
     HYPERVISOR_ONLY: y
 
@@ -817,3 +817,17 @@ opensuse-tumbleweed-gcc-debug:
   variables:
     CONTAINER: suse:opensuse-tumbleweed
   allow_failure: true
+
+debian-bullseye-gcc-ppc64le:
+  extends: .gcc-ppc64le-cross-build
+  variables:
+    CONTAINER: debian:bullseye-ppc64le
+    KBUILD_DEFCONFIG: ppc64_defconfig
+    HYPERVISOR_ONLY: y
+
+debian-bullseye-gcc-ppc64le-debug:
+  extends: .gcc-ppc64le-cross-build-debug
+  variables:
+    CONTAINER: debian:bullseye-ppc64le
+    KBUILD_DEFCONFIG: ppc64_defconfig
+    HYPERVISOR_ONLY: y
automation/gitlab-ci/test.yaml +1 -2
index 898d2adc8c5b..479479f23f65 100644
@@ -447,5 +447,4 @@ qemu-smoke-ppc64le-powernv9-gcc:
   script:
     - ./automation/scripts/qemu-smoke-ppc64le.sh powernv9 2>&1 | tee ${LOGFILE}
   needs:
-    - qemu-system-ppc64-8.1.0-ppc64-export
-    - debian-bullseye-gcc-ppc64le-debug
+    - debian-bookworm-gcc-ppc64le-debug
automation/scripts/qemu-smoke-ppc64le.sh +2 -2
index 701d81107d18..9088881b731b 100755
@@ -12,8 +12,8 @@ rm -f ${serial_log}
 set +e
 
 timeout -k 1 20 \
-binaries/qemu-system-ppc64 \
-    -bios binaries/skiboot.lid \
+qemu-system-ppc64 \
+    -bios skiboot.lid \
     -M $machine \
     -m 2g \
     -smp 1 \
automation/tests-artifacts/qemu-system-ppc64/8.1.0-ppc64.dockerfile deleted +0 -38
deleted file mode 100644
index e28d68649239..000000000000
@@ -1,38 +0,0 @@
-# syntax=docker/dockerfile:1
-FROM --platform=linux/amd64 debian:bullseye-slim
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="[email protected]"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV QEMU_VERSION=8.1.0
-ENV USER root
-
-RUN mkdir /build
-WORKDIR /build
-
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        build-essential \
-        curl \
-        python3 \
-        python3-pip \
-        python3-elementpath \
-        ninja-build \
-        pkg-config \
-        libglib2.0-dev \
-        libpixman-1-dev \
-        && \
-    \
-    curl -fsSLO https://download.qemu.org/qemu-"$QEMU_VERSION".tar.xz && \
-    tar xvJf qemu-"$QEMU_VERSION".tar.xz && \
-    cd qemu-"$QEMU_VERSION" && \
-    ./configure --target-list=ppc64-softmmu && \
-    make -j$(nproc) && \
-    cp ./build/qemu-system-ppc64 / && \
-    cp ./build/qemu-bundle/usr/local/share/qemu/skiboot.lid / && \
-    cd /build && \
-    rm -rf qemu-"$QEMU_VERSION"* && \
-    apt-get autoremove -y && \
-    apt-get clean && \
-    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
Signature · 1 line
2.39.2
#4 lore raw

PATCH 4/4 CI: Refresh bullseye-ppc64le

In reply to Andrew Cooper

... in the style of bookworm-ppc64le

---
CC: Anthony PERARD <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Shawn Anastasio <[email protected]>

---
 .../build/debian/bullseye-ppc64le.dockerfile  | 51 ++++++++++---------
 1 file changed, 26 insertions(+), 25 deletions(-)
automation/build/debian/bullseye-ppc64le.dockerfile +26 -25
index e166d205f38c..d846b670d02c 100644
@@ -1,32 +1,33 @@
 # syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 debian:bullseye-slim
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="[email protected]"
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="[email protected]"
 
 ENV DEBIAN_FRONTEND=noninteractive
-ENV USER root
+ENV CROSS_COMPILE=powerpc64le-linux-gnu-
+ENV XEN_TARGET_ARCH=ppc64
 
-# Add compiler path
-ENV CROSS_COMPILE powerpc64le-linux-gnu-
+RUN <<EOF
+#!/bin/bash
+    set -e
 
-RUN mkdir /build
-WORKDIR /build
+    useradd --create-home user
+
+    apt-get -y update
+
+    DEPS=(
+        # Xen
+        bison
+        build-essential
+        checkpolicy
+        flex
+        gcc-powerpc64le-linux-gnu
+        python3-minimal
+    )
 
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes --no-install-recommends install \
-        bison \
-        build-essential \
-        checkpolicy \
-        flex \
-        gawk \
-        gcc-powerpc64le-linux-gnu \
-        make \
-        python3-minimal \
-        # QEMU runtime dependencies for test phase
-        libglib2.0-0 \
-        libpixman-1-0 \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
+    apt-get -y --no-install-recommends install "${DEPS[@]}"
+    rm -rf /var/lib/apt/lists/*
+EOF
+
+USER user
+WORKDIR /build
Signature · 1 line
2.39.2
#5 lore raw
In reply to Andrew Cooper
Quoted 7 lines · Andrew Cooper

Here is a run with these improvements in place:

https://gitlab.com/xen-project/people/andyhhp/xen/-/jobs/7277624801

Jan: I hope to backport this series to 4.18 so we can remove qemu-system-ppc64/8.1.0-ppc64 entirely. This will simplify changes in the future by making the testing more consistent.

This being part 3 a relevant question would be in how far this is independent of the earlier two parts?

Quoted 5 lines

Andrew Cooper (4):
CI: Fix CONTAINER_UID0=1 scripts/containerize
CI: Introduce a bookworm-ppc64le container
CI: Use bookworm-ppc64le for both build and test
CI: Refresh bullseye-ppc64le

The other question, seeing that the latter three patches being strictly PPC only, would concern only patch 1: It not having a Fixes: tag and things (supposedly) working okay right now makes me wonder whether that would need to be part of the backport set.

Jan

#6 lore raw
Quoted 10 lines · Jan Beulich
Quoted 7 lines · Andrew Cooper

Here is a run with these improvements in place:

https://gitlab.com/xen-project/people/andyhhp/xen/-/jobs/7277624801

Jan: I hope to backport this series to 4.18 so we can remove qemu-system-ppc64/8.1.0-ppc64 entirely. This will simplify changes in the future by making the testing more consistent.

This being part 3 a relevant question would be in how far this is independent of the earlier two parts?

Patch 1 is only tangentially related to 2-4.

It's a long-standing script bug that I've encountered for the second time now, and will compound everywhere (even older branches) by making the containers be non-root by default.

We should never had had root-based containers.  It's not necessary for our build or qemu smoke test containers, and it's a stupid risk given that patchew consumes *everything* from the mailing list which applies.

In terms of a fixes tag, its 17fbe6504dfd from 6 years ago.

It's a problem for anyone using the containers manually with the containerize[sic] script, not for Gitlab itself.

~Andrew