Mailing List Archive

[PATCH v3 08/12] automation: add tests artifacts
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