public inbox for buildbot@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED] Add coreos butane.yaml and virinstall.sh install scripts
@ 2026-02-25 22:40 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2026-02-25 22:40 UTC (permalink / raw)
  To: buildbot; +Cc: Mark Wielaard

This is how the buildbot worker container VMs are setup on
sourceware-builder3.osuosl.org
---
 builder/containers/butane.yaml.in | 72 +++++++++++++++++++++++++++++++
 builder/containers/virinstall.sh  | 61 ++++++++++++++++++++++++++
 2 files changed, 133 insertions(+)
 create mode 100644 builder/containers/butane.yaml.in
 create mode 100755 builder/containers/virinstall.sh

diff --git a/builder/containers/butane.yaml.in b/builder/containers/butane.yaml.in
new file mode 100644
index 000000000000..6013c3f9bd77
--- /dev/null
+++ b/builder/containers/butane.yaml.in
@@ -0,0 +1,72 @@
+variant: fcos
+version: 1.4.0
+storage:
+  disks:
+  - device: /dev/vda
+    wipe_table: false
+    partitions:
+    # 10GB root (already exists, resize)
+    - number: 4
+      label: root
+      size_mib: 10240
+      resize: true
+    # 8GB swap
+    - number: 5
+      label: swap
+      size_mib: 8192
+    # Everything else for /var (which includes everything writable)
+    - size_mib: 0
+      label: var
+  filesystems:
+    - device: /dev/disk/by-partlabel/swap
+      format: swap
+      wipe_filesystem: true
+      with_mount_unit: true
+    - path: /var
+      device: /dev/disk/by-partlabel/var
+      # We can select the filesystem we'd like.
+      format: ext4
+      wipe_filesystem: true
+      # Ask Butane to generate a mount unit for us so that this filesystem
+      # gets mounted in the real root.
+      with_mount_unit: true
+  files:
+    - path: /etc/hostname
+      mode: 0644
+      contents:
+        inline: @VMNAME@
+systemd:
+  units:
+    # Create and set selinux context for shared builder dir
+    - name: builder-shared-dir.service
+      enabled: true
+      contents: |
+        [Unit]
+        Description=Builder shared dir
+        Wants=network-online.target
+        After=network-online.target
+        # We run before `zincati.service` to avoid conflicting rpm-ostree
+        # transactions.
+        Before=zincati.service
+        ConditionPathExists=!/var/lib/%N.stamp
+
+        [Service]
+        Type=oneshot
+        RemainAfterExit=yes
+        ExecStart=/bin/mkdir -p /home/builder/shared
+        ExecStart=/bin/chown builder.builder /home/builder/shared
+        ExecStart=/bin/chcon -t container_file_t /home/builder/shared
+        ExecStart=/bin/touch /var/lib/%N.stamp
+
+        [Install]
+        WantedBy=multi-user.target
+passwd:
+  users:
+    - name: core
+      ssh_authorized_keys:
+        - ssh-ed25519 xxxx
+    - name: builder
+      uid: 1001
+      groups: [docker]
+      ssh_authorized_keys:
+        - ssh-rsa xxxx
diff --git a/builder/containers/virinstall.sh b/builder/containers/virinstall.sh
new file mode 100755
index 000000000000..d191e76d2558
--- /dev/null
+++ b/builder/containers/virinstall.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# Install script for coreos (self-updating) distro which just contains
+# docker and podman for running containers.  Combine with
+# butane.yam.in This script uses a self-compiled butane,
+# https://docs.fedoraproject.org/en-US/fedora-coreos/getting-started/
+
+# Make sure to setup libvirt networking with <forward mode='route'/>.
+# virsh net-edit default
+# Otherwise the nat-rules done with firewall-cmd won't work.
+# firewall-cmd --permanent --zone=public --add-masquerade
+# firewall-cmd --reload
+
+# Make sure to create lvs to use in DISKPATH.
+
+# big bb
+# VMNAME=sw3bb1
+# VCPUS=40
+# RAMMB=262144
+# DISKPATH=/dev/mapper/swb3--buildbot-sw3bb1--disk
+
+# small bb
+VMNAME=sw3bb2
+VCPUS=16
+RAMMB=98304
+DISKPATH=/dev/mapper/swb3--buildbot-sw3bb2--disk
+
+# Dunno how to automate the network mac/ip address.
+# Use virsh net-dhcp-leases default to get the mac address.
+# Then pin it using virsh net-edit default
+# <host mac='52:54:00:a9:48:1a' name='sw3bb1' ip='192.168.122.2'/>
+# <host mac='52:54:00:bb:98:3d' name='sw3bb2' ip='192.168.122.3'/>
+
+# firewall-cmd --permanent --zone=public --add-forward-port=port=2012:proto=tcp:toport=22:toaddr=192.168.122.2
+# firewall-cmd --permanent --zone=public --add-forward-port=port=2013:proto=tcp:toport=22:toaddr=192.168.122.3
+# firewall-cmd --reload
+
+# TODO make this work with ipv6
+
+sed -e "s/@VMNAME@/${VMNAME}/" < butane.yaml.in > butane.yaml
+
+butane/bin/amd64/butane butane.yaml --output ignition.ign
+
+podman run --pull=always --privileged --rm \
+	-v /dev:/dev -v /run/udev:/run/udev -v .:/data -w /data \
+	quay.io/coreos/coreos-installer:release \
+	install ${DISKPATH} \
+	-i ignition.ign
+
+virt-install --connect="qemu:///system" \
+	--autostart \
+	--name ${VMNAME} \
+	--vcpus ${VCPUS} \
+	--memory ${RAMMB} \
+	--os-variant=fedora-coreos-stable \
+	--network network=default \
+	--graphics=none \
+	--cpu host-passthrough \
+	--import \
+	--disk=path=${DISKPATH} \
+	--noautoconsole
-- 
2.52.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-25 22:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-25 22:40 [COMMITTED] Add coreos butane.yaml and virinstall.sh install scripts Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).