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

monstermunchkin on Github lxc-bot at linuxcontainers.org
Wed Mar 4 16:42:12 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/20200304/adda2d10/attachment.bin>
-------------- next part --------------
From 5855f16e7780713b15f7c1b40422acc04f3c2a91 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Thu, 27 Feb 2020 07:21:51 +0100
Subject: [PATCH 1/2] images: Add openSUSE VM support

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

diff --git a/images/opensuse.yaml b/images/opensuse.yaml
index e792a01..90f9431 100644
--- a/images/opensuse.yaml
+++ b/images/opensuse.yaml
@@ -64,12 +64,45 @@ files:
   - path: /etc/hosts
     generator: hosts
 
+  - path: /etc/machine-id
+    generator: dump
+
+  - 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
+
+      GRUB_USE_LINUXEFI="true"
+    types:
+      - vm
+
   - name: ifcfg-eth0
     path: /etc/sysconfig/network/ifcfg-eth0
     generator: dump
     content: |-
       STARTMODE='auto'
       BOOTPROTO='dhcp'
+    types:
+      - container
+
+  - name: ifcfg-enp5s0
+    path: /etc/sysconfig/network/ifcfg-enp5s0
+    generator: dump
+    content: |-
+      STARTMODE='auto'
+      BOOTPROTO='dhcp'
+    types:
+      - vm
 
   - name: meta-data
     generator: cloud-init
@@ -91,6 +124,14 @@ files:
     variants:
       - cloud
 
+  - generator: fstab
+    types:
+      - vm
+
+  - generator: lxd-agent
+    types:
+      - vm
+
 packages:
   manager: zypper
   update: true
@@ -129,7 +170,39 @@ packages:
       variants:
        - cloud
 
+    - packages:
+       - grub2-arm64-efi
+      action: install
+      types:
+       - vm
+      architectures:
+       - aarch64
+
+    - packages:
+       - grub2-x86_64-efi
+      action: install
+      types:
+       - vm
+      architectures:
+       - x86_64
+
+    - packages:
+       - kernel-default
+       - shim
+      action: install
+      types:
+       - vm
+
 actions:
+ - trigger: post-unpack
+   action: |-
+     #!/bin/sh
+     set -eux
+
+     systemd-machine-id-setup
+   types:
+     - vm
+
  - trigger: post-packages
    action: |-
      #!/bin/sh
@@ -170,3 +243,23 @@ actions:
      umount -l /etc/resolv.conf || true
      rm /etc/resolv.conf
      ln -sf /var/run/netconfig/resolv.conf /etc/resolv.conf
+
+ - trigger: post-files
+   action: |-
+     #!/bin/sh
+     set -eux
+     umount -l /etc/resolv.conf || true
+     rm /etc/resolv.conf
+     ln -sf /var/run/netconfig/resolv.conf /etc/resolv.conf
+
+     mkinitrd
+     mount -t tmpfs tmpfs /sys/firmware
+     mkdir /sys/firmware/efi
+     grub2-mkconfig -o /boot/grub2/grub.cfg
+     shim-install --no-nvram --removable
+     shim-install --no-nvram
+     grub2-mkconfig -o /boot/grub2/grub.cfg
+     umount /sys/firmware
+     sed -i "s#root=[^ ]*#root=/dev/sda2#g" /boot/grub2/grub.cfg
+   types:
+     - vm

From ff3c08b232fbac56f2aaf254c27a532b76e617fd Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Wed, 4 Mar 2020 17:40:48 +0100
Subject: [PATCH 2/2] jenkins/jobs: Add openSUSE VM support

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 jenkins/jobs/image-opensuse.yaml | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/jenkins/jobs/image-opensuse.yaml b/jenkins/jobs/image-opensuse.yaml
index 1d01777..4b660c3 100644
--- a/jenkins/jobs/image-opensuse.yaml
+++ b/jenkins/jobs/image-opensuse.yaml
@@ -41,8 +41,13 @@
         [ "${ARCH}" = "i386" ] && ARCH="i686"
         [ "${ARCH}" = "amd64" ] && ARCH="x86_64"
 
+        TYPE="container"
+        if [ "${architecture}" = "amd64" ] || [ "${architecture}" = "arm64" ]; then
+            TYPE="container,vm"
+        fi
+
         exec sudo /lxc-ci/bin/build-distro /lxc-ci/images/opensuse.yaml \
-            ${LXD_ARCHITECTURE} container 1800 ${WORKSPACE} \
+            ${LXD_ARCHITECTURE} ${TYPE} 1800 ${WORKSPACE} \
             -o image.architecture=${ARCH} -o image.release=${release} \
             -o image.variant=${variant}
 
@@ -60,7 +65,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