All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: andrew.cooper3@citrix.com, cardoe@cardoe.com, wl@xen.org
Cc: sstabellini@kernel.org, xen-devel@lists.xenproject.org,
	Stefano Stabellini <stefano.stabellini@xilinx.com>
Subject: [PATCH v3 08/12] automation: add tests artifacts
Date: Tue, 24 Nov 2020 20:27:41 -0800	[thread overview]
Message-ID: <20201125042745.31986-8-sstabellini@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.21.2011241722540.7979@sstabellini-ThinkPad-T480s>

Some tests (soon to come) will require pre-built binaries to run, such
as the Linux kernel binary. We don't want to rebuild the Linux kernel
for each gitlab-ci run: these builds should not be added to the current
list of build jobs.

Instead, create additional containers that today are built and uploaded
manually, but could be re-built automatically. The containers build the
required binarires during the "docker build" step and store them inside
the container itself.

gitlab-ci will be able to fetch these pre-built binaries during the
regular test runs, saving cycles.

Add two tests artifacts containers:
- one to build the Linux kernel ARM64
- one to create an Alpine Linux ARM64 rootfs for Dom0

Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
---
 automation/tests-artifacts/Makefile           | 19 ++++++
 .../alpine/3.12-arm64v8.dockerfile            | 67 +++++++++++++++++++
 .../kernel/5.9.9-arm64v8.dockerfile           | 34 ++++++++++
 3 files changed, 120 insertions(+)
 create mode 100644 automation/tests-artifacts/Makefile
 create mode 100644 automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile
 create mode 100644 automation/tests-artifacts/kernel/5.9.9-arm64v8.dockerfile

