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

monstermunchkin on Github lxc-bot at linuxcontainers.org
Tue Mar 10 21:07:17 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/20200310/907bd5ec/attachment.bin>
-------------- next part --------------
From c6afdf8608c0b3bbdbce05b754c64c621a2d363c Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Tue, 10 Mar 2020 20:56:30 +0100
Subject: [PATCH 1/2] images: Add Gentoo VM support

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

diff --git a/images/gentoo.yaml b/images/gentoo.yaml
index 12aca37..a561ad3 100644
--- a/images/gentoo.yaml
+++ b/images/gentoo.yaml
@@ -363,6 +363,31 @@ files:
   variants:
   - cloud
 
+- generator: lxd-agent
+  types:
+  - vm
+
+- generator: fstab
+  types:
+  - vm
+
+- path: /etc/default/grub
+  generator: dump
+  content: |-
+    GRUB_DISTRIBUTOR="Gentoo"
+    # 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
+    # Disable os-prober
+    GRUB_DISABLE_OS_PROBER=true
+  types:
+  - vm
+
 packages:
   manager: portage
   update: false
@@ -374,6 +399,14 @@ packages:
     variants:
     - cloud
 
+  - packages:
+    - gentoo-kernel-bin
+    - grub
+    - syslog-ng
+    action: install
+    types:
+    - vm
+
 actions:
 - trigger: post-unpack
   action: |-
@@ -411,6 +444,8 @@ actions:
     cp /usr/share/portage/config/repos.conf /usr/share/portage/config/repos.conf.orig
     sed -i "s#hkps://keys.gentoo.org#keyserver.ubuntu.com#g" /usr/share/portage/config/repos.conf
     sed -ri "s#(sync-uri =) .+#\1 ${RSYNC_MIRROR}#" /usr/share/portage/config/repos.conf
+
+    echo ACCEPT_KEYWORDS="~amd64" >> /etc/portage/make.conf
   types:
   - container
   - vm
@@ -452,6 +487,15 @@ actions:
   variants:
   - cloud
 
+- trigger: post-files
+  action: |-
+    #!/bin/sh
+    set -eux
+    grub-install --target=x86_64-efi --no-nvram --removable
+    grub-install --target=x86_64-efi --no-nvram
+    grub-mkconfig -o /boot/grub/grub.cfg
+    sed -i "s#root=[^ ]*#root=/dev/sda2#g" /boot/grub/grub.cfg
+
 environment:
   variables:
   - key: RSYNC_MIRROR

From 213b76d58d7d6f352d1472be8df64f8b19bd3ef0 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Tue, 10 Mar 2020 22:05:45 +0100
Subject: [PATCH 2/2] jenkins/jobs: Add Gentoo VM support

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

diff --git a/jenkins/jobs/image-gentoo.yaml b/jenkins/jobs/image-gentoo.yaml
index 38e9956..ed5d708 100644
--- a/jenkins/jobs/image-gentoo.yaml
+++ b/jenkins/jobs/image-gentoo.yaml
@@ -43,8 +43,13 @@
         [ "${ARCH}" = "ppc64el" ] && ARCH="ppc64le"
         [ "${ARCH}" = "i386" ] && ARCH="i686"
 
+        TYPE="container"
+        if [ "${architecture}" = "amd64" ] || [ "${architecture}" = "arm64" ]; then
+            TYPE="container,vm"
+        fi
+
         exec sudo /lxc-ci/bin/build-distro /lxc-ci/images/gentoo.yaml \
-            ${LXD_ARCHITECTURE} container 7200 ${WORKSPACE} \
+            ${LXD_ARCHITECTURE} ${TYPE} 7200 ${WORKSPACE} \
             -o image.architecture=${ARCH} -o image.variant=${variant}
 
     properties:
@@ -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