[lxc-devel] [lxc-ci/master] Add Archlinux VM support

monstermunchkin on Github lxc-bot at linuxcontainers.org
Tue Mar 3 17:00:23 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 303 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200303/153adac2/attachment-0001.bin>
-------------- next part --------------
From 5531d621ca742faf20ae676a95fed04843b92ab9 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Tue, 3 Mar 2020 17:58:39 +0100
Subject: [PATCH 1/2] images: Add Archlinux VM support

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 images/archlinux.yaml | 60 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/images/archlinux.yaml b/images/archlinux.yaml
index 74b43fc..34d0038 100644
--- a/images/archlinux.yaml
+++ b/images/archlinux.yaml
@@ -457,6 +457,23 @@ files:
     path: /etc/hosts
     generator: hosts
 
+  - path: /etc/default/grub
+    generator: dump
+    content: |-
+      # Set the recordfail timeout
+      GRUB_RECORDFAIL_TIMEOUT=0
+
+      # Do not wait on grub prompt
+      GRUB_TIMEOUT=0
+
+      # Set the default commandline
+      GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0"
+
+      # Set the grub console type
+      GRUB_TERMINAL=console
+    types:
+    - vm
+
   - name: eth0.network
     path: /etc/systemd/network/eth0.network
     generator: dump
@@ -474,6 +491,16 @@ files:
       [Service]
       BindReadOnlyPaths=/sys
 
+
+  - name: lxd-agent
+    generator: lxd-agent
+    types:
+    - vm
+
+  - generator: fstab
+    types:
+    - vm
+
 packages:
   manager: pacman
   update: true
@@ -511,11 +538,26 @@ packages:
         - which
       action: install
 
+    - packages:
+        - grub
+      types:
+        - vm
+
+    - packages:
+        - linux
+      action: install
+      architectures:
+        - x86_64
+      types:
+        - vm
+
     - packages:
         - linux-aarch64
       action: remove
       architectures:
         - aarch64
+      types:
+        - container
 
     - packages:
         - linux-armv7
@@ -546,5 +588,23 @@ actions:
       systemctl enable systemd-networkd
       systemctl enable systemd-resolved
 
+  - trigger: post-files
+    action: |-
+      #!/bin/sh
+      set -eux
+
+      TARGET="x86_64"
+      [ "$(uname -m)" = "aarch64" ] && TARGET="arm64"
+
+      grub-install --target="${TARGET}-efi" --efi-directory=/boot/efi --no-nvram --removable
+      grub-install --target="${TARGET}-efi" --efi-directory=/boot/efi --no-nvram
+      grub-mkconfig -o /boot/grub/grub.cfg
+      sed -i "s#root=[^ ]*#root=/dev/sda2#g" /boot/grub/grub.cfg
+
+      # Rebuild initrd
+      sed 's#^MODULES=.*#MODULES=(virtio_pci virtio_scsi)#' /etc/mkinitcpio.conf
+      mkinitcpio -p linux
+    types:
+      - vm
 mappings:
   architecture_map: archlinux

From 29f09960c224a0804ab59e83c405c1c377f63bdd Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Tue, 3 Mar 2020 17:58:52 +0100
Subject: [PATCH 2/2] jenkins/jobs: Add Archlinux VM support

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 jenkins/jobs/image-archlinux.yaml | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/jenkins/jobs/image-archlinux.yaml b/jenkins/jobs/image-archlinux.yaml
index 5ffbd67..7bb3f65 100644
--- a/jenkins/jobs/image-archlinux.yaml
+++ b/jenkins/jobs/image-archlinux.yaml
@@ -36,14 +36,19 @@
         [ "${ARCH}" = "armhf" ] && ARCH="armv7"
         [ "${ARCH}" = "arm64" ] && ARCH="aarch64"
 
+        TYPE="container"
+        if [ "${architecture}" = "amd64" ] || [ "${architecture}" = "arm64" ]; then
+            TYPE="container,vm"
+        fi
+
         if [ "${ARCH}" = "x86_64" ]; then
             exec sudo /lxc-ci/bin/build-distro /lxc-ci/images/archlinux.yaml \
-                ${LXD_ARCHITECTURE} container 1800 ${WORKSPACE} \
+                ${LXD_ARCHITECTURE} ${TYPE} 1800 ${WORKSPACE} \
                 -o image.architecture=${ARCH}
         fi
 
         exec sudo /lxc-ci/bin/build-distro /lxc-ci/images/archlinux.yaml \
-            ${LXD_ARCHITECTURE} container 1800 ${WORKSPACE} \
+            ${LXD_ARCHITECTURE} ${TYPE} 1800 ${WORKSPACE} \
             -o image.architecture=${ARCH} \
             -o source.url=http://os.archlinuxarm.org
 
@@ -56,7 +61,7 @@
 
     publishers:
     - archive:
-        artifacts: "*.tar.xz,*.squashfs,image.yaml,serial"
+        artifacts: "*.qcow2,*.tar.xz,*.squashfs,image.yaml,serial"
         only-if-success: true
 
     - workspace-cleanup:


More information about the lxc-devel mailing list