diff --git a/automation/tests-artifacts/Makefile b/automation/tests-artifacts/Makefile
new file mode 100644
index 0000000000..8ca71b78ad
--- /dev/null
+++ b/automation/tests-artifacts/Makefile
@@ -0,0 +1,19 @@
+
+# the base of where these containers will appear
+REGISTRY := registry.gitlab.com/xen-project/xen/tests-artifacts
+CONTAINERS = $(subst .dockerfile,,$(wildcard */*.dockerfile))
+
+help:
+	@echo "Containers to build and export tests artifacts."
+	@echo "To build one run 'make ARTIFACT/VERSION'. Available containers:"
+	@$(foreach file,$(sort $(CONTAINERS)),echo ${file};)
+	@echo "To push container builds, set the env var PUSH"
+
+%: %.dockerfile ## Builds containers
+	docker build -t $(REGISTRY)/$(@D):$(@F) -f $< $(<D)
+	@if [ ! -z $${PUSH+x} ]; then \
+		docker push $(REGISTRY)/$(@D):$(@F); \
+	fi
+
+.PHONY: all
+all: $(CONTAINERS)
diff --git a/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile b/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile
new file mode 100644
index 0000000000..9457009452
--- /dev/null
+++ b/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile
@@ -0,0 +1,67 @@
+FROM arm64v8/alpine:3.12
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+RUN \
+  # apk
+  apk update && \
+  \
+  # xen runtime deps
+  apk add musl && \
+  apk add openrc && \
+  apk add busybox && \
+  apk add sudo && \
+  apk add dbus && \
+  apk add bash && \
+  apk add python2 && \
+  apk add gettext && \
+  apk add zlib && \
+  apk add ncurses && \
+  apk add texinfo && \
+  apk add yajl && \
+  apk add libaio && \
+  apk add xz-dev && \
+  apk add util-linux && \
+  apk add argp-standalone && \
+  apk add libfdt && \
+  apk add glib && \
+  apk add pixman && \
+  apk add curl && \
+  apk add udev && \
+  \
+  # Xen
+  cd / && \
+  # Minimal ramdisk environment in case of cpio output
+  rc-update add udev && \
+  rc-update add udev-trigger && \
+  rc-update add udev-settle && \
+  rc-update add networking sysinit && \
+  rc-update add loopback sysinit && \
+  rc-update add bootmisc boot && \
+  rc-update add devfs sysinit && \
+  rc-update add dmesg sysinit && \
+  rc-update add hostname boot && \
+  rc-update add hwclock boot && \
+  rc-update add hwdrivers sysinit && \
+  rc-update add killprocs shutdown && \
+  rc-update add modloop sysinit && \
+  rc-update add modules boot && \
+  rc-update add mount-ro shutdown && \
+  rc-update add savecache shutdown && \
+  rc-update add sysctl boot && \
+  rc-update add local default && \
+  cp -a /sbin/init /init && \
+  echo "ttyS0" >> /etc/securetty && \
+  echo "hvc0" >> /etc/securetty && \
+  echo "ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100" >> /etc/inittab && \
+  echo "hvc0::respawn:/sbin/getty -L hvc0 115200 vt100" >> /etc/inittab && \
+  passwd -d "root" root && \
+  \
+  # Create rootfs
+  cd / && \
+  tar cvzf /initrd.tar.gz bin dev etc home init lib mnt opt root sbin usr var
diff --git a/automation/tests-artifacts/kernel/5.9.9-arm64v8.dockerfile b/automation/tests-artifacts/kernel/5.9.9-arm64v8.dockerfile
new file mode 100644
index 0000000000..053d65a345
--- /dev/null
+++ b/automation/tests-artifacts/kernel/5.9.9-arm64v8.dockerfile
@@ -0,0 +1,34 @@
+FROM arm64v8/debian:unstable
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV LINUX_VERSION=5.9.9
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        libssl-dev \
+        bc \
+        curl \
+        flex \
+        bison \
+        && \
+    \
+    # Build the kernel
+    curl -fsSLO https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-"$LINUX_VERSION".tar.xz && \
+    tar xvJf linux-"$LINUX_VERSION".tar.xz && \
+    cd linux-"$LINUX_VERSION" && \
+    make defconfig && \
+    make -j$(nproc) Image.gz && \
+    cp arch/arm64/boot/Image / && \
+    cd /build && \
+    rm -rf linux-"$LINUX_VERSION"* && \
+    apt-get autoremove -y && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
-- 
2.17.1



  parent reply	other threads:[~2020-11-25  4:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25  4:27 [PATCH v3 00/12] automation: improvements (mostly) for arm64 Stefano Stabellini
2020-11-25  4:27 ` [PATCH v3 01/12] automation: add a QEMU aarch64 smoke test Stefano Stabellini
2020-12-04 10:40   ` Wei Liu
2020-12-04 21:40     ` Stefano Stabellini
2020-11-25  4:27 ` [PATCH v3 02/12] automation: add dom0less to the " Stefano Stabellini
2020-11-25  4:27 ` [PATCH v3 03/12] automation: pass --disable-werror for QEMUU builds if libc is musl Stefano Stabellini
2020-11-25  4:27 ` [PATCH v3 04/12] automation: add alpine linux 3.12 arm64 build container Stefano Stabellini
2020-11-25  4:27 ` [PATCH v3 05/12] automation: add alpine linux arm64 build test Stefano Stabellini
2020-11-25  4:27 ` [PATCH v3 06/12] automation: add alpine linux 3.12 x86 build container Stefano Stabellini
2020-11-25  4:27 ` [PATCH v3 07/12] automation: add alpine linux x86 build jobs Stefano Stabellini
2020-11-26  0:26   ` Stefano Stabellini
2020-11-25  4:27 ` Stefano Stabellini [this message]
2020-11-25  4:27 ` [PATCH v3 09/12] automation: make available the tests artifacts to the pipeline Stefano Stabellini
2020-11-25  4:27 ` [PATCH v3 10/12] automation: create an alpine linux arm64 test job Stefano Stabellini
2020-11-25  4:27 ` [PATCH v3 11/12] automation: use the tests-artifacts kernel for qemu-smoke-arm64-gcc Stefano Stabellini
2020-11-25  4:27 ` [PATCH v3 12/12] automation: add domU creation to dom0 alpine linux test Stefano Stabellini
2020-12-04 10:41 ` [PATCH v3 00/12] automation: improvements (mostly) for arm64 Wei Liu

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=20201125042745.31986-8-sstabellini@kernel.org \
    --to=sstabellini@kernel.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=cardoe@cardoe.com \
    --cc=stefano.stabellini@xilinx.com \
    --cc=wl@xen.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.