diff --git a/.github/actions/test/integration/build/action.yml b/.github/actions/test/integration/build/action.yml
index adcf018c..ed2ef17b 100644
--- a/.github/actions/test/integration/build/action.yml
+++ b/.github/actions/test/integration/build/action.yml
@@ -7,20 +7,48 @@ inputs:
runs:
using: "composite"
steps:
+ - name: Install oras
+ uses: oras-project/setup-oras@ac735097e22fe643015b0d19645f7c9a69942128 # v2
+ with:
+ version: 1.2.2
+
+ - name: Install butane
+ shell: bash
+ run: |
+ BUTANE_VERSION="0.29.0"
+ curl -LO "https://github.com/coreos/butane/releases/download/v${BUTANE_VERSION}/butane-x86_64-unknown-linux-gnu"
+ chmod +x "butane-x86_64-unknown-linux-gnu"
+ sudo mv "butane-x86_64-unknown-linux-gnu" /usr/local/bin/butane
+
# TODO https://github.com/actions/cache
- name: Set ENV
shell: bash
env:
- REPO: ghcr.io/gardenlinux/gardenlinux-ccloud
+ REPO: ghcr.io/gardenlinux/gardenlinux-sci
TAG: ${{ inputs.image_tag }}
ESP_SIZE: 2 # GiB
DISK_SIZE: 8 # GiB
- run: |
+ run: | # zizmor: ignore[github-env] TAG is validated; remaining values are constants.
+ if ! [[ "$TAG" =~ ^[a-zA-Z0-9_][a-zA-Z0-9_.-]{0,127}$ ]]; then
+ echo "Error: image_tag must be a valid OCI tag" >&2
+ exit 1
+ fi
echo "REPO=$REPO" >> $GITHUB_ENV
echo "TAG=$TAG" >> $GITHUB_ENV
echo "ESP_SIZE=$ESP_SIZE" >> $GITHUB_ENV
echo "DISK_SIZE=$DISK_SIZE" >> $GITHUB_ENV
+ - name: Validate image tag
+ shell: bash
+ run: |
+ echo "Verifying image $TAG exists in GHCR..."
+ if ! digest=$(oras resolve "$REPO:$TAG" 2>&1); then
+ echo "Error: Image tag '$TAG' not found in $REPO"
+ echo "Resolve output: $digest"
+ exit 1
+ fi
+ echo "Image tag present in GHCR (digest: ${digest:0:12}...)"
+
- name: Pull ORAS artifacts
shell: bash
run: |
@@ -38,7 +66,7 @@ runs:
- name: Set up a raw disk image
shell: bash
- run: |
+ run: | # zizmor: ignore[github-env] Paths derive from validated TAG, runner metadata, and losetup.
ESP_END="${ESP_SIZE}GiB"
DISK_IMG="${RUNNER_TEMP}/${TAG}.img"
echo "DISK_IMG=$DISK_IMG" >> $GITHUB_ENV
@@ -95,38 +123,53 @@ runs:
- name: Generate ignition
shell: bash
run: |
- ssh-keygen -t ed25519 -f "/opt/ssh_host_ed25519_key" -N "" -C "user" -q
- chmod 600 /opt/ssh_host_ed25519_key
- SSH_KEY=$(cat /opt/ssh_host_ed25519_key.pub)
- echo "SSH_KEY=$SSH_KEY" >> $GITHUB_ENV
- sed -i "s|SSH_KEY_GOES_HERE|$SSH_KEY|g" ./.github/actions/test/integration/build/dev-user-butane.yaml
+ set -Eeuo pipefail
+ : "${SSH_KEY:?the shared test SSH key is not set}"
+ : "${TAG:?the image tag is not set}"
+
+ # The hypervisor root password belongs to this image, so derive it here
+ # instead of importing the one the nested guest uses.
PASSWORD=$(openssl passwd "password")
- echo "PASSWORD=$PASSWORD" >> $GITHUB_ENV
- sed -i "s|PASSWORD_GOES_HERE|$PASSWORD|g" ./.github/actions/test/integration/build/dev-user-butane.yaml
- sed -i "s|TAG_GOES_HERE|${{ inputs.image_tag }}|g" ./.github/actions/test/integration/build/dev-user-butane.yaml
- butane --pretty --strict ./.github/actions/test/integration/build/dev-user-butane.yaml > "/opt/${TAG}.ign"
+ export PASSWORD
- - name: Download ubuntu cloud image
- shell: bash
- run: |
- wget -q "https://cloud-images.ubuntu.com/minimal/releases/noble/release/ubuntu-24.04-minimal-cloudimg-amd64.img" -O /opt/ubuntu.qcow2
+ envsubst '${SSH_KEY} ${PASSWORD} ${TAG}' \
+ < ./.github/actions/test/integration/build/dev-user-butane.yaml \
+ > ./.github/actions/test/integration/build/dev-user-butane-hv1.yaml
- - name: Generate raw ubuntu image for CHV
- shell: bash
- run: |
- qemu-img convert -p -f qcow2 -O raw /opt/ubuntu.qcow2 /opt/ubuntu.raw
+ yq '.storage.files += load("./.github/actions/test/integration/build/root-hints.yaml")' ./.github/actions/test/integration/build/dev-user-butane.yaml \
+ | envsubst '${SSH_KEY} ${PASSWORD} ${TAG}' \
+ > ./.github/actions/test/integration/build/dev-user-butane-hv2.yaml
+
+ butane --pretty --strict ./.github/actions/test/integration/build/dev-user-butane-hv1.yaml > "/opt/${TAG}-hv1.ign"
+ butane --pretty --strict ./.github/actions/test/integration/build/dev-user-butane-hv2.yaml > "/opt/${TAG}-hv2.ign"
- - name: Generate ubuntu cloud-init
+ - name: Prepare the HyperVisor directory
shell: bash
run: |
- sed -i "s|SSH_KEY_GOES_HERE|$SSH_KEY|g" ./.github/actions/test/integration/build/user-data
- sed -i "s|PASSWORD_GOES_HERE|$PASSWORD|g" ./.github/actions/test/integration/build/user-data
- genisoimage -output /opt/ubuntu-cloud-init-ds.iso -volid cidata -joliet -rock ./.github/actions/test/integration/build/meta-data ./.github/actions/test/integration/build/user-data
+ set -Eeuo pipefail
+ HV_DIR=/opt/hv
+ KEY=/opt/ssh_host_ed25519_key
+ [ -s "$KEY" ] || { echo "the shared test SSH key is missing: $KEY" >&2; exit 1; }
+
+ install -d "$HV_DIR"
+ sudo install -m 0644 "/opt/${TAG}.qcow2" /var/lib/libvirt/images/HV1.qcow2
+ sudo install -m 0644 "/opt/${TAG}.qcow2" /var/lib/libvirt/images/HV2.qcow2
+ sudo install -m 0644 "/opt/${TAG}-hv1.ign" /var/lib/libvirt/images/HV1.ign
+ sudo install -m 0644 "/opt/${TAG}-hv2.ign" /var/lib/libvirt/images/HV2.ign
+
+ render_hv() {
+ local name=$1 mac=$2
+ HV_NAME=$name MAC=$mac NETWORK=${HV_NETWORK:-default} \
+ envsubst '${HV_NAME} ${MAC} ${NETWORK}' \
+ < ./.github/actions/test/integration/build/hv.xml > "$HV_DIR/$name.xml"
+ }
+ render_hv HV1 52:54:00:12:34:56
+ render_hv HV2 52:54:00:65:43:21
# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# with:
- # name: gardenlinux-ccloud-${{ inputs.image_tag }}
+ # name: gardenlinux-sci-${{ inputs.image_tag }}
# path: /opt/${{ inputs.image_tag }}.*
# retention-days: 1
# overwrite: true
diff --git a/.github/actions/test/integration/build/dev-user-butane.yaml b/.github/actions/test/integration/build/dev-user-butane.yaml
index b8486454..04cec9c1 100644
--- a/.github/actions/test/integration/build/dev-user-butane.yaml
+++ b/.github/actions/test/integration/build/dev-user-butane.yaml
@@ -1,9 +1,9 @@
variant: fcos
-version: 1.3.0
+version: 1.7.0
passwd:
users:
- name: root
- password_hash: "PASSWORD_GOES_HERE"
+ password_hash: "${PASSWORD}"
storage:
files:
- path: /etc/ssh/sshd_config
@@ -20,7 +20,7 @@ storage:
- path: /etc/ssh/authorized_keys
mode: 0600
contents:
- inline: "SSH_KEY_GOES_HERE"
+ inline: "${SSH_KEY}"
- path: /etc/hosts
mode: 0644
overwrite: true
@@ -37,12 +37,6 @@ storage:
# custom
192.168.122.2 hv1
192.168.122.3 hv2
- - path: /opt/persist/root-hints.yaml
- mode: 0644
- contents:
- inline: |
- hints:
- - size: lt 500G
# turn off hugepages, not required for this test
# also SIGNIFICANTLY reduces test runtime
- path: /opt/persist/hugepages.env
@@ -55,9 +49,9 @@ storage:
contents:
inline: |
# pull the image from GHCR instead of keppel
- OCI_REPO=ghcr.io/gardenlinux/gardenlinux-ccloud
+ OCI_REPO=ghcr.io/gardenlinux/gardenlinux-sci
# point to a custom tag to download for the persist step
- OCI_TAG=TAG_GOES_HERE
+ OCI_TAG=${TAG}
# Enable unlimited core dumps for all systemd services
- path: /etc/systemd/system.conf.d/10-core.conf
mode: 0644
@@ -85,3 +79,10 @@ storage:
kernel.core_pattern=|/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h
kernel.core_pipe_limit=16
fs.suid_dumpable=2
+# Disable libvirt sockets not required for CI tests
+systemd:
+ units:
+ - name: libvirtd-tls.socket
+ mask: true
+ - name: libvirtd-tcp.socket
+ mask: true
diff --git a/.github/actions/test/integration/setup/hv.xml b/.github/actions/test/integration/build/hv.xml
similarity index 53%
rename from .github/actions/test/integration/setup/hv.xml
rename to .github/actions/test/integration/build/hv.xml
index 90ab559f..a38a9fc4 100644
--- a/.github/actions/test/integration/setup/hv.xml
+++ b/.github/actions/test/integration/build/hv.xml
@@ -1,7 +1,12 @@
- HV_NAME_GOES_HERE
+ ${HV_NAME}
6
- 4
+
+
+
+
+
+ 2
hvm
/usr/share/OVMF/OVMF_CODE_4M.fd
@@ -14,24 +19,31 @@
-
-
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
+
diff --git a/.github/actions/test/integration/build/meta-data b/.github/actions/test/integration/build/meta-data
deleted file mode 100644
index 2162682c..00000000
--- a/.github/actions/test/integration/build/meta-data
+++ /dev/null
@@ -1,2 +0,0 @@
-instance-id: test-instance
-local-hostname: VM
diff --git a/.github/actions/test/integration/build/root-hints.yaml b/.github/actions/test/integration/build/root-hints.yaml
new file mode 100644
index 00000000..59159664
--- /dev/null
+++ b/.github/actions/test/integration/build/root-hints.yaml
@@ -0,0 +1,6 @@
+- path: /opt/persist/root-hints.yaml
+ mode: 0644
+ contents:
+ inline: |
+ hints:
+ - size: lt 500G
diff --git a/.github/actions/test/integration/build/user-data b/.github/actions/test/integration/build/user-data
deleted file mode 100644
index ad3e3d92..00000000
--- a/.github/actions/test/integration/build/user-data
+++ /dev/null
@@ -1,18 +0,0 @@
-#cloud-config
-users:
- - name: root
- shell: /bin/bash
- ssh_authorized_keys:
- - "SSH_KEY_GOES_HERE"
- hashed_passwd: "PASSWORD_GOES_HERE"
-
-disable_root: false
-
-network:
- version: 2
- ethernets:
- all-interfaces:
- match:
- name: "*"
- dhcp4: true
- dhcp6: true
diff --git a/.github/actions/test/integration/collect-logs/action.yml b/.github/actions/test/integration/collect-logs/action.yml
index 0974c811..533bc31f 100644
--- a/.github/actions/test/integration/collect-logs/action.yml
+++ b/.github/actions/test/integration/collect-logs/action.yml
@@ -6,6 +6,9 @@ runs:
- name: Obtain logs from test runner
shell: bash
run: |
+ # Required from the job environment; the shared key is the identity
+ # that the ssh config names.
+ [ -s /opt/ssh_host_ed25519_key ] || { echo "the shared SSH key /opt/ssh_host_ed25519_key is missing" >&2; exit 1; }
sudo lscpu > lscpu-RUNNER.log || true
sudo lshw > lshw-runner.log || true
sudo journalctl --no-pager > journal-RUNNER.log || true
@@ -13,43 +16,75 @@ runs:
sudo cp /var/log/libvirt/qemu/HV1.log "libvirt-HV1.log" || true
sudo cp /var/log/libvirt/qemu/HV2.log "libvirt-HV2.log" || true
+ # The HV serial consoles: the only record of a frozen guest's
+ # final kernel output (the journal goes down with the guest).
+ sudo cp /var/log/HV1.log "serial-HV1.log" || true
+ sudo cp /var/log/HV2.log "serial-HV2.log" || true
+
- name: Obtain logs from hypervisors
shell: bash
run: |
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
HV1_IP="192.168.122.2"
HV2_IP="192.168.122.3"
- ssh $SSH_OPTS $USER@$HV1_IP "journalctl --no-pager" > "journal-HV1.log" || true
- scp $SSH_OPTS $USER@$HV1_IP:/var/log/libvirt/qemu/VM-QEMU.log "libvirt-VM-QEMU-HV1.log" || true
- scp $SSH_OPTS $USER@$HV1_IP:/var/log/libvirt/ch/VM-CHV.log "libvirt-VM-CHV-HV1.log" || true
- scp $SSH_OPTS $USER@$HV1_IP:/var/log/QEMU.log "serial-VM-QEMU-HV1.log" || true
- scp $SSH_OPTS $USER@$HV1_IP:/var/log/CHV.log "serial-VM-CHV-HV1.log" || true
+ ssh "$HV1_IP" "journalctl --no-pager" > "journal-HV1.log" || true
+ scp "$HV1_IP:/var/log/libvirt/qemu/VM-QEMU.log" "libvirt-VM-QEMU-HV1.log" || true
+ scp "$HV1_IP:/var/log/libvirt/ch/VM-CHV.log" "libvirt-VM-CHV-HV1.log" || true
+ scp "$HV1_IP:/var/log/QEMU.log" "serial-VM-QEMU-HV1.log" || true
+ scp "$HV1_IP:/var/log/CHV.log" "serial-VM-CHV-HV1.log" || true
+
+ ssh "$HV2_IP" "journalctl --no-pager" > "journal-HV2.log" || true
+ scp "$HV2_IP:/var/log/libvirt/qemu/VM-QEMU.log" "libvirt-VM-QEMU-HV2.log" || true
+ scp "$HV2_IP:/var/log/libvirt/ch/VM-CHV.log" "libvirt-VM-CHV-HV2.log" || true
+ scp "$HV2_IP:/var/log/QEMU.log" "serial-VM-QEMU-HV2.log" || true
+ scp "$HV2_IP:/var/log/CHV.log" "serial-VM-CHV-HV2.log" || true
+
+ - name: Obtain network diagnostics from hypervisors
+ shell: bash
+ run: |
+ for HV_NAME in HV1 HV2; do
+ IP="192.168.122.$([[ $HV_NAME == HV1 ]] && echo 2 || echo 3)"
- ssh $SSH_OPTS $USER@$HV2_IP "journalctl --no-pager" > "journal-HV2.log" || true
- scp $SSH_OPTS $USER@$HV2_IP:/var/log/libvirt/qemu/VM-QEMU.log "libvirt-VM-QEMU-HV2.log" || true
- scp $SSH_OPTS $USER@$HV2_IP:/var/log/libvirt/ch/VM-CHV.log "libvirt-VM-CHV-HV2.log" || true
- scp $SSH_OPTS $USER@$HV2_IP:/var/log/QEMU.log "serial-VM-QEMU-HV2.log" || true
- scp $SSH_OPTS $USER@$HV2_IP:/var/log/CHV.log "serial-VM-CHV-HV2.log" || true
+ ssh "$IP" "
+ echo '=== ip addr ==='
+ ip addr
+ echo '=== ip route ==='
+ ip route
+ echo '=== bridge link ==='
+ bridge link 2>/dev/null || true
+ echo '=== arp -n ==='
+ arp -n 2>/dev/null || ip neigh || true
+ echo '=== iptables -L -n ==='
+ iptables -L -n 2>/dev/null || true
+ echo '=== iptables -t nat -L -n ==='
+ iptables -t nat -L -n 2>/dev/null || true
+ echo '=== virsh net-list ==='
+ virsh net-list --all 2>/dev/null || true
+ echo '=== virsh net-dumpxml default ==='
+ virsh net-dumpxml default 2>/dev/null || true
+ echo '=== dnsmasq leases ==='
+ cat /var/lib/libvirt/dnsmasq/*.leases 2>/dev/null || true
+ echo '=== systemctl status systemd-networkd ==='
+ systemctl status systemd-networkd --no-pager 2>/dev/null || true
+ echo '=== networkctl status ==='
+ networkctl status --no-pager 2>/dev/null || true
+ echo '=== ssh -V ==='
+ ssh -V 2>&1 || true
+ " > "network-diag-${HV_NAME}.log" 2>&1 || true
+ done
- name: Set permissions
shell: bash
run: |
- sudo chmod 644 *.log
+ sudo chmod 644 *.log || true
- name: Collect coredumps from hypervisors
shell: bash
run: |
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
-
for HV_NAME in HV1 HV2; do
IP="192.168.122.$([[ $HV_NAME == HV1 ]] && echo 2 || echo 3)"
- ssh $SSH_OPTS $USER@$IP "
+ ssh "$IP" "
# Only proceed if coredumps exist
if coredumpctl list --no-legend 2>/dev/null | grep -q .; then
mkdir -p /tmp/coredumps-$HV_NAME
@@ -63,19 +98,19 @@ runs:
fi
" || true
- if ssh $SSH_OPTS $USER@$IP "[ -d /tmp/coredumps-$HV_NAME ] && [ -n \"\$(ls /tmp/coredumps-$HV_NAME 2>/dev/null)\" ]"; then
- scp -r $SSH_OPTS $USER@$IP:/tmp/coredumps-$HV_NAME ./ || true
+ if ssh "$IP" "[ -d /tmp/coredumps-$HV_NAME ] && [ -n \"\$(ls /tmp/coredumps-$HV_NAME 2>/dev/null)\" ]"; then
+ scp -r "$IP:/tmp/coredumps-$HV_NAME" ./ || true
fi
done
- name: Upload debug logs
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: debug-logs
path: "*.log"
- name: Upload coredumps (if any exist)
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: ${{ hashFiles('coredumps-*/**') != '' }}
with:
name: coredumps
diff --git a/.github/actions/test/integration/dependencies/action.yml b/.github/actions/test/integration/dependencies/action.yml
index e1923df9..6e549039 100644
--- a/.github/actions/test/integration/dependencies/action.yml
+++ b/.github/actions/test/integration/dependencies/action.yml
@@ -16,6 +16,7 @@ runs:
libvirt-clients \
virtinst \
bridge-utils \
+ virtiofsd \
ovmf
# Required for storing the ignition file in /var/lib/libvirt/images
@@ -26,15 +27,8 @@ runs:
echo 'security_driver = "none"' | sudo tee -a /etc/libvirt/qemu.conf
sudo systemctl restart libvirtd
- - name: oras
- uses: oras-project/setup-oras@v1
- with:
- version: 1.2.2
-
- - name: butane
+ # The libvirt qemu user must reach /dev/kvm for the hypervisor VMs.
+ - name: Make /dev/kvm accessible
shell: bash
run: |
- BUTANE_VERSION="0.24.0"
- curl -LO "https://github.com/coreos/butane/releases/download/v${BUTANE_VERSION}/butane-x86_64-unknown-linux-gnu"
- chmod +x "butane-x86_64-unknown-linux-gnu"
- sudo mv "butane-x86_64-unknown-linux-gnu" /usr/local/bin/butane
+ if [ -e /dev/kvm ]; then sudo chmod 666 /dev/kvm; fi
diff --git a/.github/actions/test/integration/guest/action.yml b/.github/actions/test/integration/guest/action.yml
new file mode 100644
index 00000000..d391eaac
--- /dev/null
+++ b/.github/actions/test/integration/guest/action.yml
@@ -0,0 +1,51 @@
+name: guest
+description: Build the CirrOS test guest and the shared test SSH identity
+runs:
+ using: "composite"
+ steps:
+ - name: Generate the test SSH key
+ shell: bash
+ run: | # zizmor: ignore[github-env] Generated key and password hash are single-line values.
+ ssh-keygen -t ed25519 -f "/opt/ssh_host_ed25519_key" -N "" -C "user" -q
+ chmod 600 /opt/ssh_host_ed25519_key
+ SSH_KEY=$(cat /opt/ssh_host_ed25519_key.pub)
+ echo "SSH_KEY=$SSH_KEY" >> $GITHUB_ENV
+
+ - name: Download the CirrOS test image
+ shell: bash
+ run: |
+ set -Eeuo pipefail
+ URL="https://download.cirros-cloud.net/0.6.3/cirros-0.6.3-x86_64-disk.img"
+ SHA256="7d6355852aeb6dbcd191bcda7cd74f1536cfe5cbf8a10495a7283a8396e4b75b"
+
+ wget -q "$URL" -O /opt/cirros.qcow2
+ echo "$SHA256 /opt/cirros.qcow2" | sha256sum -c -
+
+ - name: Generate raw CirrOS image for CHV
+ shell: bash
+ run: |
+ qemu-img convert -p -f qcow2 -O raw /opt/cirros.qcow2 /opt/cirros.raw
+
+ - name: Generate the CirrOS cloud-init seed
+ shell: bash
+ run: |
+ set -Eeuo pipefail
+ : "${SSH_KEY:?the shared test SSH key is not set}"
+
+ RENDER_DIR=$(mktemp -d)
+ trap 'rm -rf "$RENDER_DIR"' EXIT
+ envsubst '${SSH_KEY}' \
+ < ./.github/actions/test/integration/guest/user-data \
+ > "$RENDER_DIR/user-data"
+ genisoimage -output /opt/cirros-cloud-init-ds.iso -volid cidata -joliet -rock ./.github/actions/test/integration/guest/meta-data "$RENDER_DIR/user-data"
+
+ - name: Export the shared guest files
+ shell: bash
+ run: |
+ # Keep the existing /opt outputs. Hard links expose only the raw disk
+ # and seed to virtiofs, without copying them or exporting the SSH key.
+ install -d -m 0755 /opt/guest-images
+ chmod 0666 /opt/cirros.raw
+ chmod 0644 /opt/cirros-cloud-init-ds.iso
+ ln /opt/cirros.raw /opt/guest-images/cirros.raw
+ ln /opt/cirros-cloud-init-ds.iso /opt/guest-images/cirros-cloud-init-ds.iso
diff --git a/.github/actions/test/integration/guest/meta-data b/.github/actions/test/integration/guest/meta-data
new file mode 100644
index 00000000..690df252
--- /dev/null
+++ b/.github/actions/test/integration/guest/meta-data
@@ -0,0 +1,4 @@
+{
+ "instance-id": "test-instance",
+ "local-hostname": "VM"
+}
diff --git a/.github/actions/test/integration/guest/user-data b/.github/actions/test/integration/guest/user-data
new file mode 100644
index 00000000..ae5c88e2
--- /dev/null
+++ b/.github/actions/test/integration/guest/user-data
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -eu
+
+# CirrOS' NoCloud datasource executes user-data as a shell script; it does not
+# run cloud-init. Install the shared test key for the default cirros user.
+home=/home/cirros
+mkdir -p "$home/.ssh"
+printf '%s\n' '${SSH_KEY}' > "$home/.ssh/authorized_keys"
+chown -R cirros:cirros "$home/.ssh"
+chmod 700 "$home/.ssh"
+chmod 600 "$home/.ssh/authorized_keys"
diff --git a/.github/actions/test/integration/prepare/action.yml b/.github/actions/test/integration/prepare/action.yml
new file mode 100644
index 00000000..d7336783
--- /dev/null
+++ b/.github/actions/test/integration/prepare/action.yml
@@ -0,0 +1,10 @@
+name: prepare
+description: Install the integration test dependencies and build the test guest
+runs:
+ using: "composite"
+ steps:
+ - name: Install Dependencies
+ uses: ./.github/actions/test/integration/dependencies
+ # The build steps consume the SSH identity this step generates.
+ - name: Prepare the test guest
+ uses: ./.github/actions/test/integration/guest
diff --git a/.github/actions/test/integration/setup/action.yml b/.github/actions/test/integration/setup/action.yml
index 915b282b..74d51add 100644
--- a/.github/actions/test/integration/setup/action.yml
+++ b/.github/actions/test/integration/setup/action.yml
@@ -3,109 +3,108 @@ description: Set up Hypervisor and VM Environment for Integration Tests
runs:
using: "composite"
steps:
- - name: Configure the default libvirt network
+ - name: Write the shared SSH configuration
shell: bash
run: |
- sudo virsh net-destroy default
- sudo virsh net-undefine default
- sudo virsh net-define ./.github/actions/test/integration/setup/virbr-hv.xml
- sudo virsh net-start default
- sudo virsh net-autostart default
+ # The boot step below copies the key to this path; the later steps
+ # rely on the matching Host block instead of repeating the options.
+ mkdir -p ~/.ssh
+ chmod 700 ~/.ssh
+ cat > ~/.ssh/config <<'EOF'
+ Host 192.168.122.*
+ IdentityFile /opt/ssh_host_ed25519_key
+ IdentitiesOnly yes
+ StrictHostKeyChecking no
+ UserKnownHostsFile /dev/null
+ ConnectTimeout 10
+ ServerAliveInterval 15
+ ServerAliveCountMax 4
+ User root
- - name: Copy ignition file
- shell: bash
- run: |
- sudo cp "/opt/${TAG}.ign" /var/lib/libvirt/images/hv.ign
-
- - name: Create HyperVisor 1
- shell: bash
- run: |
- cp ./.github/actions/test/integration/setup/hv.xml ./.github/actions/test/integration/setup/hv1.xml
- sed -i "s|HV_NAME_GOES_HERE|HV1|g" ./.github/actions/test/integration/setup/hv1.xml
- sed -i "s|MAC_GOES_HERE|52:54:00:12:34:56|g" ./.github/actions/test/integration/setup/hv1.xml
- sudo cp "/opt/${TAG}.qcow2" /var/lib/libvirt/images/HV1.qcow2
-
- sudo virsh define ./.github/actions/test/integration/setup/hv1.xml
- sudo virsh start HV1
-
- - name: Create HyperVisor 2
- shell: bash
- run: |
- cp ./.github/actions/test/integration/setup/hv.xml ./.github/actions/test/integration/setup/hv2.xml
- sed -i "s|HV_NAME_GOES_HERE|HV2|g" ./.github/actions/test/integration/setup/hv2.xml
- sed -i "s|MAC_GOES_HERE|52:54:00:65:43:21|g" ./.github/actions/test/integration/setup/hv2.xml
- sudo cp "/opt/${TAG}.qcow2" /var/lib/libvirt/images/HV2.qcow2
-
- sudo virsh define ./.github/actions/test/integration/setup/hv2.xml
- sudo virsh start HV2
+ Host 192.168.222.*
+ IdentityFile /opt/ssh_host_ed25519_key
+ IdentitiesOnly yes
+ StrictHostKeyChecking no
+ UserKnownHostsFile /dev/null
+ ConnectTimeout 10
+ ServerAliveInterval 15
+ ServerAliveCountMax 4
+ User cirros
+ EOF
+ chmod 600 ~/.ssh/config
- - name: Configure SSH and libvirt on HyperVisors
+ - name: Boot the HyperVisors and configure the guests
shell: bash
run: |
+ set -Eeuo pipefail
+ HV_DIR=/opt/hv
KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
- MAX_ITER=30
-
- setup_hv() {
- local IP="$1"
-
- # Configure SSH between HyperVisors
- scp $SSH_OPTS /opt/ssh_host_ed25519_key "$USER@$IP:/opt/ssh_host_ed25519_key"
- ssh $SSH_OPTS "$USER@$IP" << EOF
- chmod 700 /root/.ssh
- echo "" > /root/.ssh/config
- echo "Host 192.168.122.*" >> /root/.ssh/config
- echo " StrictHostKeyChecking no" >> /root/.ssh/config
- echo " UserKnownHostsFile /dev/null" >> /root/.ssh/config
- echo " IdentityFile /opt/ssh_host_ed25519_key" >> /root/.ssh/config
- echo " IdentitiesOnly yes" >> /root/.ssh/config
- echo " User root" >> /root/.ssh/config
- chmod 600 /root/.ssh/config
- chmod 600 /opt/ssh_host_ed25519_key
- EOF
-
- # Set up libvirt storage pool and network
- scp $SSH_OPTS ./.github/actions/test/integration/setup/virbr-vm.xml "$USER@$IP:/opt/virbr-vm.xml"
- ssh $SSH_OPTS "$USER@$IP" << EOF
- systemctl start libvirtd
+ [ -s "$KEY" ] && [ -f "$KEY" ] \
+ || { echo "the shared test SSH key is missing: $KEY" >&2; exit 1; }
+ [ -s "$HV_DIR/HV1.xml" ] && [ -s "$HV_DIR/HV2.xml" ] \
+ || { echo "the hypervisor directory lacks HV1.xml or HV2.xml: $HV_DIR" >&2; exit 1; }
- virsh pool-destroy default || true
- virsh pool-undefine default || true
- virsh pool-define-as default dir --target /var/lib/libvirt/images
- virsh pool-build default
- virsh pool-start default
- virsh pool-autostart default
+ NETWORK=${HV_NETWORK:-default}
- virsh net-destroy default || true
- virsh net-undefine default || true
- virsh net-define /opt/virbr-vm.xml
- virsh net-start default
- virsh net-autostart default
- EOF
+ # virsh net-info also succeeds for a defined network that is inactive,
+ # so decide on its Active field, not on the exit status alone.
+ if ! net_info=$(sudo virsh net-info "$NETWORK" 2>/dev/null); then
+ [ "$NETWORK" = default ] \
+ || { echo "the libvirt network $NETWORK does not exist; only default may be defined from virbr-hv.xml" >&2; exit 1; }
+ sudo virsh net-define ./.github/actions/test/integration/setup/virbr-hv.xml
+ sudo virsh net-start "$NETWORK"
+ else
+ active=$(printf '%s\n' "$net_info" | awk '$1 == "Active:" { print $2 }')
+ [ -n "$active" ] \
+ || { echo "cannot read the Active state of the libvirt network $NETWORK" >&2; exit 1; }
+ if [ "$active" = no ]; then
+ sudo virsh net-start "$NETWORK"
+ elif [ "$active" != yes ]; then
+ echo "unexpected Active state '$active' for the libvirt network $NETWORK" >&2
+ exit 1
+ fi
+ fi
+ add_host() {
+ sudo virsh net-dumpxml "$NETWORK" | grep -q "mac='$1'" \
+ || sudo virsh net-update "$NETWORK" add ip-dhcp-host "" --live --config
}
+ add_host 52:54:00:12:34:56 192.168.122.2 hv1
+ add_host 52:54:00:65:43:21 192.168.122.3 hv2
- wait_for_ssh() {
- local VM_NAME="$1"
-
- for ((i=1; i<=MAX_ITER; i++)); do
- local IP=$(sudo virsh domifaddr "$VM_NAME" | awk '/ipv4/ {print $4}' | cut -d'/' -f1)
- if [ -z "$IP" ]; then
- echo "No IP address found for $VM_NAME. Retrying..."
- elif ssh $SSH_OPTS "$USER@$IP" 'exit' 2>/dev/null; then
- echo "$VM_NAME is up at IP: $IP"
- setup_hv "$IP"
- break
- fi
- if (( i == MAX_ITER )); then
- echo "Timeout waiting for $VM_NAME to respond to SSH."
- sudo cat "/var/log/$VM_NAME.log"
- exit 1
- fi
- echo "Waiting for $VM_NAME to respond to SSH... ($i/$MAX_ITER)"
- sleep 10
+ for spec in "HV1 192.168.122.2" "HV2 192.168.122.3"; do
+ set -- $spec
+ name=$1
+ ip=$2
+ sudo virsh dominfo "$name" >/dev/null 2>&1 && { echo "refusing to replace a pre-existing domain: $name" >&2; exit 1; }
+ sudo virsh define "$HV_DIR/$name.xml"
+ sudo virsh start "$name"
+ for ((t=1; t<=60; t++)); do
+ ssh "$ip" true 2>/dev/null && break
+ [ "$t" -lt 60 ] || { echo "timeout waiting for $name to respond to SSH" >&2; sudo cat "/var/log/$name.log" || true; exit 1; }
+ sleep 5
done
- }
-
- wait_for_ssh HV1
- wait_for_ssh HV2
+ scp -q "$KEY" "$ip:/opt/ssh_host_ed25519_key"
+ scp -q "$HOME/.ssh/config" "$ip:/root/.ssh/config"
+ scp -q ./.github/actions/test/integration/setup/virbr-vm.xml "$ip:/opt/virbr-vm.xml"
+ ssh "$ip" "bash -s" <<'EOF'
+ set -Eeuo pipefail
+ chmod 700 /root/.ssh
+ chmod 600 /root/.ssh/config /opt/ssh_host_ed25519_key
+ mkdir -p /var/log/libvirt/ch
+ # Preserve the domain disk paths without mounting over the local
+ # QEMU storage pool: only the CH raw disk and seed are shared.
+ mkdir -p /var/lib/libvirt/images/shared
+ mountpoint -q /var/lib/libvirt/images/shared || mount -t virtiofs guest-images /var/lib/libvirt/images/shared
+ ln -s shared/cirros.raw /var/lib/libvirt/images/cirros.raw
+ ln -s shared/cirros-cloud-init-ds.iso /var/lib/libvirt/images/cirros-cloud-init-ds.iso
+ systemctl start libvirtd
+ virsh pool-destroy default || true
+ virsh pool-undefine default || true
+ virsh pool-define-as default dir --target /var/lib/libvirt/images
+ virsh pool-build default; virsh pool-start default; virsh pool-autostart default
+ virsh net-destroy default || true
+ virsh net-undefine default || true
+ virsh net-define /opt/virbr-vm.xml
+ virsh net-start default; virsh net-autostart default
+ EOF
+ done
diff --git a/.github/actions/test/integration/test/cloudhypervisor/action.yml b/.github/actions/test/integration/test/cloudhypervisor/action.yml
deleted file mode 100644
index f3eeabc8..00000000
--- a/.github/actions/test/integration/test/cloudhypervisor/action.yml
+++ /dev/null
@@ -1,132 +0,0 @@
-name: test-cloudhypervisor
-description: Execute Integration Tests for Hypervisor Capabilities (CloudHyperVisor)
-runs:
- using: "composite"
- steps:
- - name: Copy VM defintions and artifacts to the HyperVisors
- shell: bash
- run: |
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
- IP_HV1="192.168.122.2"
- IP_HV2="192.168.122.3"
-
- scp $SSH_OPTS ./.github/actions/test/integration/test/cloudhypervisor/vm.xml "$USER@$IP_HV1:/opt/vm-chv.xml"
- scp $SSH_OPTS /opt/ubuntu.raw "$USER@$IP_HV1:/var/lib/libvirt/images/ubuntu.raw"
- scp $SSH_OPTS /opt/ubuntu-cloud-init-ds.iso "$USER@$IP_HV1:/var/lib/libvirt/images/ubuntu-cloud-init-ds.iso"
-
- # libvirt migration between cloudhypervisor instances does not support storage migration yet
- scp $SSH_OPTS /opt/ubuntu.raw "$USER@$IP_HV2:/var/lib/libvirt/images/ubuntu.raw"
- # the cloud-init data is not migrated from source to destination, but needed for the VM to run at the destination
- scp $SSH_OPTS /opt/ubuntu-cloud-init-ds.iso "$USER@$IP_HV2:/var/lib/libvirt/images/ubuntu-cloud-init-ds.iso"
-
- - name: Start VM on HyperVisor 1
- shell: bash
- run: |
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
- IP_HV1="192.168.122.2"
-
- ssh $SSH_OPTS "$USER@$IP_HV1" << EOF
- virsh -c ch:///session define /opt/vm-chv.xml
- virsh -c ch:///session start VM-CHV
- EOF
-
- - name: Wait for VM to be ready
- shell: bash
- run: |
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
- IP_HV1="192.168.122.2"
-
- ssh $SSH_OPTS "$USER@$IP_HV1" << EOF
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i \$KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
-
- MAX_ITER=60
- for ((i=1; i<=MAX_ITER; i++)); do
- IP=\$(virsh -c ch:///session domifaddr VM-CHV | awk '/ipv4/ {print \$4}' | cut -d'/' -f1)
- if [ -z "\$IP" ]; then
- echo "No IP address found for VM. Retrying..."
- elif ssh \$SSH_OPTS "\$USER@\$IP" 'exit' ; then
- echo "VM is up at IP: \$IP"
- # create a dummy file for verification later
- ssh \$SSH_OPTS "\$USER@\$IP" 'echo "Hello, World!" > /opt/hello.txt'
- break
- fi
- if (( i == MAX_ITER )); then
- echo "Timeout waiting for VM to respond to SSH."
- exit 1
- fi
- echo "Waiting for VM to respond to SSH... (\$i/\$MAX_ITER)"
- sleep 10
- done
- EOF
-
- - name: Mirgrate the VM to HyperVisor 2
- shell: bash
- run: |
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
- IP_HV1="192.168.122.2"
-
- ssh $SSH_OPTS "$USER@$IP_HV1" << EOF
- USER="root"
- IP_HV2="192.168.122.3"
-
- virsh -c ch:///session migrate --p2p --persistent --undefinesource --live VM-CHV ch+ssh://\$USER@\$IP_HV2/system
- if virsh -c ch:///session dominfo VM-CHV &>/dev/null; then
- echo "VM is still present on HV1 after migration!"
- exit 1
- fi
- EOF
-
- - name: Verify VM status on HyperVisor 2
- shell: bash
- run: |
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
- IP_HV2="192.168.122.3"
-
- ssh $SSH_OPTS "$USER@$IP_HV2" << EOF
- if virsh -c ch:///session dominfo VM-CHV | awk '/State:/ {print \$2}' | grep -q "running"; then
- echo "VM is running on HV2."
- else
- echo "VM is not running on HV2."
- exit 1
- fi
-
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i \$KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
- # waiting for the IP to be visible to the new HyperVisor via DHCP takes WAYYYYYYY too long
- # the IP is static, so we can just use it directly
- IP="192.168.222.3"
-
- MAX_ITER=15
- for ((i=1; i<=MAX_ITER; i++)); do
- if ssh \$SSH_OPTS "\$USER@\$IP" 'exit' ; then
- echo "VM is up at IP: \$IP"
- # verify the migration by checking the dummy file
- if ssh \$SSH_OPTS "\$USER@\$IP" 'test -f /opt/hello.txt'; then
- echo "Dummy file exists on VM, migration successful."
- break
- else
- echo "Dummy file does not exist on VM, migration failed."
- exit 1
- fi
- fi
- if (( i == MAX_ITER )); then
- echo "Timeout waiting for VM to respond to SSH."
- exit 1
- fi
- echo "Waiting for VM to respond to SSH... (\$i/\$MAX_ITER)"
- sleep 10
- done
- EOF
diff --git a/.github/actions/test/integration/test/migrate/action.yml b/.github/actions/test/integration/test/migrate/action.yml
new file mode 100644
index 00000000..f8d5249e
--- /dev/null
+++ b/.github/actions/test/integration/test/migrate/action.yml
@@ -0,0 +1,192 @@
+name: test-migrate
+description: Migrate a VM between the HyperVisors and verify it stays reachable
+inputs:
+ vm_name:
+ description: "libvirt domain name of the VM, e.g. VM-QEMU"
+ required: true
+ connection:
+ description: "libvirt connection arguments, e.g. '-c ch:///session'; empty for the system connection"
+ required: false
+ default: ""
+ definition:
+ description: "Runner path to the VM's libvirt domain XML"
+ required: true
+ destination:
+ description: "libvirt URI of the migration target, e.g. qemu+ssh://root@192.168.122.3/system"
+ required: true
+ guest_ip:
+ description: "Static IP the migrated VM keeps on the guest network"
+ required: true
+ storage:
+ description: "'local' stages the root disk on HV1 and migrates it with --copy-storage-all; 'shared' migrates the shared disk in place"
+ required: false
+ default: "shared"
+runs:
+ using: "composite"
+ steps:
+ - name: Copy VM definitions and artifacts to the HyperVisors
+ shell: bash
+ env:
+ VM_NAME: ${{ inputs.vm_name }}
+ DEFINITION: ${{ inputs.definition }}
+ STORAGE: ${{ inputs.storage }}
+ run: |
+ # Required from the job environment; the shared key is the identity
+ # that the ssh config names.
+ [ -s /opt/ssh_host_ed25519_key ] || { echo "the shared SSH key /opt/ssh_host_ed25519_key is missing" >&2; exit 1; }
+ IP_HV1="192.168.122.2"
+
+ scp "$DEFINITION" "$IP_HV1:/opt/$VM_NAME.xml"
+
+ # Setup links the shared raw disk and seed at the existing
+ # /var/lib/libvirt/images paths; only local storage needs a copy.
+ if [ "$STORAGE" = local ]; then
+ scp /opt/cirros.qcow2 "$IP_HV1:/var/lib/libvirt/images/cirros.qcow2"
+ fi
+
+ - name: Start VM on HyperVisor 1
+ shell: bash
+ env:
+ VM_NAME: ${{ inputs.vm_name }}
+ CONNECTION: ${{ inputs.connection }}
+ run: |
+ IP_HV1="192.168.122.2"
+
+ ssh "$IP_HV1" << EOF
+ virsh ${CONNECTION} define /opt/$VM_NAME.xml
+ virsh ${CONNECTION} start $VM_NAME
+ EOF
+
+ - name: Wait for VM to be ready
+ shell: bash
+ env:
+ VM_NAME: ${{ inputs.vm_name }}
+ CONNECTION: ${{ inputs.connection }}
+ run: |
+ IP_HV1="192.168.122.2"
+
+ ssh "$IP_HV1" << EOF
+ MAX_ITER="${BOOT_MAX_ITER:-60}"
+ for ((i=1; i<=MAX_ITER; i++)); do
+ IP=\$(virsh ${CONNECTION} domifaddr $VM_NAME | awk '/ipv4/ {print \$4}' | cut -d'/' -f1)
+ if [ -z "\$IP" ]; then
+ echo "No IP address found for VM. Retrying..."
+ elif (( i >= MAX_ITER - 2 )); then
+ # Show SSH errors on last 3 attempts for debugging
+ if ssh "\$IP" 'exit'; then
+ echo "VM is up at IP: \$IP"
+ ssh "\$IP" 'echo "Hello, World!" > /home/cirros/hello.txt'
+ break
+ fi
+ elif ssh "\$IP" 'exit' 2>/dev/null; then
+ echo "VM is up at IP: \$IP"
+ # create a dummy file for verification later
+ ssh "\$IP" 'echo "Hello, World!" > /home/cirros/hello.txt'
+ break
+ fi
+ if (( i == MAX_ITER )); then
+ echo "Timeout waiting for VM to respond to SSH."
+ echo "=== DIAGNOSTICS ==="
+ echo "--- virsh ${CONNECTION} domifaddr $VM_NAME ---"
+ virsh ${CONNECTION} domifaddr $VM_NAME || true
+ echo "--- ip addr show virbr0 ---"
+ ip addr show virbr0 || true
+ echo "--- ip route ---"
+ ip route || true
+ echo "--- arp -n ---"
+ arp -n 2>/dev/null || ip neigh || true
+ echo "--- ssh -v attempt ---"
+ ssh -v "\$IP" 'exit' 2>&1 || true
+ echo "=== END DIAGNOSTICS ==="
+ exit 1
+ fi
+ echo "Waiting for VM to respond to SSH... (\$i/\$MAX_ITER)"
+ sleep 10
+ done
+ EOF
+
+ - name: Migrate the VM to HyperVisor 2
+ shell: bash
+ env:
+ VM_NAME: ${{ inputs.vm_name }}
+ CONNECTION: ${{ inputs.connection }}
+ DESTINATION: ${{ inputs.destination }}
+ STORAGE: ${{ inputs.storage }}
+ run: |
+ IP_HV1="192.168.122.2"
+
+ if [ "$STORAGE" = local ]; then
+ MIGRATE_STORAGE_FLAGS="--copy-storage-all"
+ else
+ MIGRATE_STORAGE_FLAGS=""
+ fi
+
+ ssh "$IP_HV1" << EOF
+ virsh ${CONNECTION} migrate --p2p --persistent --undefinesource --live $MIGRATE_STORAGE_FLAGS $VM_NAME $DESTINATION
+ if virsh ${CONNECTION} dominfo $VM_NAME &>/dev/null; then
+ echo "VM is still present on HV1 after migration!"
+ exit 1
+ fi
+ EOF
+
+ - name: Verify VM status on HyperVisor 2
+ shell: bash
+ env:
+ VM_NAME: ${{ inputs.vm_name }}
+ CONNECTION: ${{ inputs.connection }}
+ GUEST_IP: ${{ inputs.guest_ip }}
+ run: |
+ IP_HV2="192.168.122.3"
+
+ ssh "$IP_HV2" << EOF
+ if virsh ${CONNECTION} dominfo $VM_NAME | awk '/State:/ {print \$2}' | grep -q "running"; then
+ echo "VM is running on HV2."
+ else
+ echo "VM is not running on HV2."
+ exit 1
+ fi
+
+ # waiting for the IP to be visible to the new HyperVisor via DHCP takes WAYYYYYYY too long
+ # the IP is static, so we can just use it directly
+ IP="$GUEST_IP"
+
+ MAX_ITER="${VERIFY_MAX_ITER:-15}"
+ for ((i=1; i<=MAX_ITER; i++)); do
+ if ssh "\$IP" 'exit' 2>/dev/null; then
+ echo "VM is up at IP: \$IP"
+ # verify the migration by checking the dummy file
+ if ssh "\$IP" 'test -f /home/cirros/hello.txt'; then
+ echo "Dummy file exists on VM, migration successful."
+ break
+ else
+ echo "Dummy file does not exist on VM, migration failed."
+ fi
+ fi
+ if (( i == MAX_ITER )); then
+ echo "Timeout waiting for VM to respond to SSH."
+ echo "=== DIAGNOSTICS ==="
+ echo "--- ip addr show virbr0 ---"
+ ip addr show virbr0 || true
+ echo "--- ip route ---"
+ ip route || true
+ echo "--- ssh -v attempt ---"
+ ssh -v "\$IP" 'exit' 2>&1 || true
+ echo "=== END DIAGNOSTICS ==="
+ exit 1
+ fi
+ echo "Waiting for VM to respond to SSH... (\$i/\$MAX_ITER)"
+ sleep 10
+ done
+ EOF
+
+ - name: Stop the migrated guest
+ shell: bash
+ env:
+ VM_NAME: ${{ inputs.vm_name }}
+ CONNECTION: ${{ inputs.connection }}
+ run: |
+ # A started domain owns an nvram vars file, which undefine only removes
+ # with --nvram; drivers without nvram succeed on the plain call.
+ ssh 192.168.122.3 "virsh ${CONNECTION} destroy $VM_NAME >/dev/null 2>&1 || true
+ virsh ${CONNECTION} undefine $VM_NAME >/dev/null 2>&1 ||
+ virsh ${CONNECTION} undefine --nvram $VM_NAME >/dev/null 2>&1 || true"
diff --git a/.github/actions/test/integration/test/cloudhypervisor/vm.xml b/.github/actions/test/integration/test/migrate/cloudhypervisor.xml
similarity index 71%
rename from .github/actions/test/integration/test/cloudhypervisor/vm.xml
rename to .github/actions/test/integration/test/migrate/cloudhypervisor.xml
index 68108ff0..bc639d6a 100644
--- a/.github/actions/test/integration/test/cloudhypervisor/vm.xml
+++ b/.github/actions/test/integration/test/migrate/cloudhypervisor.xml
@@ -1,7 +1,7 @@
VM-CHV
2
- 1
+ 2
hvm
@@ -9,12 +9,16 @@
+
-
+
+
-
+
+
diff --git a/.github/actions/test/integration/test/qemu/vm.xml b/.github/actions/test/integration/test/migrate/qemu.xml
similarity index 80%
rename from .github/actions/test/integration/test/qemu/vm.xml
rename to .github/actions/test/integration/test/migrate/qemu.xml
index 3626dc12..8ab1a2da 100644
--- a/.github/actions/test/integration/test/qemu/vm.xml
+++ b/.github/actions/test/integration/test/migrate/qemu.xml
@@ -14,13 +14,13 @@
-
-
+
+
-
+
-
-
+
+
diff --git a/.github/actions/test/integration/test/qemu/action.yml b/.github/actions/test/integration/test/qemu/action.yml
deleted file mode 100644
index 0dab0344..00000000
--- a/.github/actions/test/integration/test/qemu/action.yml
+++ /dev/null
@@ -1,130 +0,0 @@
-name: test-qemu
-description: Execute Integration Tests for Hypervisor Capabilities (QEMU)
-runs:
- using: "composite"
- steps:
- - name: Copy VM defintions and artifacts to the HyperVisors
- shell: bash
- run: |
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
- IP_HV1="192.168.122.2"
- IP_HV2="192.168.122.3"
-
- scp $SSH_OPTS ./.github/actions/test/integration/test/qemu/vm.xml "$USER@$IP_HV1:/opt/vm-qemu.xml"
- scp $SSH_OPTS /opt/ubuntu.qcow2 "$USER@$IP_HV1:/var/lib/libvirt/images/ubuntu.qcow2"
- scp $SSH_OPTS /opt/ubuntu-cloud-init-ds.iso "$USER@$IP_HV1:/var/lib/libvirt/images/ubuntu-cloud-init-ds.iso"
-
- # the cloud-init data is not migrated from source to destination, but needed for the VM to run at the destination
- scp $SSH_OPTS /opt/ubuntu-cloud-init-ds.iso "$USER@$IP_HV2:/var/lib/libvirt/images/ubuntu-cloud-init-ds.iso"
-
- - name: Start VM on HyperVisor 1
- shell: bash
- run: |
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
- IP_HV1="192.168.122.2"
-
- ssh $SSH_OPTS "$USER@$IP_HV1" << EOF
- virsh define /opt/vm-qemu.xml
- virsh start VM-QEMU
- EOF
-
- - name: Wait for VM to be ready
- shell: bash
- run: |
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
- IP_HV1="192.168.122.2"
-
- ssh $SSH_OPTS "$USER@$IP_HV1" << EOF
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i \$KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
-
- MAX_ITER=60
- for ((i=1; i<=MAX_ITER; i++)); do
- IP=\$(virsh domifaddr VM-QEMU | awk '/ipv4/ {print \$4}' | cut -d'/' -f1)
- if [ -z "\$IP" ]; then
- echo "No IP address found for VM. Retrying..."
- elif ssh \$SSH_OPTS "\$USER@\$IP" 'exit' 2>/dev/null; then
- echo "VM is up at IP: \$IP"
- # create a dummy file for verification later
- ssh \$SSH_OPTS "\$USER@\$IP" 'echo "Hello, World!" > /opt/hello.txt'
- break
- fi
- if (( i == MAX_ITER )); then
- echo "Timeout waiting for VM to respond to SSH."
- exit 1
- fi
- echo "Waiting for VM to respond to SSH... (\$i/\$MAX_ITER)"
- sleep 10
- done
- EOF
-
- - name: Mirgrate the VM to HyperVisor 2
- shell: bash
- run: |
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
- IP_HV1="192.168.122.2"
-
- ssh $SSH_OPTS "$USER@$IP_HV1" << EOF
- USER="root"
- IP_HV2="192.168.122.3"
-
- virsh migrate --p2p --persistent --undefinesource --copy-storage-all --live VM-QEMU qemu+ssh://\$USER@\$IP_HV2/system
- if virsh dominfo VM-QEMU &>/dev/null; then
- echo "VM is still present on HV1 after migration!"
- exit 1
- fi
- EOF
-
- - name: Verify VM status on HyperVisor 2
- shell: bash
- run: |
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
- IP_HV2="192.168.122.3"
-
- ssh $SSH_OPTS "$USER@$IP_HV2" << EOF
- if virsh dominfo VM-QEMU | awk '/State:/ {print \$2}' | grep -q "running"; then
- echo "VM is running on HV2."
- else
- echo "VM is not running on HV2."
- exit 1
- fi
-
- KEY=/opt/ssh_host_ed25519_key
- SSH_OPTS="-i \$KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
- USER="root"
- # waiting for the IP to be visible to the new HyperVisor via DHCP takes WAYYYYYYY too long
- # the IP is static, so we can just use it directly
- IP="192.168.222.2"
-
- MAX_ITER=15
- for ((i=1; i<=MAX_ITER; i++)); do
- if ssh \$SSH_OPTS "\$USER@\$IP" 'exit' 2>/dev/null; then
- echo "VM is up at IP: \$IP"
- # verify the migration by checking the dummy file
- if ssh \$SSH_OPTS "\$USER@\$IP" 'test -f /opt/hello.txt'; then
- echo "Dummy file exists on VM, migration successful."
- break
- else
- echo "Dummy file does not exist on VM, migration failed."
- exit 1
- fi
- fi
- if (( i == MAX_ITER )); then
- echo "Timeout waiting for VM to respond to SSH."
- exit 1
- fi
- echo "Waiting for VM to respond to SSH... (\$i/\$MAX_ITER)"
- sleep 10
- done
- EOF
diff --git a/.github/scripts/compute-image-tag.sh b/.github/scripts/compute-image-tag.sh
new file mode 100755
index 00000000..d0c9c389
--- /dev/null
+++ b/.github/scripts/compute-image-tag.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# Computes the OCI image tag for Garden Linux ccloud images
+#
+# This script centralizes the image tag format computation to ensure consistency
+# across all workflows (nightly, dev, upload_oci).
+#
+# Usage:
+# ./compute-image-tag.sh [flavor]
+#
+# Arguments:
+# version - The version for the tag (e.g., "1877.10.1", "pr-123")
+# flavor - The image flavor (e.g., "metal-sci-usi-amd64"). Defaults to "metal-sci-usi-amd64".
+#
+# Environment:
+# GITHUB_SHA - Git commit SHA (required, set automatically by GitHub Actions)
+#
+# Output:
+# Prints the computed image tag to stdout
+#
+# Tag format:
+# {version}-{flavor}-{dashed_version}-{commit_sha_short}
+#
+# Examples:
+# ./compute-image-tag.sh "1877.10.1"
+# # Output: 1877.10.1-metal-sci-usi-amd64-1877-10-1-abcd1234
+#
+# ./compute-image-tag.sh "pr-123" "metal-capi-amd64"
+# # Output: pr-123-metal-capi-amd64-pr-123-abcd1234
+
+set -euo pipefail
+
+VERSION="${1:?Error: VERSION argument required}"
+FLAVOR="${2:-metal-sci-usi-amd64}"
+
+if [ -z "${GITHUB_SHA:-}" ]; then
+ echo "Error: GITHUB_SHA environment variable is required" >&2
+ exit 1
+fi
+
+COMMIT_SHA="${GITHUB_SHA::8}"
+DASHED_VERSION="${VERSION//./-}"
+
+IMAGE_TAG="${VERSION}-${FLAVOR}-${DASHED_VERSION}-${COMMIT_SHA}"
+
+echo "$IMAGE_TAG"
diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index 6dc97a4b..5351a1ad 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -3,6 +3,7 @@ on:
push:
branches:
- main
+ - rel-1877-dev
paths-ignore:
- "**/README.md"
- "docs/**"
@@ -11,38 +12,52 @@ on:
paths-ignore:
- "**/README.md"
- "docs/**"
+
+# Keep ordinary jobs read-only; grant elevated scopes only where required.
+permissions:
+ contents: read
+
+# Cancel any in-progress PR workflow runs when PR is closed
+# Used to ensure cleanup runs after any PR build are uploaded (or aborts before the upload)
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: ${{ github.event.action == 'closed' }}
+
jobs:
set_version:
if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }}
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
outputs:
VERSION: ${{ steps.version.outputs.VERSION }}
steps:
- name: Checkout repository
- uses: actions/checkout@v4
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
+ persist-credentials: false
submodules: recursive
- name: use VERSION file to support dev build on rel-branch
id: version
run: |
- if [ "${{ github.event_name }}" = "pull_request" ]; then
- echo "VERSION=today" >> $GITHUB_OUTPUT
- else
- echo "VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
- fi
+ echo "VERSION=$(cat VERSION)" >> "$GITHUB_OUTPUT"
build:
needs: [set_version]
- if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }}
- uses: gardenlinux/gardenlinux/.github/workflows/build.yml@40e7dfa820cb8bd5e0317779f818d31464c18c63
+ # Do not run the privileged upstream build against fork PR code.
+ if: ${{ github.event_name != 'pull_request' || (github.event.action != 'closed' && github.event.pull_request.head.repo.full_name == github.repository) }}
+ # Required by the pinned upstream reusable workflow, even for target: dev.
+ permissions:
+ contents: read
+ actions: write
+ id-token: write
+ packages: write
+ uses: gardenlinux/gardenlinux/.github/workflows/build.yml@2c13d3c6f94c8ad315b2817493464c87b525a946
with:
version: ${{ needs.set_version.outputs.VERSION }}
# to set target to "release" or "nightly" we need proper KMS secrets
# have a look at gardenlinux/.github/workflows/github.mjs
target: dev
fail_fast: true
- platform_test_build: false
# secrets:
# aws_region: ${{ secrets.AWS_REGION }}
# aws_kms_role: ${{ secrets.KMS_SIGNING_IAM_ROLE }}
@@ -52,30 +67,36 @@ jobs:
meta:
name: Compute image metadata
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.event.action != 'closed' }}
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
outputs:
UPLOAD_VERSION: ${{ steps.meta.outputs.upload_version }}
- COMMIT_SHA: ${{ steps.meta.outputs.sha }}
+ image_tag: ${{ steps.meta.outputs.image_tag }}
steps:
- - name: Derive image version
+ - name: Checkout
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ persist-credentials: false
+ - name: Compute image metadata
id: meta
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
UPLOAD_VERSION="pr-${PR_NUMBER}"
- echo "upload_version=${UPLOAD_VERSION}" >> $GITHUB_OUTPUT
- SHA="${GITHUB_SHA::8}"
- echo "sha=${SHA}" >> $GITHUB_OUTPUT
+ echo "upload_version=${UPLOAD_VERSION}" >> "$GITHUB_OUTPUT"
+ IMAGE_TAG=$(.github/scripts/compute-image-tag.sh "${UPLOAD_VERSION}")
+ echo "image_tag=${IMAGE_TAG}" >> "$GITHUB_OUTPUT"
upload:
name: Upload PR image to OCI
needs: [build, meta, set_version]
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.event.action != 'closed' }}
+ permissions:
+ contents: read
+ packages: write
uses: ./.github/workflows/upload_oci.yml
with:
version: ${{ needs.set_version.outputs.VERSION }}
upload_version: ${{ needs.meta.outputs.UPLOAD_VERSION }}
flavor_filter: '--include-only "metal-sci_usi-amd64"'
- secrets: inherit
test:
name: Test PR image
@@ -83,14 +104,18 @@ jobs:
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.event.action != 'closed' }}
uses: ./.github/workflows/test.yml
with:
- image_tag: "${{ needs.meta.outputs.UPLOAD_VERSION }}-metal-sci-usi-amd64-${{ needs.meta.outputs.UPLOAD_VERSION }}-${{ needs.meta.outputs.COMMIT_SHA }}"
+ image_tag: ${{ needs.meta.outputs.image_tag }}
cleanup_images:
name: Cleanup PR images
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.event.action == 'closed' }}
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
+ permissions:
+ packages: write
steps:
- name: Cleanup OCI images via GitHub API
+ env:
+ GH_TOKEN: ${{ github.token }}
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
UPLOAD_VERSION="pr-${PR_NUMBER}"
@@ -101,10 +126,10 @@ jobs:
# Collect all matching version IDs across pages
while true; do
- response=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
+ response=$(curl --fail-with-body --silent --show-error -H "Authorization: Bearer $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
- "https://api.github.com/orgs/gardenlinux/packages/container/gardenlinux-ccloud/versions?per_page=$page_size&page=$page")
+ "https://api.github.com/orgs/gardenlinux/packages/container/gardenlinux-sci/versions?per_page=$page_size&page=$page")
page_ids=$(echo "$response" | jq -r --arg prefix "${UPLOAD_VERSION}" '
.[] | select(.metadata.container.tags[]? | test("^" + $prefix + "(-.*)?$")) | .id
@@ -130,11 +155,12 @@ jobs:
for version_id in $all_version_ids; do
echo "Deleting version $version_id"
http_code=$(curl -s -w "%{http_code}" -o /dev/null -X DELETE \
- -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
+ -H "Authorization: Bearer $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
- "https://api.github.com/orgs/gardenlinux/packages/container/gardenlinux-ccloud/versions/$version_id")
+ "https://api.github.com/orgs/gardenlinux/packages/container/gardenlinux-sci/versions/$version_id")
if [ "$http_code" != "204" ]; then
echo "Failed to delete version $version_id (HTTP $http_code)"
+ exit 1
fi
done
diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml
index 546d6f74..fba0134c 100644
--- a/.github/workflows/nightly.yaml
+++ b/.github/workflows/nightly.yaml
@@ -9,34 +9,71 @@ on:
description: "Version to build"
type: string
default: now
+# Keep ordinary jobs read-only; grant elevated scopes only at call sites.
+permissions:
+ contents: read
+
jobs:
checkout:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- name: Checkout
- uses: actions/checkout@v4
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
+ persist-credentials: false
submodules: recursive
build:
needs: [checkout]
- uses: gardenlinux/gardenlinux/.github/workflows/build.yml@40e7dfa820cb8bd5e0317779f818d31464c18c63
+ # Required by the pinned upstream reusable workflow, even for target: dev.
+ permissions:
+ contents: read
+ actions: write
+ id-token: write
+ packages: write
+ uses: gardenlinux/gardenlinux/.github/workflows/build.yml@2c13d3c6f94c8ad315b2817493464c87b525a946
with:
version: ${{ inputs.version || 'now' }}
# to set target to "release" or "nightly" we need proper KMS secrets
- # have a look at gardenlinux/.github/workflows/github.mjs
+ # have a look at gardenlinux/.github/workflows/github.mjs
target: dev
fail_fast: true
- platform_test_build: false
# secrets:
# aws_region: ${{ secrets.AWS_REGION }}
# aws_kms_role: ${{ secrets.KMS_SIGNING_IAM_ROLE }}
# aws_oidc_session: ${{ secrets.AWS_OIDC_SESSION }}
# secureboot_db_kms_arn: ${{ secrets.SECUREBOOT_DB_KMS_ARN }}
+ meta:
+ name: Compute image metadata
+ needs: [build]
+ runs-on: ubuntu-24.04
+ outputs:
+ image_tag: ${{ steps.meta.outputs.image_tag }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ persist-credentials: false
+ - name: Compute image tag
+ id: meta
+ env:
+ BUILD_VERSION: ${{ needs.build.outputs.version }}
+ run: |
+ IMAGE_TAG=$(.github/scripts/compute-image-tag.sh "$BUILD_VERSION")
+ echo "image_tag=${IMAGE_TAG}" >> "$GITHUB_OUTPUT"
upload_oci:
name: Run glcli to publish to OCI
needs: [build]
+ permissions:
+ contents: read
+ packages: write
# use custom upload_oci.yml as we do not sign the images
- # uses: gardenlinux/gardenlinux/.github/workflows/upload_oci.yml@40e7dfa820cb8bd5e0317779f818d31464c18c63
+ # uses: gardenlinux/gardenlinux/.github/workflows/upload_oci.yml@ed75af27781084f5e6742bab59b89861150098d8
uses: ./.github/workflows/upload_oci.yml
with:
version: ${{ needs.build.outputs.version }}
+ test:
+ name: Test nightly image
+ needs: [meta, upload_oci]
+ uses: ./.github/workflows/test.yml
+ with:
+ image_tag: ${{ needs.meta.outputs.image_tag }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index ea9abc1f..f247b542 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,19 +1,11 @@
name: test hypervisor capabilities
on:
- push:
- branches:
- - feat/ci-test-cloud-hypervisor
- workflow_run:
- workflows:
- - nightly
- types:
- - completed
workflow_dispatch:
inputs:
image_tag:
description: "Image tag to test (must be usi-sci)"
type: string
- default: ""
+ required: true
workflow_call:
inputs:
image_tag:
@@ -21,31 +13,46 @@ on:
type: string
required: true
+permissions:
+ contents: read
+
jobs:
test:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
+ env:
+ BOOT_MAX_ITER: 360 # 60 min at 10 s per poll
+ VERIFY_MAX_ITER: 90 # 15 min at 10 s per poll
steps:
- name: Checkout
- uses: actions/checkout@v4
- - name: Install Dependencies
- uses: ./.github/actions/test/integration/dependencies
- - name: Obtain newest Tag from GHCR
- id: fetch_tag
- if: ${{ inputs.image_tag == '' || github.event_name == 'workflow_run' || github.event_name == 'push' }}
- run: |
- latest_tag=$(oras repo tags ghcr.io/gardenlinux/gardenlinux-ccloud | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-metal-sci-usi-amd64-[0-9]+-[0-9]+-[0-9]-[0-9a-f]{8}$' | sort -r | head -n 1)
- echo $latest_tag
- echo "latest_tag=$latest_tag" >> $GITHUB_ENV
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ persist-credentials: false
+ - name: Prepare the test environment
+ uses: ./.github/actions/test/integration/prepare
- name: Build
uses: ./.github/actions/test/integration/build
with:
- image_tag: ${{ env.latest_tag || inputs.image_tag }}
+ image_tag: ${{ inputs.image_tag }}
- name: Setup
uses: ./.github/actions/test/integration/setup
- - name: Test QEMU
- uses: ./.github/actions/test/integration/test/qemu
+ #- name: Test QEMU
+ # timeout-minutes: 120
+ # uses: ./.github/actions/test/integration/test/migrate
+ # with:
+ # vm_name: VM-QEMU
+ # definition: ./.github/actions/test/integration/test/migrate/qemu.xml
+ # destination: qemu+ssh://root@192.168.122.3/system
+ # guest_ip: 192.168.222.2
+ # storage: local
- name: Test CloudHypervisor
- uses: ./.github/actions/test/integration/test/cloudhypervisor
+ timeout-minutes: 180
+ uses: ./.github/actions/test/integration/test/migrate
+ with:
+ vm_name: VM-CHV
+ connection: "-c ch:///session"
+ definition: ./.github/actions/test/integration/test/migrate/cloudhypervisor.xml
+ destination: ch+ssh://root@192.168.122.3/system
+ guest_ip: 192.168.222.3
- name: Collect Debug Logs
if: always()
uses: ./.github/actions/test/integration/collect-logs
diff --git a/.github/workflows/upload_oci.yml b/.github/workflows/upload_oci.yml
index 896e2495..10142906 100644
--- a/.github/workflows/upload_oci.yml
+++ b/.github/workflows/upload_oci.yml
@@ -11,23 +11,32 @@ on:
flavor_filter:
type: string
default: '--exclude "bare-*"'
+
+permissions:
+ contents: read
+
jobs:
generate_matrix_publish:
name: Generate flavors matrix to publish
- uses: gardenlinux/gardenlinux/.github/workflows/build_flavors_matrix.yml@40e7dfa820cb8bd5e0317779f818d31464c18c63
+ uses: gardenlinux/gardenlinux/.github/workflows/build_flavors_matrix.yml@2c13d3c6f94c8ad315b2817493464c87b525a946
with:
flags: '${{ inputs.flavor_filter }} --no-arch --json-by-arch --build --test'
upload_gl_artifacts:
name: upload to OCI
needs: [ generate_matrix_publish ]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
defaults:
run:
shell: bash
env:
CNAME: ''
+ VERSION: ${{ inputs.version }}
+ UPLOAD_VERSION: ${{ inputs.upload_version || inputs.version }}
+ FLAVOR: ${{ matrix.flavor }}
+ ARCH: ${{ matrix.arch }}
+ REGISTRY: ghcr.io/${{ github.repository }}
permissions:
- id-token: write
+ contents: read
packages: write
strategy:
fail-fast: false
@@ -37,21 +46,26 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin@v4.1.1
with:
submodules: true
- - uses: oras-project/setup-oras@v1
+ persist-credentials: false
+ - uses: oras-project/setup-oras@ac735097e22fe643015b0d19645f7c9a69942128 # v2
- run: oras version
- name: Install python-gardenlinux-lib
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@hotfix-disabled-python-cache-in-setup-action
- - name: Install cosign
- uses: sigstore/cosign-installer@v3.9.1
- with:
- cosign-release: 'v2.4.1'
+ uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@7b3c8e74746b20863c760f259bf1208982f51d97
- name: Set flavor version reference
run: |
+ for tag in "$VERSION" "$UPLOAD_VERSION"; do
+ if ! [[ "$tag" =~ ^[a-zA-Z0-9_][a-zA-Z0-9_.-]{0,127}$ ]]; then
+ echo "Error: version and upload_version must be valid OCI tags" >&2
+ exit 1
+ fi
+ done
git rev-parse HEAD | cut -c1-8 | tee COMMIT
- echo "${{ inputs.version }}" | tee VERSION
+ printf '%s\n' "$VERSION" | tee VERSION
- name: Set CNAME
run: |
- echo "CNAME=$(gl-features-parse --cname ${{ matrix.flavor }}-${{ matrix.arch }} cname)" | tee -a "$GITHUB_ENV"
+ CNAME=$(gl-features-parse --cname "$FLAVOR-$ARCH" cname)
+ [[ "$CNAME" =~ ^[a-zA-Z0-9_][a-zA-Z0-9_.-]*$ ]] || { echo "Error: invalid canonical image name" >&2; exit 1; }
+ echo "CNAME=$CNAME" | tee -a "$GITHUB_ENV"
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # pin@v4.1.8
with:
name: build-${{ matrix.flavor }}-${{ matrix.arch }}
@@ -66,28 +80,32 @@ jobs:
gl-oci push-manifest \
--dir "${CNAME}" \
- --container "ghcr.io/${{ github.repository }}" \
- --arch ${{ matrix.arch }} \
- --version ${{ inputs.version }} \
+ --container "$REGISTRY" \
+ --arch "$ARCH" \
+ --version "$VERSION" \
--cname "${CNAME}" \
--cosign_file digest.txt \
--manifest_file "oci_manifest_entry_${CNAME}.json"
- name: Add additional semver tag
+ env:
+ GH_TOKEN: ${{ github.token }}
+ REGISTRY_USERNAME: ${{ github.repository_owner }}
run: |
- echo ${{ secrets.GITHUB_TOKEN }} | oras login -u ${{ github.repository_owner }} --password-stdin ghcr.io
+ : "${CNAME:?the manifest name is not set}"
+ printf '%s\n' "$GH_TOKEN" | oras login -u "$REGISTRY_USERNAME" --password-stdin ghcr.io
COMMIT_SHA_SHORT=$(git rev-parse HEAD | cut -c1-8)
# Keep CNAME reference
CNAME2=${CNAME//_/-}
# Remove version from CNAME
- CNAME2=${CNAME2//-${{ inputs.version }}/}
+ CNAME2=${CNAME2//-"${VERSION}"/}
# Remove commit sha from CNAME
CNAME2=${CNAME2//-${COMMIT_SHA_SHORT}/}
# 8 charachter commit hash
- DASHED_VERSION=${{ inputs.upload_version || inputs.version }}
+ DASHED_VERSION=$UPLOAD_VERSION
DASHED_VERSION=${DASHED_VERSION//./-}
- echo "Adding additional tag: ${{ inputs.upload_version || inputs.version }}-${CNAME2}-${DASHED_VERSION}-${COMMIT_SHA_SHORT}"
- oras tag ghcr.io/${{ github.repository }}:${{ inputs.version }}-${CNAME}-${{ matrix.arch }} ${{ inputs.upload_version || inputs.version }}-${CNAME2}-${DASHED_VERSION}-${COMMIT_SHA_SHORT}
+ echo "Adding additional tag: ${UPLOAD_VERSION}-${CNAME2}-${DASHED_VERSION}-${COMMIT_SHA_SHORT}"
+ oras tag "$REGISTRY:$VERSION-$CNAME-$ARCH" "${UPLOAD_VERSION}-${CNAME2}-${DASHED_VERSION}-${COMMIT_SHA_SHORT}"
- uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # pin@v4.2.3
with:
path: oci_manifest_entry_${{ env.CNAME }}.json
@@ -99,16 +117,20 @@ jobs:
upload_manifests_entries:
needs: [ generate_matrix_publish, upload_gl_artifacts ]
name: upload manifest entries into OCI index
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
defaults:
run:
shell: bash
env:
CNAME: ''
+ VERSION: ${{ inputs.version }}
+ UPLOAD_VERSION: ${{ inputs.upload_version || inputs.version }}
+ FLAVOR: ${{ matrix.flavor }}
+ ARCH: ${{ matrix.arch }}
+ REGISTRY: ghcr.io/${{ github.repository }}
permissions:
- id-token: write
+ contents: read
packages: write
- actions: write
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate_matrix_publish.outputs.matrix) }}
@@ -117,15 +139,24 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin@v4.1.1
with:
submodules: true
+ persist-credentials: false
- name: Install python-gardenlinux-lib
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@hotfix-disabled-python-cache-in-setup-action
+ uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@19c1b24c01faab81a7fe24713748dd172d00904a
- name: Set flavor version reference
run: |
+ for tag in "$VERSION" "$UPLOAD_VERSION"; do
+ if ! [[ "$tag" =~ ^[a-zA-Z0-9_][a-zA-Z0-9_.-]{0,127}$ ]]; then
+ echo "Error: version and upload_version must be valid OCI tags" >&2
+ exit 1
+ fi
+ done
git rev-parse HEAD | cut -c1-8 | tee COMMIT
- echo "${{ inputs.version }}" | tee VERSION
+ printf '%s\n' "$VERSION" | tee VERSION
- name: Set CNAME
run: |
- echo "CNAME=$(gl-features-parse --cname ${{ matrix.flavor }}-${{ matrix.arch }} cname)" | tee -a "$GITHUB_ENV"
+ CNAME=$(gl-features-parse --cname "$FLAVOR-$ARCH" cname)
+ [[ "$CNAME" =~ ^[a-zA-Z0-9_][a-zA-Z0-9_.-]*$ ]] || { echo "Error: invalid canonical image name" >&2; exit 1; }
+ echo "CNAME=$CNAME" | tee -a "$GITHUB_ENV"
- uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # pin@v4.2.3
with:
path: oci_manifest_entry_${{ env.CNAME }}.json
@@ -136,9 +167,9 @@ jobs:
GL_CLI_REGISTRY_USERNAME: ${{ github.repository_owner }}
run: |
mkdir manifests
- mv oci_manifest_entry_${CNAME}.json manifests/
+ mv "oci_manifest_entry_${CNAME}.json" manifests/
- gl-oci update-index \
- --container "ghcr.io/${{ github.repository }}" \
- --version ${{ inputs.upload_version || inputs.version }} \
+ gl-oci push-index-from-directory \
+ --index "$REGISTRY" \
+ --index-tag "$UPLOAD_VERSION" \
--manifest_folder manifests
diff --git a/.github/workflows/workflow-lint.yml b/.github/workflows/workflow-lint.yml
new file mode 100644
index 00000000..d70761b8
--- /dev/null
+++ b/.github/workflows/workflow-lint.yml
@@ -0,0 +1,28 @@
+name: workflow-lint
+
+on:
+ pull_request:
+ paths: [".github/**"]
+ push:
+ branches: [main, "rel-*"]
+ paths: [".github/**"]
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+jobs:
+ lint:
+ runs-on: ubuntu-24.04
+ timeout-minutes: 10
+ steps:
+ - name: Checkout
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - name: Check workflow syntax and shell scripts
+ run: |
+ shellcheck --version
+ go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.7
+ - name: Check workflow security
+ run: pipx run --spec zizmor==1.33.1 zizmor --offline --strict-collection --collect=all --format=github .github
diff --git a/.github/zizmor.yml b/.github/zizmor.yml
new file mode 100644
index 00000000..960d9b7d
--- /dev/null
+++ b/.github/zizmor.yml
@@ -0,0 +1,8 @@
+rules:
+ self-repository:
+ # Keep ./ local references compatible with the existing CI tooling.
+ ignore:
+ - dev.yml
+ - nightly.yaml
+ - test.yml
+ - action.yml
diff --git a/CODEOWNERS b/CODEOWNERS
new file mode 100644
index 00000000..d0d9e8ee
--- /dev/null
+++ b/CODEOWNERS
@@ -0,0 +1,2 @@
+# gardenlinux-sci maintainers
+* @gardenlinux/maintainers @gardenlinux/sap-cloud-infrastructure-maintainers
diff --git a/Containerfile b/Containerfile
new file mode 100644
index 00000000..b3f3ea32
--- /dev/null
+++ b/Containerfile
@@ -0,0 +1,3 @@
+FROM ghcr.io/gardenlinux/builder:0196add0ce875ac0b7721c19b2ee3ac37cf84387@sha256:a25e60658d595f0040b516fedaa067802e69f40810ebdd95ade5a59385eabf4c
+
+RUN sed 's/version="$2"/version=\$(echo \$2 | cut -d. -f 1-2)/' -i /builder/bootstrap
diff --git a/Makefile b/Makefile
index 7ac935a0..063ce213 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@ SHELL := /usr/bin/env bash
.SHELLFLAGS := -euo pipefail -c
ROOT_DIR := $(shell git rev-parse --show-toplevel)
+SED := $(shell command -v gsed 2>/dev/null || command -v sed)
# Default to latest commit if COMMIT is not specified
COMMIT ?= $(shell git ls-remote https://github.com/gardenlinux/gardenlinux.git HEAD | cut -f1)
@@ -25,11 +26,18 @@ prepare:
update:
# update gardenlinux submodule to specified or latest commit
- cd $(ROOT_DIR)/gardenlinux && git fetch && git checkout $(COMMIT) && cd ..
- git add gardenlinux
+ cd $(ROOT_DIR)/gardenlinux && git fetch && git checkout $(COMMIT) && \
+ GL_VERSION=$$(git tag --points-at $(COMMIT)) && cd .. ; \
+ if [ -n "$$GL_VERSION" ]; then \
+ echo "$$GL_VERSION.0" > $(ROOT_DIR)/VERSION; \
+ echo "Updated VERSION to $$GL_VERSION"; \
+ else \
+ echo "No tag found for $(COMMIT), VERSION unchanged"; \
+ fi
+ git add gardenlinux VERSION
# update workflow commit references
- sed -i -E 's|(gardenlinux/gardenlinux/.github/workflows/[^@]*)@[0-9a-f]{40}|\1@$(COMMIT)|g' $(ROOT_DIR)/.github/workflows/*.y*ml
+ $(SED) -i -E 's|(gardenlinux/gardenlinux/.github/workflows/[^@]*)@[0-9a-f]{40}|\1@$(COMMIT)|g' $(ROOT_DIR)/.github/workflows/*.y*ml
# update features
mkdir -p $(ROOT_DIR)/features
@@ -56,6 +64,18 @@ update:
fi; \
done
+ # update Containerfile if builder image changed
+ new_builder_image=$$(grep -m1 '^container_image=' $(ROOT_DIR)/gardenlinux/build | cut -d= -f2); \
+ current_builder_image=$$(head -1 $(ROOT_DIR)/Containerfile | $(SED) 's/^FROM //; s/@sha256:.*//'); \
+ if [ "$$new_builder_image" != "$$current_builder_image" ]; then \
+ echo "Builder image changed: $$current_builder_image -> $$new_builder_image"; \
+ new_digest=$$(crane digest "$$new_builder_image") || { echo "ERROR: Failed to resolve digest for $$new_builder_image. Is crane installed?"; exit 1; }; \
+ $(SED) -i -E "1s|^FROM .*|FROM $${new_builder_image}@$${new_digest}|" $(ROOT_DIR)/Containerfile; \
+ echo "Updated Containerfile to: FROM $${new_builder_image}@$${new_digest}"; \
+ else \
+ echo "Builder image unchanged, skipping Containerfile update"; \
+ fi
+
clean:
git reset --soft
rm -rf $(ROOT_DIR)/gardenlinux
diff --git a/README.md b/README.md
index 5d4d29bc..77b14dc7 100644
--- a/README.md
+++ b/README.md
@@ -17,3 +17,7 @@ The following make targets are available:
- `prepare`: Initialize and update submodules, required for first-time setup
- `update [COMMIT=]`: Update Garden Linux submodule to latest (or specific) commit and sync workflow references
- `clean`: Remove Garden Linux submodule and reset the environment
+
+
+
+
diff --git a/VERSION b/VERSION
deleted file mode 120000
index e96da460..00000000
--- a/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-gardenlinux/VERSION
\ No newline at end of file
diff --git a/VERSION b/VERSION
new file mode 100644
index 00000000..1d1c361c
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+1877.30.0
diff --git a/bin/flavors_parse.py b/bin/flavors_parse.py
new file mode 120000
index 00000000..8c2e0e41
--- /dev/null
+++ b/bin/flavors_parse.py
@@ -0,0 +1 @@
+../gardenlinux/bin/flavors_parse.py
\ No newline at end of file
diff --git a/bin/garden-version b/bin/garden-version
deleted file mode 120000
index d88969eb..00000000
--- a/bin/garden-version
+++ /dev/null
@@ -1 +0,0 @@
-../gardenlinux/bin/garden-version
\ No newline at end of file
diff --git a/bin/garden-version b/bin/garden-version
new file mode 100755
index 00000000..48c2b777
--- /dev/null
+++ b/bin/garden-version
@@ -0,0 +1,155 @@
+#!/usr/bin/env bash
+
+# Contains sources from https://github.com/debuerreotype/debuerreotype
+
+set -Eeuo pipefail
+# shellcheck disable=2128
+thisDir="$(dirname "$(readlink -f "${BASH_SOURCE}")")"
+versionfile="$(readlink -f "${thisDir}/../VERSION")"
+startdate="Mar 31 00:00:00 UTC 2020"
+build_os="$(uname -s)"
+
+function check_command() {
+ if ! command -v "$1" >/dev/null 2>&1; then
+ echo "Error: The binary '$1' could not be found. Please make sure to install it." >&2
+ exit 1
+ fi
+}
+
+# Use "gdate" & sed (GNU) which must be installed by "Homebrew"
+# on macOS systems to have a normalized date interface
+if [ "Darwin" == "$build_os" ]; then
+ date_gnu="gdate"
+ sed_gnu="gsed"
+else
+ date_gnu="date"
+ sed_gnu="sed"
+fi
+check_command "$date_gnu"
+check_command "$sed_gnu"
+
+# shellcheck disable=1091
+source "${thisDir}/.constants.sh" \
+ --flags 'major,minor,patch,date,datefull,epoch,git' \
+ --usage '[ --major | --minor | --patch | --date | --datefull | --epoch | --git ] [|]' \
+ --sample '20200427' \
+ --sample '--date 27.1' \
+ --help "Generates version dependent values according to the file $versionfile or to the parameter handed over. Versions can be converted adequately
+
+--major prints only the major version
+--minor prints only the minor version
+--patch prints only the patch/patch version
+--date prints the date according to the version e.g. 20200427 if garden-version=27
+--datefull prints a full date deteministically usable by debootstrap
+--epoch prints the seconds sinc 19700101 till garden-version
+--git prints the version plus the last git-hash
+
+If no parameter is specified the full version . e.g. 27.5 is printed. The version is taken from $versionfile. On HEAD this should always evaluate to 'today', on branch versions this always should resolve to the next version that will be build e.g. 27.1. This implies there is no branch with a .0 in the $versionfile file.
+The version calculated expresses the days since $startdate. Calculation is always UTC based."
+
+# shellcheck disable=2154
+eval "${dgetopt}"
+typeout="default"
+while true; do
+ flag="$1"; shift
+ dgetopt-case "${flag}"
+ case "${flag}" in
+ --major|--minor|--patch|--date|--datefull|--epoch|--git)
+ typeout="${flag}" ;;
+ --) break ;;
+ *) eusage "unknown flag '${flag}'" ;;
+ esac
+done
+
+# Checks repo.gardenlinux.io for the highest available suite minor for the given major
+function get_minor_from_repo {
+ minor=0 # running index
+ limit=100 # hard limit the search in case of unexpected curl results
+ major=$1 # major to check the latest minor for
+ repo_url="https://packages.gardenlinux.io/gardenlinux/dists/$major.__MINOR__/InRelease"
+ while [ $minor -le $limit ]
+ do
+ check_url=${repo_url//__MINOR__/$minor}
+ if curl -s "$check_url" | grep -q "Error"; then
+ ((minor--))
+ echo $minor
+ return
+ fi
+ ((minor++))
+ done
+}
+
+function get_patch_from_repo {
+ # TODO: implement if we really expect that we'll ever have a nonzero micro/patch version
+ local major=$1
+ local minor=$2
+ if [ "$minor" -eq -1 ]; then
+ echo -1
+ return
+ fi
+ echo 0
+ return
+}
+
+function trim_when_old_version {
+ if [ "$1" == "today" ] || [ "$1" == "experimental" ]; then
+ echo "$1"
+ return
+ fi
+ # HACK just for 1877 for SCI
+ # shellcheck disable=2046
+ if [ $(echo "$1" | cut -d. -f1) -lt 1876 ]; then
+ echo "$1" | cut -d. -f1-2
+ else
+ echo "$1"
+ fi
+}
+
+input="${1:-$($sed_gnu -e "s/#.*\$//" -e "/^$/d" "${versionfile}")}"; shift || true
+input=$($sed_gnu "s/^[[:space:]]*//;s/[[:space:]]*\$//" <<< "${input}")
+
+# no version / timestamp on versionfile
+[ -z "${input}" ] && input="today"
+
+minor=0
+patch=0
+# shellcheck disable=2046
+if [[ "${input}" =~ ^[0-9\.]*$ && $(cut -d. -f1 <<< "${input}") -lt 10000000 ]];
+then [ $(cut -d. -sf4 <<< "${input}") ] && eusage "invalid version format ${input}. should be [..]"
+
+ major="$(cut -d. -f1 <<< "${input}")"
+ # shellcheck disable=2046
+ if [ $(cut -d. -sf2 <<< "${input}") ]; then
+ minor="$(cut -d. -f2 <<< "${input}")"
+ else
+ minor=$(get_minor_from_repo "$major")
+ fi
+ # shellcheck disable=2046
+ if [ $(cut -d. -sf3 <<< "${input}") ]; then
+ patch="$(cut -d. -f3 <<< "${input}")"
+ else
+ patch=$(get_patch_from_repo "$major" "$minor")
+ fi
+ version="${major}.${minor}.${patch}"
+else
+ if [[ ${input} = today ]] || [[ ${input} = experimental ]];
+ then indate=$($date_gnu --date "today" +%s 2>/dev/null)
+ major="$(( ("${indate}" - $($date_gnu --date "${startdate}" +%s)) / (60*60*24) ))"
+ version=${input}
+ else indate=$($date_gnu --date "${input}" +%s 2>/dev/null) || eusage "invalid date ${input}"
+ major="$(( ("${indate}" - $($date_gnu --date "${startdate}" +%s)) / (60*60*24) ))"
+ version="${major}.${minor}.${patch}"
+ fi
+fi
+
+# shellcheck disable=2154
+case "${typeout}" in
+ --major) echo "${major}" ;;
+ --minor) echo "${minor}" ;;
+ --patch) echo "${patch}" ;;
+ --date) $date_gnu --date "${startdate} + ${major} days" +%Y%m%d ;;
+ --datefull) $date_gnu --date "${startdate} + ${major} days" +%Y%m%dT%H%M%SZ ;;
+ --epoch) $date_gnu --date "${startdate} + ${major} days" +%s ;;
+ --git) echo "$(trim_when_old_version "${version}")-$(git -C "${scriptsDir}" rev-parse --short 'HEAD^{commit}')" ;;
+ *) trim_when_old_version "${version}" ;;
+esac
diff --git a/build b/build
deleted file mode 120000
index 9a5480ab..00000000
--- a/build
+++ /dev/null
@@ -1 +0,0 @@
-gardenlinux/build
\ No newline at end of file
diff --git a/build b/build
new file mode 100755
index 00000000..39567e0c
--- /dev/null
+++ b/build
@@ -0,0 +1,180 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+shopt -s nullglob
+
+exec 3>&1
+exec 1>&2
+
+container_image=localhost/builder
+container_engine=podman
+target_dir=.build
+
+container_run_opts=(
+ --memory 4G
+ --security-opt seccomp=unconfined
+ --security-opt apparmor=unconfined
+ --security-opt label=disable
+ --read-only
+)
+
+container_cmd=()
+
+use_kms=0
+resolve_cname=0
+allow_frankenstein=1
+apparmor_profile=
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --allow-frankenstein) # https://xkcd.com/1589/
+ allow_frankenstein=1
+ shift
+ ;;
+ --container-image)
+ container_image="$2"
+ shift 2
+ ;;
+ --container-engine)
+ container_engine="$2"
+ shift 2
+ ;;
+ --container-run-opts)
+ declare -a "container_run_opts=($2)"
+ shift 2
+ ;;
+ --privileged)
+ container_run_opts+=(--privileged)
+ container_cmd=(--second-stage)
+ shift
+ ;;
+ --kms)
+ use_kms=1
+ shift
+ ;;
+ --print-container-image)
+ printf '%s\n' "$container_image" >&3
+ exit 0
+ ;;
+ --resolve-cname)
+ resolve_cname=1
+ shift
+ ;;
+ --target)
+ target_dir="$2"
+ shift 2
+ ;;
+ --apparmor-profile)
+ apparmor_profile="$2"
+ shift 2
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
+[ -d "$target_dir" ] || mkdir "$target_dir"
+
+container_mount_opts=(
+ -v "$PWD/keyring.gpg:/builder/keyring.gpg:ro"
+ -v "$(realpath "$target_dir"):/builder/.build"
+)
+
+# mount all features to enable dynamic discovery of requirements.mod files
+container_mount_opts+=(-v "$(realpath -- "features"):/builder/features:ro")
+container_mount_opts+=(-v "$(realpath -- "gardenlinux"):/builder/gardenlinux:ro")
+container_mount_opts+=(-v "$(realpath -- "requirements.defs"):/builder/requirements.defs:ro")
+
+if [ "$container_image" = localhost/builder ]; then
+ dir="$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")"
+ "$container_engine" build -t "$container_image" "$dir"
+fi
+
+repo="$(./get_repo)"
+commit="$(./get_commit)"
+timestamp="$(./get_timestamp)"
+default_version="$(./get_version)"
+
+
+if [ "$resolve_cname" = 1 ]; then
+ arch="$("$container_engine" run --rm "${container_run_opts[@]}" "${container_mount_opts[@]}" "$container_image" dpkg --print-architecture)"
+ cname="$("$container_engine" run --rm "${container_run_opts[@]}" "${container_mount_opts[@]}" "$container_image" /builder/parse_features --allow-frankenstein --feature-dir /builder/features --default-arch "$arch" --default-version "$default_version" --cname "$1")"
+ short_commit="$(head -c 8 <<< "$commit")"
+ echo "$cname-$short_commit" >&3
+ exit 0
+fi
+
+make_opts=(
+ REPO="$repo"
+ COMMIT="$commit"
+ TIMESTAMP="$timestamp"
+ DEFAULT_VERSION="$default_version"
+ LOG_WITH_TIMESTAMP="${LOG_WITH_TIMESTAMP:-true}"
+)
+
+if [ "$allow_frankenstein" = 1 ]; then
+ make_opts+=("ALLOW_FRANKENSTEIN=1")
+fi
+
+if [ "$use_kms" = 1 ]; then
+ for e in AWS_DEFAULT_REGION AWS_REGION AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN; do
+ if [ -n "${!e-}" ]; then
+ make_opts+=("$e=${!e}")
+ fi
+ done
+fi
+
+# Default values which can be overridden via 'build.config' file
+tempfs_size=2G
+
+if [[ -f "$PWD"/build.config ]]; then
+ . "$PWD"/build.config
+fi
+
+make_opts+=("TEMPFS_SIZE=$tempfs_size")
+
+if [ -d cert ]; then
+ container_mount_opts+=(-v "$PWD/cert:/builder/cert:ro")
+fi
+
+# Check if builder apparmor profile has to be created or selected
+if [ "$container_engine" = "docker" ] \
+ && [ ! "$apparmor_profile" ] \
+ && out=$(sysctl kernel.apparmor_restrict_unprivileged_userns 2> /dev/null) \
+ && [[ $out = "kernel.apparmor_restrict_unprivileged_userns = 1" ]]; then
+ if [ ! -f /etc/apparmor.d/builder ]; then
+ echo "You are using Docker on a system restricting unprivileged user namespaces with apparmor, which prevents a successful build. For more information please refer to the #Usage section in the README."
+ read -r -p "Do you want to permanently create a new apparmor profile at /etc/apparmor.d/builder to solve the issue? [Y/n] " response
+ response=${response,,}
+ if [[ "$response" =~ ^(yes|y)$ ]]; then
+ if [ ! -f /etc/apparmor.d/builder ]; then
+ profile="abi , include profile builder flags=(unconfined) {userns, }"
+ echo "$profile" | sudo tee /etc/apparmor.d/builder > /dev/null
+ sudo apparmor_parser -r -W /etc/apparmor.d/builder
+ fi
+ echo "Created profile builder at /etc/apparmor.d/builder"
+ else
+ echo Abort.
+ exit 1
+ fi
+ fi
+ apparmor_profile=builder
+fi
+
+# Apply apparmor profile if selected
+if [ "$apparmor_profile" ]; then
+ replaced=false
+ for i in "${!container_run_opts[@]}"; do
+ if [ "${container_run_opts[$i]}" = "apparmor=unconfined" ]; then
+ container_run_opts["$i"]="apparmor=$apparmor_profile"
+ replaced=true
+ fi
+ done
+
+ if ! $replaced; then
+ container_run_opts+=(--security-opt "apparmor=$apparmor_profile")
+ fi
+fi
+
+"$container_engine" run --rm "${container_run_opts[@]}" "${container_mount_opts[@]}" "$container_image" ${container_cmd[@]+"${container_cmd[@]}"} fake_xattr make --no-print-directory -C /builder "${make_opts[@]}" "$@" >&3
diff --git a/features/_archgrouped b/features/_archgrouped
new file mode 120000
index 00000000..fdd2adc3
--- /dev/null
+++ b/features/_archgrouped
@@ -0,0 +1 @@
+../gardenlinux/features/_archgrouped
\ No newline at end of file
diff --git a/features/_iso b/features/_iso
deleted file mode 120000
index d7ebec9b..00000000
--- a/features/_iso
+++ /dev/null
@@ -1 +0,0 @@
-../gardenlinux/features/_iso
\ No newline at end of file
diff --git a/features/_iso/README.md b/features/_iso/README.md
new file mode 100644
index 00000000..41b572d0
--- /dev/null
+++ b/features/_iso/README.md
@@ -0,0 +1,21 @@
+## Feature: _iso
+
+## !! USE THIS FOR DEMO PURPOSES ONLY !!
+
+### Description
+
+
+This feature flag creates an `.iso` artifact of Garden Linux.
+The root user has a hardcoded password _gardenlinux_
+
+
+### Features
+This feature simply creates a bootable `.iso` image as an additional artifact.
+
+### Meta
+|||
+|---|---|
+|type|flag|
+|artifact|None|
+|included_features|None|
+|excluded_features|None|
diff --git a/features/_iso/exec.config b/features/_iso/exec.config
new file mode 100755
index 00000000..c8536047
--- /dev/null
+++ b/features/_iso/exec.config
@@ -0,0 +1 @@
+echo "root:gardenlinux" | chpasswd -c YESCRYPT
diff --git a/features/_iso/file.include/etc/kernel/cmdline.d/99-serial.cfg b/features/_iso/file.include/etc/kernel/cmdline.d/99-serial.cfg
new file mode 100644
index 00000000..e438d02d
--- /dev/null
+++ b/features/_iso/file.include/etc/kernel/cmdline.d/99-serial.cfg
@@ -0,0 +1 @@
+CMDLINE_LINUX="$CMDLINE_LINUX console=ttyS0,115200"
diff --git a/features/_iso/file.include/opt/install/install.sh b/features/_iso/file.include/opt/install/install.sh
new file mode 100755
index 00000000..906f4831
--- /dev/null
+++ b/features/_iso/file.include/opt/install/install.sh
@@ -0,0 +1,59 @@
+#!/usr/bin/env bash
+set -ue
+
+thisDir=$(readlink -f $(dirname "${BASH_SOURCE[0]}"))
+
+targetDisk="$1"
+
+pushd "$thisDir"
+
+# remove all HD related boot entries
+for e in $(efibootmgr | awk '$NF ~ /^HD/ { print $1 }' | sed "s/Boot\([0-9A-F]*\)./\1/"); do
+ echo "Removing entry $e"
+ efibootmgr -B -b "$e" > /dev/null
+done
+
+# prepare disk for repart
+sgdisk -Z "$targetDisk"
+sgdisk -o "$targetDisk"
+
+# actually partition and populate with data
+mkdir -p /run/source
+mount --bind / /run/source
+systemd-repart --definitions repart/ --json=pretty --dry-run=off --copy-source=/run/source/ "$targetDisk"
+
+sleep 5
+
+# prepare mounts for chroot env
+target="/run/chroot"
+mkdir "$target"
+mount /dev/disk/by-label/ROOT "$target"
+mount /dev/disk/by-label/ESP "$target/efi"
+
+# prepare extra mounts
+pushd "$target" > /dev/null
+mount -t proc proc proc
+mount -t sysfs sys sys
+mount --bind /dev dev
+
+# regenerate initrd and generate loader entries
+chroot "$target" dracut -f /boot/initrd.img-"$(uname -r)"
+
+if mount --bind /sys/firmware/efi/efivars "$target/sys/firmware/efi/efivars"; then
+ # efi
+ chroot "$target" bootctl install
+ chroot "$target" kernel-install add "$(uname -r)" "/boot/vmlinuz-$(uname -r)" "/boot/initrd.img-$(uname -r)"
+else
+ # legacy
+ chroot "${target}" sfdisk --part-attrs "${targetDisk}" 1 LegacyBIOSBootable
+ chroot "${target}" dd if="/usr/lib/SYSLINUX/gptmbr.bin" of="${targetDisk}" bs=440 count=1 conv=notrunc
+ chroot "${target}" mkdir -p /efi/syslinux
+ chroot "${target}" cp /usr/lib/syslinux/modules/bios/menu.c32 /efi/syslinux/
+ chroot "${target}" cp /usr/lib/syslinux/modules/bios/libutil.c32 /efi/syslinux/
+ chroot "${target}" syslinux --directory syslinux --install /dev/disk/by-label/ESP
+ mkdir /run/chroot/efi/Default
+ chroot "$target" kernel-install add "$(uname -r)" "/boot/vmlinuz-$(uname -r)" "/boot/initrd.img-$(uname -r)"
+ chroot "${target}" update-syslinux
+fi
+
+echo "Safe to reboot"
diff --git a/features/_iso/file.include/opt/install/repart/00-efi.conf b/features/_iso/file.include/opt/install/repart/00-efi.conf
new file mode 100644
index 00000000..d71d8caa
--- /dev/null
+++ b/features/_iso/file.include/opt/install/repart/00-efi.conf
@@ -0,0 +1,8 @@
+# modify only the size to fit your needs
+[Partition]
+Type=esp
+Format=vfat
+SizeMinBytes=1024M
+SizeMaxBytes=1024M
+Label=ESP
+MountPoint=/efi
diff --git a/features/_iso/file.include/opt/install/repart/10-root.conf b/features/_iso/file.include/opt/install/repart/10-root.conf
new file mode 100644
index 00000000..617337f0
--- /dev/null
+++ b/features/_iso/file.include/opt/install/repart/10-root.conf
@@ -0,0 +1,9 @@
+# modify only the size to fit your needs, do not specify the size to use whatever space is left on disk
+[Partition]
+Type=root
+#SizeMinBytes=2G
+#SizeMaxBytes=2G
+CopyFiles=/
+CopyFiles=/boot
+Label=ROOT
+MountPoint=/
diff --git a/features/_iso/image.iso b/features/_iso/image.iso
new file mode 100755
index 00000000..2c875f5a
--- /dev/null
+++ b/features/_iso/image.iso
@@ -0,0 +1,85 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+input="$(realpath -- "$1")"
+output="$(realpath -- "$2")"
+
+dir="$(mktemp -d)"
+pushd "$dir" > /dev/null
+
+export PATH="/builder/image.d:$PATH"
+
+chroot_dir="$(mktemp -d)"
+mount -t tmpfs tmpfs "$chroot_dir"
+tar --extract --xattrs --xattrs-include '*' --directory "$chroot_dir" < "$input"
+
+mount --rbind --make-rprivate /proc "$chroot_dir/proc"
+mount --rbind --make-rprivate /sys "$chroot_dir/sys"
+mount --rbind --make-rprivate /dev "$chroot_dir/dev"
+mount --bind /usr/bin/false "${chroot_dir}/usr/bin/systemd-detect-virt"
+
+kernel=$(echo "${chroot_dir}"/boot/vmlinuz-* | tr " " '\n' | cut -d- -f 2- | sort -V | tail -1)
+chroot "$chroot_dir" dracut -f /tmp/initrd "${kernel}" -m "bash systemd systemd-initrd kernel-modules kernel-modules-extra terminfo dracut-systemd shutdown dmsquash-live" --reproducible
+
+# we use ukify because dracut 059 and systemd 254 don't mix, dracut generate a broken uki
+# https://github.com/dracutdevs/dracut/issues/2431
+# TODO: fix when dracut is fixed
+#chroot "${chroot_dir}" dracut -f /tmp/unified ${kernel} --uefi --kernel-cmdline "console=tty0 console=ttyS0,115200 rd.live.squashimg=squashfs.img root=live:CDLABEL=GardenlinuxISO rd.live.overlay.overlayfs rd.live.dir=live rd.live.ram" -m "bash systemd systemd-initrd kernel-modules kernel-modules-extra terminfo dracut-systemd shutdown dmsquash-live" --reproducible
+chroot "${chroot_dir}" /lib/systemd/ukify build --output=/tmp/unified --linux=/boot/vmlinuz-"${kernel}" --initrd=/tmp/initrd --cmdline="console=tty0 console=ttyS0,115200 rd.live.squashimg=squashfs.img root=live:CDLABEL=GardenlinuxISO rd.live.overlay.overlayfs rd.live.dir=live rd.live.ram"
+
+umount -l "$chroot_dir/proc"
+umount -l "$chroot_dir/sys"
+umount -l "$chroot_dir/dev"
+umount "${chroot_dir}/usr/bin/systemd-detect-virt"
+
+mkdir CD_root
+mkdir CD_root/{isolinux,images,kernel,boot,boot/images,boot/syslinux,live}
+
+mksquashfs "$chroot_dir" "CD_root/live/squashfs.img" -comp lzo
+cp "${chroot_dir}/boot/"vmlinuz* "CD_root/boot/images/vmlinuz"
+mv "${chroot_dir}/tmp/"initrd* "CD_root/boot/images/initrd"
+mv "${chroot_dir}/tmp/unified" bootx64.efi
+
+#TODO: determine proper size
+dd if=/dev/zero of=efiboot.img bs=512 count=131072
+mkfs.msdos -F 16 -n 'EFIBOOTISO' efiboot.img
+mmd -i efiboot.img ::EFI
+mmd -i efiboot.img ::EFI/BOOT
+mcopy -i efiboot.img bootx64.efi ::EFI/BOOT/BOOTX64.EFI
+
+mv efiboot.img CD_root/isolinux/
+cp "${chroot_dir}/usr/lib/ISOLINUX/isolinux.bin" CD_root/isolinux/
+cp "${chroot_dir}/usr/lib/ISOLINUX/isohdpfx.bin" CD_root/isolinux/
+cp "${chroot_dir}/usr/lib/syslinux/modules/bios/ldlinux.c32" CD_root/isolinux
+
+cat << EOF > CD_root/isolinux/isolinux.cfg
+PATH /boot/syslinux
+DEFAULT loadconfig
+
+LABEL loadconfig
+ CONFIG /boot/syslinux/syslinux.cfg
+EOF
+
+cat << EOF > CD_root/boot/syslinux/syslinux.cfg
+MENU TITLE gardenlinux
+DEFAULT GardenlinuxRam
+
+LABEL GardenlinuxRam
+MENU LABEL Gardenlinux Live in RAM
+LINUX /boot/images/vmlinuz console=tty0 console=ttyS0,115200 rd.live.squashimg=squashfs.img root=live:CDLABEL=GardenlinuxISO rd.live.overlay.overlayfs rd.live.dir=live rd.live.ram
+INITRD /boot/images/initrd
+EOF
+
+# TODO: make this reproducible
+xorriso -as mkisofs \
+ -volid "GardenlinuxISO" \
+ -o "${output}" \
+ -isohybrid-mbr "${chroot_dir}/usr/lib/ISOLINUX/isohdpfx.bin" \
+ -c isolinux/boot.cat \
+ -b isolinux/isolinux.bin \
+ -no-emul-boot -boot-load-size 4 -boot-info-table \
+ -eltorito-alt-boot \
+ -e isolinux/efiboot.img \
+ -no-emul-boot \
+ -isohybrid-gpt-basdat \
+ CD_root
diff --git a/features/_iso/info.yaml b/features/_iso/info.yaml
new file mode 100644
index 00000000..302d84a9
--- /dev/null
+++ b/features/_iso/info.yaml
@@ -0,0 +1,6 @@
+description: "iso"
+type: flag
+features:
+ exclude:
+ - _selinux
+ - sap
diff --git a/features/_iso/pkg.include b/features/_iso/pkg.include
new file mode 100644
index 00000000..b70528d8
--- /dev/null
+++ b/features/_iso/pkg.include
@@ -0,0 +1,8 @@
+dracut
+dracut-core
+dracut-live
+binutils
+isolinux
+python3-pefile
+systemd-ukify
+gdisk
diff --git a/features/_iso/test/autologin.disable b/features/_iso/test/autologin.disable
new file mode 100644
index 00000000..e69de29b
diff --git a/features/_iso/test/test_capabilities.py b/features/_iso/test/test_capabilities.py
new file mode 100644
index 00000000..c0048aee
--- /dev/null
+++ b/features/_iso/test/test_capabilities.py
@@ -0,0 +1 @@
+from helper.tests.capabilities import capabilities as test_capabilities
diff --git a/features/_iso/test/test_packages_musthave.py b/features/_iso/test/test_packages_musthave.py
new file mode 100644
index 00000000..4b2783d2
--- /dev/null
+++ b/features/_iso/test/test_packages_musthave.py
@@ -0,0 +1 @@
+from helper.tests.packages_musthave import packages_musthave as test_packages_musthave
diff --git a/features/_kvmBase/README.md b/features/_kvmBase/README.md
new file mode 100644
index 00000000..e7eb587a
--- /dev/null
+++ b/features/_kvmBase/README.md
@@ -0,0 +1,7 @@
+## Feature: __kvmBase
+
+### Description
+
+
+This platform feature flag adds support for KVM.
+
diff --git a/features/_kvmBase/exec.config b/features/_kvmBase/exec.config
new file mode 100755
index 00000000..3a7b478a
--- /dev/null
+++ b/features/_kvmBase/exec.config
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+set -Eeuo pipefail
+
+# install custom packages
+# TODO : these all should go in the repo
+
+# all versions URL encoded
+EDK2_VERSION="20260221+261104-1gl0+bp1877"
+
+download_build_artefacts() {
+ local url=$1
+ local dest=$2
+ echo "Downloading and extracting package from $url"
+ wget -q "$url" -O - | xz -d | tar xf - -C "$dest"
+ (
+ cd "$dest"
+ rm -f -- *dbgsym* *arm64* *.tar.xz || true
+ )
+}
+
+version_to_debversion() {
+ local version=$1
+ # convert the rightmost + to ~
+ echo "${version%+*}~${version##*+}"
+}
+
+mkdir -p /tmp/custompackages
+for p in https://github.com/gardenlinux/package-edk2-cloud-hypervisor-gl/releases/download/$EDK2_VERSION/build.tar.xz.0000; do
+ download_build_artefacts "$p" /tmp/custompackages
+done
+
+pushd /tmp/custompackages > /dev/null
+
+ls -1
+dpkg -i \
+ edk2-cloud-hypervisor-gl*_amd64.deb
+
+popd > /dev/null
+rm -rf /tmp/custompackages
diff --git a/features/_kvmBase/info.yaml b/features/_kvmBase/info.yaml
new file mode 100644
index 00000000..f692775d
--- /dev/null
+++ b/features/_kvmBase/info.yaml
@@ -0,0 +1,2 @@
+description: "KVM Base Flag"
+type: flag
diff --git a/features/_kvmBase/pkg.include b/features/_kvmBase/pkg.include
new file mode 100644
index 00000000..141b2f69
--- /dev/null
+++ b/features/_kvmBase/pkg.include
@@ -0,0 +1,15 @@
+dmidecode
+dnsmasq-base
+libgoogle-perftools4
+libtcmalloc-minimal4
+libxml2-utils
+swtpm
+wget
+xz-utils
+# dependencies of libvirt
+gettext-base
+libiscsi7
+libpciaccess0
+libssh-4
+libxml2-utils
+mdevctl
diff --git a/features/_kvmCh/README.md b/features/_kvmCh/README.md
new file mode 100644
index 00000000..04bc84b4
--- /dev/null
+++ b/features/_kvmCh/README.md
@@ -0,0 +1,7 @@
+## Feature: __kvmCh
+
+### Description
+
+
+This platform feature flag adds support for KVM using Cloud Hypervisor and libvirt.
+
diff --git a/features/_kvmCh/exec.config b/features/_kvmCh/exec.config
new file mode 100755
index 00000000..163d9739
--- /dev/null
+++ b/features/_kvmCh/exec.config
@@ -0,0 +1,60 @@
+#!/usr/bin/env bash
+
+set -Eeuo pipefail
+
+# install custom packages
+# TODO : these all should go in the repo
+LIBVIRT_VERSION="12.7.0+261104-1gl0+bp1877"
+CLOUD_HYPERVISOR_VERSION="52.1+261104-1gl0+bp1877"
+
+download_build_artefacts() {
+ local url=$1
+ local dest=$2
+ echo "Downloading and extracting package from $url"
+ wget -q "$url" -O - | xz -d | tar xf - -C "$dest"
+ (
+ cd "$dest"
+ rm -f -- *dbgsym* *arm64* *.tar.xz || true
+ )
+}
+
+version_to_debversion() {
+ local version=$1
+ # convert the rightmost + to ~
+ echo "${version%+*}~${version##*+}"
+}
+
+mkdir -p /tmp/custompackages
+for p in https://github.com/gardenlinux/package-libvirt/releases/download/$LIBVIRT_VERSION/build.tar.xz.0000 https://github.com/gardenlinux/package-cloud-hypervisor-gl/releases/download/$CLOUD_HYPERVISOR_VERSION/build.tar.xz.0000; do
+ download_build_artefacts "$p" /tmp/custompackages
+done
+
+LIBVIRT_VERSION_DEB=$(version_to_debversion "$LIBVIRT_VERSION")
+#CLOUD_HYPERVISOR_VERSION_DEB=$(version_to_debversion "$CLOUD_HYPERVISOR_VERSION")
+
+pushd /tmp/custompackages > /dev/null
+ls -1
+dpkg -i \
+ cloud-hypervisor-gl*_amd64.deb \
+ "libvirt-common_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt0_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-common_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-config-network_${LIBVIRT_VERSION_DEB}_all.deb" \
+ "libvirt-daemon-config-nwfilter_${LIBVIRT_VERSION_DEB}_all.deb" \
+ "libvirt-daemon-driver-ch-gl_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-network_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-nodedev_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-nwfilter_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-secret_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage-disk_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage-iscsi-direct_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage-iscsi_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage-logical_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage-mpath_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage-scsi_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-log_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-clients_${LIBVIRT_VERSION_DEB}_amd64.deb"
+popd > /dev/null
+rm -rf /tmp/custompackages
diff --git a/features/_kvmCh/info.yaml b/features/_kvmCh/info.yaml
new file mode 100644
index 00000000..2b4e659a
--- /dev/null
+++ b/features/_kvmCh/info.yaml
@@ -0,0 +1,5 @@
+description: "KVM Cloud Hypervisor Flag"
+type: flag
+features:
+ include:
+ - _kvmBase
diff --git a/features/_kvmCh/pkg.include b/features/_kvmCh/pkg.include
new file mode 100644
index 00000000..5e9dd6ea
--- /dev/null
+++ b/features/_kvmCh/pkg.include
@@ -0,0 +1,2 @@
+# libvirt deps
+systemd-container
diff --git a/features/_kvmQemu/README.md b/features/_kvmQemu/README.md
new file mode 100644
index 00000000..470dc22f
--- /dev/null
+++ b/features/_kvmQemu/README.md
@@ -0,0 +1,7 @@
+## Feature: __kvmQemu
+
+### Description
+
+
+This platform feature flag adds support for KVM using QEMU and libvirt.
+
diff --git a/features/_kvmQemu/exec.config b/features/_kvmQemu/exec.config
new file mode 100755
index 00000000..8663e012
--- /dev/null
+++ b/features/_kvmQemu/exec.config
@@ -0,0 +1,63 @@
+#!/usr/bin/env bash
+
+set -Eeuo pipefail
+
+# install custom packages
+# TODO : these all should go in the repo
+LIBVIRT_VERSION="12.7.0+261104-1gl0+bp1877"
+
+download_build_artefacts() {
+ local url=$1
+ local dest=$2
+ echo "Downloading and extracting package from $url"
+ wget -q "$url" -O - | xz -d | tar xf - -C "$dest"
+ (
+ cd "$dest"
+ rm -f -- *dbgsym* *arm64* *.tar.xz || true
+ )
+}
+
+version_to_debversion() {
+ local version=$1
+ # convert the rightmost + to ~
+ echo "${version%+*}~${version##*+}"
+}
+
+mkdir -p /tmp/custompackages
+for p in https://github.com/gardenlinux/package-libvirt/releases/download/$LIBVIRT_VERSION/build.tar.xz.0000; do
+ download_build_artefacts "$p" /tmp/custompackages
+done
+
+LIBVIRT_VERSION_DEB=$(version_to_debversion "$LIBVIRT_VERSION")
+
+pushd /tmp/custompackages > /dev/null
+ls -1
+dpkg -i \
+ "libvirt-common_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt0_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-common_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-config-network_${LIBVIRT_VERSION_DEB}_all.deb" \
+ "libvirt-daemon-config-nwfilter_${LIBVIRT_VERSION_DEB}_all.deb" \
+ "libvirt-daemon-driver-network_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-nodedev_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-nwfilter_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-qemu_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-secret_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage-disk_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage-iscsi-direct_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage-iscsi_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage-logical_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage-mpath_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage-scsi_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-driver-storage_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-log_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon-system-systemd_${LIBVIRT_VERSION_DEB}_all.deb" \
+ "libvirt-daemon-system_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-daemon_${LIBVIRT_VERSION_DEB}_amd64.deb" \
+ "libvirt-clients_${LIBVIRT_VERSION_DEB}_amd64.deb"
+popd > /dev/null
+rm -rf /tmp/custompackages
+
+# limit vnc port autorange to possible kubernetes nodeports
+sed -i 's/#remote_display_port_min = 5900/remote_display_port_min = 32200/' /etc/libvirt/qemu.conf
+sed -i 's/#remote_display_port_max = 65535/remote_display_port_max = 32299/' /etc/libvirt/qemu.conf
diff --git a/features/_kvmQemu/info.yaml b/features/_kvmQemu/info.yaml
new file mode 100644
index 00000000..b92aa14e
--- /dev/null
+++ b/features/_kvmQemu/info.yaml
@@ -0,0 +1,5 @@
+description: "KVM Qemu Flag"
+type: flag
+features:
+ include:
+ - _kvmBase
diff --git a/features/_kvmQemu/pkg.include b/features/_kvmQemu/pkg.include
new file mode 100644
index 00000000..35980f6d
--- /dev/null
+++ b/features/_kvmQemu/pkg.include
@@ -0,0 +1,6 @@
+$(if [ $arch = amd64 ]; then echo ovmf; fi)
+$(if [ $arch = arm64 ]; then echo qemu-efi-aarch64; fi)
+$(if [ $arch = amd64 ]; then echo qemu-system-x86; fi)
+$(if [ $arch = arm64 ]; then echo qemu-system-arm; fi)
+qemu-utils
+qemu-block-extra
diff --git a/features/_pxe/file.include/usr/lib/dracut/modules.d/98gardenlinux-live/live-get-squashfs.sh b/features/_pxe/file.include/usr/lib/dracut/modules.d/98gardenlinux-live/live-get-squashfs.sh
index 818d0f38..bc30d2c7 100755
--- a/features/_pxe/file.include/usr/lib/dracut/modules.d/98gardenlinux-live/live-get-squashfs.sh
+++ b/features/_pxe/file.include/usr/lib/dracut/modules.d/98gardenlinux-live/live-get-squashfs.sh
@@ -27,7 +27,7 @@ if [ ! -f "${shaFile}" ]; then
exit 1
fi
-if ! echo "$(grep . ${shaFile}) ${squashFile}" | sha256sum --status --check; then
+if ! echo "$(grep . ${shaFile}) ${squashFile}" | sha256sum --status --check -; then
warn "the hash verification of the squashfs has failed - exiting"
exit 1
fi
diff --git a/features/_rescue/file.include/etc/systemd/system/emergency.service.d/debugprint.conf b/features/_rescue/file.include/etc/systemd/system/emergency.service.d/debugprint.conf
index fd70fadb..2b7feac7 100644
--- a/features/_rescue/file.include/etc/systemd/system/emergency.service.d/debugprint.conf
+++ b/features/_rescue/file.include/etc/systemd/system/emergency.service.d/debugprint.conf
@@ -2,9 +2,8 @@
StandardOutput=journal+console
StandardError=journal+console
ExecStartPre=/bin/sh -c ' \
- systemctl --failed --no-legend --no-pager | awk "{print \$2}" | \
- xargs -r -I{} sh -c " \
- echo \"\\n=== FAILED UNIT: {} ===\\n\"; \
- journalctl -b -u {} --no-pager || true; \
- "'
+ for unit in $(systemctl --failed --no-legend --no-pager | awk "{print \$2}"); do \
+ echo "\n=== FAILED UNIT: $unit ===\n"; \
+ journalctl -b -u "$unit" --no-pager || true; \
+ done'
TimeoutStartSec=20s
diff --git a/features/_scicommon/exec.config b/features/_scicommon/exec.config
index c67667e1..d18e272c 100755
--- a/features/_scicommon/exec.config
+++ b/features/_scicommon/exec.config
@@ -12,19 +12,19 @@ for feature in "${FEATURES[@]}"; do
done
# capi versions: https://github.com/kubernetes-sigs/cri-tools/releases
-CAPI_VERSION=v1.33.0
+CAPI_VERSION=v1.35.0
K8S_VERSION_REPO="${CAPI_VERSION%.*}"
# key can be downloaded liek e.g.
# curl -fsSL https://pkgs.k8s.io/core:/stable:/${K8S_VERSION_REPO}/deb/Release.key > pkgs-k8s-io_${K8S_VERSION_REPO}_release.key
-gpg --dearmor -o "/etc/apt/keyrings/kubernetes-${K8S_VERSION_REPO}-apt-keyring.gpg" <"/builder/features/_scicommon/pkgs-k8s-io_${K8S_VERSION_REPO}_release.key"
+cp "/builder/features/_scicommon/pkgs-k8s-io_${K8S_VERSION_REPO}_release.key" "/etc/apt/keyrings/kubernetes-${K8S_VERSION_REPO}-apt-keyring.asc"
cat < /dev/null
+dpkg -i ignition_*_amd64.deb
+popd > /dev/null
+rm -rf "$TEMP_DIR"
diff --git a/features/_usi/file.exclude b/features/_usi/file.exclude
index 9c50a71c..86e0873c 100644
--- a/features/_usi/file.exclude
+++ b/features/_usi/file.exclude
@@ -6,3 +6,8 @@
#/opt/{,.}*
#/home/{,.}*
/root/{,.}*
+/etc/cron.daily/apt-compat
+/etc/cron.daily/dpkg
+/etc/cron.daily/quota
+/etc/cron.monthly/update-pciids
+/etc/cron.monthly/update-usbids
diff --git a/features/_usi/file.include/etc/systemd/system-preset/00-systemd-usi.preset b/features/_usi/file.include/etc/systemd/system-preset/00-systemd-usi.preset
index 56084989..55578a5e 100644
--- a/features/_usi/file.include/etc/systemd/system-preset/00-systemd-usi.preset
+++ b/features/_usi/file.include/etc/systemd/system-preset/00-systemd-usi.preset
@@ -2,4 +2,6 @@
disable apt-daily.timer
disable dpkg-db-backup.timer
disable systemd-sysupdate-reboot.timer
+disable systemd-sysupdate-reboot.service
disable systemd-sysupdate.timer
+disable systemd-sysupdate.service
diff --git a/features/_usi/file.include/etc/systemd/system/dbgimport.service b/features/_usi/file.include/etc/systemd/system/dbgimport.service
new file mode 100644
index 00000000..2b84b937
--- /dev/null
+++ b/features/_usi/file.include/etc/systemd/system/dbgimport.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Import debug container image
+ConditionPathExists=|/opt/dbgimage/debug.tar
+ConditionFirstBoot=yes
+After=containerd.service
+Requires=containerd.service
+
+[Service]
+ExecStart=/bin/sh -c 'ctr image import --base-name "$(cat /opt/dbgimage/debug.tar.name)" /opt/dbgimage/debug.tar && rm -f /opt/dbgimage/debug.tar && rm -f /opt/dbgimage/debug.tar.name && rm -f /opt/dbgimage/image'
+Type=oneshot
+
+[Install]
+WantedBy=multi-user.target
diff --git a/features/_usi/file.include/etc/systemd/system/systemd-repart.service b/features/_usi/file.include/etc/systemd/system/systemd-repart.service
new file mode 120000
index 00000000..dc1dc0cd
--- /dev/null
+++ b/features/_usi/file.include/etc/systemd/system/systemd-repart.service
@@ -0,0 +1 @@
+/dev/null
\ No newline at end of file
diff --git a/features/_usi/initrd.include/etc/systemd/system/systemd-repart.service b/features/_usi/initrd.include/etc/systemd/system/systemd-repart.service
new file mode 120000
index 00000000..dc1dc0cd
--- /dev/null
+++ b/features/_usi/initrd.include/etc/systemd/system/systemd-repart.service
@@ -0,0 +1 @@
+/dev/null
\ No newline at end of file
diff --git a/features/_usi/initrd.include/usr/bin/detect_disk b/features/_usi/initrd.include/usr/bin/detect_disk
index 0a8fb937..d061a300 100755
--- a/features/_usi/initrd.include/usr/bin/detect_disk
+++ b/features/_usi/initrd.include/usr/bin/detect_disk
@@ -4,10 +4,6 @@ set -Eeuo pipefail
ROOT_HINTS_FILE="/sysroot/opt/persist/root-hints.yaml"
-if ! [[ -f $ROOT_HINTS_FILE ]]; then
- echo "no root-hints.yaml provided, error"
- exit 1
-fi
if kname=$(/usr/bin/root-hints $ROOT_HINTS_FILE); then
echo "/dev/${kname}"
else
diff --git a/features/_usi/initrd.include/usr/bin/persist b/features/_usi/initrd.include/usr/bin/persist
index ad950446..aa7dd4a4 100755
--- a/features/_usi/initrd.include/usr/bin/persist
+++ b/features/_usi/initrd.include/usr/bin/persist
@@ -6,6 +6,11 @@ if ! disk_dev=$(/usr/bin/detect_disk); then
exit 1
fi
+if [[ ! -b "$disk_dev" ]]; then
+ echo "Device $disk_dev not found, exiting"
+ exit 1
+fi
+
# clean up the disk
sgdisk -Z "$disk_dev"
sgdisk -o "$disk_dev"
@@ -20,9 +25,10 @@ case "$(uname -m)" in
esac
# prepare bootloader
-esp_dir="/sysroot/efi"
+sysroot="/sysroot"
+esp_dir="$sysroot/efi"
mkdir -p "$esp_dir/EFI/BOOT"
-cp "/sysroot/usr/lib/systemd/boot/efi/systemd-boot$(tr '[:upper:]' '[:lower:]' <<< "$uefi_arch").efi" "$esp_dir/EFI/BOOT/BOOT$uefi_arch.EFI"
+cp "$sysroot/usr/lib/systemd/boot/efi/systemd-boot$(tr '[:upper:]' '[:lower:]' <<< "$uefi_arch").efi" "$esp_dir/EFI/BOOT/BOOT$uefi_arch.EFI"
mkdir -p "$esp_dir/loader"
cat > "$esp_dir/loader/loader.conf" << EOF
@@ -70,30 +76,142 @@ export HOME=/root
# source optional config file
[ -f /sysroot/opt/persist/gl-oci.conf ] && . /sysroot/opt/persist/gl-oci.conf
-OCI_REPO="${OCI_REPO:-keppel.global.cloud.sap/ccloud-ghcr-io-mirror/gardenlinux/gardenlinux-ccloud}"
+OCI_REPO="${OCI_REPO:-keppel.global.cloud.sap/ccloud-ghcr-io-mirror/gardenlinux/gardenlinux-sci}"
DASHED_GARDENLINUX_VERSION=${GARDENLINUX_VERSION//./-}
# setup OCI_TAG, UKI_SHA and fetch UKI
OCI_TAG=${OCI_TAG:-"$GARDENLINUX_VERSION-$VARIANT_ID-${DASHED_GARDENLINUX_VERSION}-$GARDENLINUX_COMMIT_ID"}
OCI_TAG=${OCI_TAG//_/-} # replace underscores with dashes
UKI_SHA=$(oras manifest fetch "$OCI_REPO:${OCI_TAG}" | jq -r '.layers[] | select(.mediaType=="application/io.gardenlinux.uki") | .digest')
-oras blob fetch "$OCI_REPO@$UKI_SHA" -o "$esp_dir/EFI/Linux/uki.efi"
+oras blob fetch "$OCI_REPO@$UKI_SHA" -o "$esp_dir/EFI/Linux/${GARDENLINUX_CNAME}.efi"
+
+addon_dir="$esp_dir/loader/addons"
+
+create_addon_from_stub() {
+ local name=${1:?usage: make_systemd_cmdline_addon NAME 'CMDLINE'}
+ local cmdline=${2:?usage: make_systemd_cmdline_addon NAME 'CMDLINE'}
+
+ # Target installation root and the systemd EFI addon template.
+ local stub="$sysroot/usr/lib/systemd/boot/efi/addonx64.efi.stub"
+
+ local addon cmdline_file
+ local alignment_hex alignment
+ local idx section size_hex vma_hex
+ local size vma end max_end next_vma next_vma_hex
+
+ # Keep writes confined to addon_dir. Permit "foo" or "foo.addon.efi".
+ [[ $name != */* && $name != .* && -n $name ]] || {
+ printf 'Invalid addon name: %q\n' "$name" >&2
+ return 2
+ }
+
+ [[ $name == *.addon.efi ]] || name="${name}.addon.efi"
+
+ [[ -r $stub ]] || {
+ printf 'Cannot read systemd addon stub: %s\n' "$stub" >&2
+ return 1
+ }
+
+ mkdir -p -- "$addon_dir" || return 1
+ addon="$addon_dir/$name"
+
+ tmpdir="/tmp/$(basename "$0").$RANDOM"
+ trap 'rm -rf -- "$tmpdir"' RETURN
+ mkdir -p "$tmpdir"
+ cmdline_file="$tmpdir/cmdline"
+
+ # systemd-stub expects UTF-8/ASCII kernel parameters as a NUL-terminated
+ # string in the PE .cmdline section. Do not add a trailing newline.
+ printf '%s\0' "$cmdline" >"$cmdline_file" || return 1
+
+ # BusyBox awk-compatible: it only extracts the field; Bash converts hex.
+ alignment_hex=$(
+ objdump -p "$stub" |
+ awk '$1 == "SectionAlignment" { print $2; exit }'
+ )
+
+ [[ $alignment_hex =~ ^[0-9A-Fa-f]+$ ]] || {
+ printf 'Could not read PE SectionAlignment from: %s\n' "$stub" >&2
+ return 1
+ }
+
+ alignment=$((16#$alignment_hex))
+
+ (( alignment > 0 )) || {
+ printf 'Invalid PE SectionAlignment: %s\n' "$alignment_hex" >&2
+ return 1
+ }
+
+ # Compute:
+ #
+ # max_end = max(existing_section_VMA + existing_section_size)
+ # next_vma = align_up(max_end, SectionAlignment)
+ #
+ # This avoids assuming objdump lists sections in VMA order. BusyBox awk
+ # filters/prints fields only; Bash handles all hexadecimal arithmetic.
+ max_end=0
+
+ while read -r idx section size_hex vma_hex; do
+ [[ $idx =~ ^[0-9]+$ ]] || continue
+ [[ $size_hex =~ ^[0-9A-Fa-f]+$ ]] || continue
+ [[ $vma_hex =~ ^[0-9A-Fa-f]+$ ]] || continue
+
+ size=$((16#$size_hex))
+ vma=$((16#$vma_hex))
+ end=$((vma + size))
+
+ (( end > max_end )) && max_end=$end
+ done < <(
+ objdump -h "$stub" |
+ awk '$1 ~ /^[0-9]+$/ { print $1, $2, $3, $4 }'
+ )
+
+ (( max_end > 0 )) || {
+ printf 'Could not determine existing PE section layout: %s\n' "$stub" >&2
+ return 1
+ }
+
+ next_vma=$(( (max_end + alignment - 1) / alignment * alignment ))
+ printf -v next_vma_hex '0x%x' "$next_vma"
+
+ # Build to a temporary pathname and atomically move it into place.
+ objcopy \
+ --add-section ".cmdline=$cmdline_file" \
+ --change-section-vma ".cmdline=$next_vma_hex" \
+ --set-section-alignment ".cmdline=$alignment" \
+ --set-section-flags ".cmdline=alloc,load,readonly,data,contents" \
+ "$stub" "$tmpdir/$name" || return 1
+
+ mv -f -- "$tmpdir/$name" "$addon" || return 1
+
+ printf 'Created addon: %s\n' "$addon"
+ printf ' SectionAlignment: 0x%x\n' "$alignment"
+ printf ' .cmdline RVA: %s\n' "$next_vma_hex"
+}
+
+# if intel cpu
+if grep -q "GenuineIntel" /proc/cpuinfo; then
+ create_addon_from_stub "disable-intel-idle-states" "intel_idle.max_cstate=0"
+fi
if [ "$ENABLE_HUGEPAGE_SETUP" = "true" ]; then
- echo "hugepagesz=2MB hugepages=$hugepages" > /tmp/cmdlinef
- addon="/sysroot/usr/lib/systemd/boot/efi/addonx64.efi.stub"
- offs=$(objdump -h $addon | awk 'NF==7 {size=$3;offset=$4} END {print "16#"size" + 16#"offset}')
- if [[ $offs -eq 0 ]]; then
- echo "the offset can't be calculated for the stub addon"
- exit 1
- fi
- align=$(objdump -p $addon | grep Section | awk '{ print "16#"$2}')
- offs=$((offs + "$align" - offs % "$align"))
- addon_dir="$esp_dir/loader/addons"
- mkdir -p "$addon_dir"
- objcopy --add-section .cmdline=/tmp/cmdlinef --change-section-vma .cmdline=$(printf 0x%x $offs) $addon "$addon_dir/hugepages.addon.efi"
+ create_addon_from_stub "hugepages" "hugepagesz=2MB hugepages=$hugepages"
fi
+# debug container
+DBG_CONTAINER_IMPORT="/sysroot/opt/dbgimage"
+DBG_CONTAINER_IMAGE_DUMP="debug.tar"
+DBG_CONTAINER_FILE="/sysroot/opt/dbgimage/image"
+
+mkdir -p "$DBG_CONTAINER_IMPORT"
+if [ -f "$DBG_CONTAINER_FILE" ]; then
+ oras backup --output "$DBG_CONTAINER_IMPORT/$DBG_CONTAINER_IMAGE_DUMP" "$(cat "$DBG_CONTAINER_FILE")"
+ cat "$DBG_CONTAINER_FILE" | awk -F':' '{print $1}' > "$DBG_CONTAINER_IMPORT/$DBG_CONTAINER_IMAGE_DUMP.name"
+else
+ echo "no container image file provided, skipping..."
+fi
+
+
# Network config generation
if [[ -x /sysroot/opt/persist/network_up.sh ]]; then
chroot /sysroot /opt/persist/network_up.sh
diff --git a/features/_usi/initrd.include/usr/bin/root-hints b/features/_usi/initrd.include/usr/bin/root-hints
index 5186752f..360bac06 100755
--- a/features/_usi/initrd.include/usr/bin/root-hints
+++ b/features/_usi/initrd.include/usr/bin/root-hints
@@ -2,12 +2,17 @@
set -Eeuo pipefail
+# setup error trap
+trap 'err "Error occurred at line $LINENO while executing: $BASH_COMMAND"' ERR
+
function yqroot() {
cat "$1" | chroot /sysroot /usr/bin/yq -c '.hints | .[]'
}
function err() {
echo "$@" 1>&2
+
+ lsblk -bOJ | jq
}
function filter() {
@@ -27,25 +32,94 @@ function filter() {
fi
if [[ $val =~ ^[0-9]+[KMGT]+$ ]]; then
val=$(echo "$val" | numfmt --from=iec)
- echo "and ${col^^} $op ${val}"
+ echo "${col^^} $op ${val}"
else
- echo "and ${col^^} $op \"${val}\""
+ echo "${col^^} $op \"${val}\""
fi
+}
+function blockdevicesize() {
+ local kname="$1"
+ lsblk -bOJ | jq --arg kname "$kname" -r '.blockdevices.[] | select(.kname == $kname).size'
}
+udevadm settle
+
yamlFile="$1"
+esp_disk=""
+if [ -e "/dev/disk/by-label/ESP" ]; then
+ esp_partition=$(basename "$(readlink -f /dev/disk/by-label/ESP)")
+ esp_disk=$(basename "$(readlink -f "/sys/class/block/$esp_partition/..")")
+fi
+
+# TODO: likely go rather with device uuid or alike
#if dev=$(yq -e .dev "$yamlFile" 2> /dev/null); then
# echo "$dev"
# exit 0
#fi
-flsblk="TYPE eq \"disk\""
-while IFS= read -r r; do
- f=$(filter "$r")
- flsblk="$flsblk $f"
-done < <(yqroot "$yamlFile" )
+declare -a flsblk=()
+# check if yaml file exists and is valid, if so, use it to build the filter for lsblk
+if [ -f "$yamlFile" ] && yq -e . "$yamlFile" >/dev/null 2>&1; then
+ while IFS= read -r r; do
+ flsblk+=("$(filter "$r")")
+ done < <(yqroot "$yamlFile")
+fi
+
+LSBLK_JSON=""
+
+function join {
+ local SEPARATOR="$1"
+ shift
+ printf "%s${SEPARATOR}" "$@" | sed --unbuffered "s/${SEPARATOR}$//"
+}
+
+# if flsblk contains elements, we join them by 'and' and use the filter with lsblk
+if [ ${#flsblk[@]} -gt 0 ]; then
+ flsfilter=$(join " and " "${flsblk[@]}")
+ echo "Using filter: $flsfilter" 1>&2
+ LSBLK_JSON=$(lsblk --sort size --exclude 1,2,3,4,7,11 --filter "$flsfilter" -OJ)
+else
+ # no hints, hence we choose the smallest disk we find. we exclude ram disk,
+ # floppy, ide, dynamically allocated, loopback and scsi cd-rom devices
+ LSBLK_JSON=$(lsblk --sort size --exclude 1,2,3,4,7,11 -OJ)
+fi
-#echo "$flsblk"
-lsblk --filter "$flsblk" --noheadings -o kname
+# from the resulting list of disks we pick the first disk that are writeable
+kname=$(echo "$LSBLK_JSON" | jq -r '[.blockdevices.[]|select(.type? == "disk" and .ro? == false)][0].kname // ""')
+
+# check which disk to use.
+# 1. if kname is empty:
+# * we check if we have an esp_disk, if so we use it
+# * otherwise we fail
+# 2. if kname is not empty:
+# * we check if we have an esp_disk, if not we use
+# * kname, otherwise we check if they are the same, if not we fail, otherwise we use kname/esp_disk
+if [ -z "$kname" ]; then
+ if [ -z "$esp_disk" ]; then
+ err "No suitable disk found"
+ exit 1
+ fi
+ echo "Warning: No suitable disk found, falling back to ESP disk ${esp_disk}" 1>&2
+ echo "$esp_disk"
+else
+ if [ -z "$esp_disk" ]; then
+ # no esp_disk using kname
+ echo "$kname"
+ exit 0
+ fi
+
+ if [ "$kname" != "$esp_disk" ]; then
+ # check if desvice size are the same
+ err "Error: Found disk ${kname} does not match ESP disk ${esp_disk}." 1>&2
+ kname_size=$(blockdevicesize "$kname")
+ esp_disk_size=$(blockdevicesize "$esp_disk")
+ if [ "$kname_size" != "$esp_disk_size" ]; then
+ err "Error: Found disk ${kname} size ${kname_size} does not match ESP disk ${esp_disk} size ${esp_disk_size}." 1>&2
+ exit 1
+ fi
+ fi
+ # kname == esp_disk or esp_disk has similar size to kname
+ echo "$esp_disk"
+fi
diff --git a/features/_usi/pkg.exclude b/features/_usi/pkg.exclude
new file mode 100644
index 00000000..df284caa
--- /dev/null
+++ b/features/_usi/pkg.exclude
@@ -0,0 +1 @@
+ignition
diff --git a/features/_usi/pkg.include b/features/_usi/pkg.include
index 7ee423c5..8f20b728 100644
--- a/features/_usi/pkg.include
+++ b/features/_usi/pkg.include
@@ -9,6 +9,5 @@ tpm2-tools
yq
gdisk
binutils
-oras
efibootmgr
systemd-ukify
diff --git a/features/_usidev/exec.config b/features/_usidev/exec.config
index 402f6dbf..8eee4e1c 100755
--- a/features/_usidev/exec.config
+++ b/features/_usidev/exec.config
@@ -1,5 +1,19 @@
#!/usr/bin/env bash
-set -eufo pipefail
+set -euo pipefail
mkdir -p /var/usr.overlay /var/usr.overlay.workdir
+
+# install
+mkdir /tmp/custompackages
+package="https://github.com/toanju/package-gardenlinux-update/releases/download/0.9gl4%2Bbp1877/build.tar.xz.0000"
+
+echo "Downloading and extracting package from $package"
+wget -q "$package" -O - | xz -d | tar xf - -C /tmp/custompackages
+
+pushd /tmp/custompackages > /dev/null
+rm -f -- *dbgsym* *arm64* || true
+ls -1
+dpkg -i gardenlinux-update_*_amd64.deb
+popd > /dev/null
+rm -rf /tmp/custompackages
diff --git a/features/_usidev/pkg.exclude b/features/_usidev/pkg.exclude
new file mode 100644
index 00000000..562044e0
--- /dev/null
+++ b/features/_usidev/pkg.exclude
@@ -0,0 +1 @@
+gardenlinux-update
diff --git a/features/cloudInit b/features/cloudInit
new file mode 120000
index 00000000..292955d2
--- /dev/null
+++ b/features/cloudInit
@@ -0,0 +1 @@
+../gardenlinux/features/cloudInit
\ No newline at end of file
diff --git a/features/controlplane/README.md b/features/controlplane/README.md
new file mode 100644
index 00000000..560f85a0
--- /dev/null
+++ b/features/controlplane/README.md
@@ -0,0 +1,22 @@
+## Feature: controlplane
+
+### Description
+
+
+This platform feature creates the control plane artifact for SCI Baremetal OS.
+
+
+### Features
+
+This feature serves as the base for the SCI Baremetal OS (control plane)
+
+### Unit testing
+
+### Meta
+
+|||
+|---|---|
+|type|element|
+|artifact|None|
+|included_features|`scibase`|
+|excluded_features|None|
diff --git a/features/controlplane/info.yaml b/features/controlplane/info.yaml
new file mode 100644
index 00000000..e69a2e0a
--- /dev/null
+++ b/features/controlplane/info.yaml
@@ -0,0 +1,5 @@
+description: "SCI Baremetal OS (controlplane)"
+type: element
+features:
+ include:
+ - scibase
diff --git a/features/khost b/features/khost
deleted file mode 120000
index 0b36d54a..00000000
--- a/features/khost
+++ /dev/null
@@ -1 +0,0 @@
-../gardenlinux/features/khost
\ No newline at end of file
diff --git a/features/khost/README.md b/features/khost/README.md
new file mode 100644
index 00000000..7d71961c
--- /dev/null
+++ b/features/khost/README.md
@@ -0,0 +1,19 @@
+## Feature: khost
+### Description
+
+The khost feature adjusts Garden Linux to support running Kubernetes (vanilla) workloads.
+
+
+### Features
+The `khost` feature adjusts Garden Linux to support running Kubernetes (vanilla) workloads and installs and configures all related packages (regarding the used hardware architecture) and tools. It adjusts the `kublets`, `sysctl` and removes any swap partition.
+
+### Unit testing
+Unit tests will ensure that the needed packages are present as well as the `kublet` is enabled within `systemd`.
+
+### Meta
+|||
+|---|---|
+|type|element|
+|artifact|None|
+|included_features|`chost`|
+|excluded_features|None|
diff --git a/features/khost/exec.late b/features/khost/exec.late
new file mode 100755
index 00000000..f0ea8caf
--- /dev/null
+++ b/features/khost/exec.late
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+
+K8S_VERSION=v1.34.3
+K8S_VERSION_REPO="${K8S_VERSION%.*}"
+
+cp /builder/features/khost/release.key /etc/apt/keyrings/kubernetes-apt-keyring.asc
+echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.asc] https://pkgs.k8s.io/core:/stable:/${K8S_VERSION_REPO}/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list
+apt update -y
+apt install -y --no-install-recommends "kubelet=${K8S_VERSION#v}*" "kubectl=${K8S_VERSION#v}*" "kubeadm=${K8S_VERSION#v}*" "cri-tools=${K8S_VERSION_REPO#v}*"
+
diff --git a/features/khost/file.exclude b/features/khost/file.exclude
new file mode 100644
index 00000000..82b5c657
--- /dev/null
+++ b/features/khost/file.exclude
@@ -0,0 +1 @@
+/etc/init.d/apparmor
diff --git a/features/khost/file.include/etc/modules-load.d/br-nf.conf b/features/khost/file.include/etc/modules-load.d/br-nf.conf
new file mode 100644
index 00000000..a13fc179
--- /dev/null
+++ b/features/khost/file.include/etc/modules-load.d/br-nf.conf
@@ -0,0 +1 @@
+br_netfilter
diff --git a/features/khost/file.include/etc/sysctl.d/20-br-nf.conf b/features/khost/file.include/etc/sysctl.d/20-br-nf.conf
new file mode 100644
index 00000000..0454e18a
--- /dev/null
+++ b/features/khost/file.include/etc/sysctl.d/20-br-nf.conf
@@ -0,0 +1,2 @@
+net.bridge.bridge-nf-call-iptables=1
+net.bridge.bridge-nf-call-ip6tables=1
diff --git a/features/khost/file.include/etc/sysctl.d/20-inotify.conf b/features/khost/file.include/etc/sysctl.d/20-inotify.conf
new file mode 100644
index 00000000..8f7c9d98
--- /dev/null
+++ b/features/khost/file.include/etc/sysctl.d/20-inotify.conf
@@ -0,0 +1,2 @@
+fs.inotify.max_user_instances = 8192
+fs.inotify.max_user_watches = 65536
diff --git a/features/khost/file.include/etc/sysctl.d/20-ip-forward.conf b/features/khost/file.include/etc/sysctl.d/20-ip-forward.conf
new file mode 100644
index 00000000..5f01c9cd
--- /dev/null
+++ b/features/khost/file.include/etc/sysctl.d/20-ip-forward.conf
@@ -0,0 +1,3 @@
+net.ipv4.ip_forward=1
+net.ipv6.conf.all.forwarding=1
+
diff --git a/features/khost/fstab.mod b/features/khost/fstab.mod
new file mode 100755
index 00000000..de880d56
--- /dev/null
+++ b/features/khost/fstab.mod
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+
+# remove any swap partition
+sed '/^[^[:space:]]\+[[:space:]]\+[^[:space:]]\+[[:space:]]\+swap[[:space:]]\+/d'
+
diff --git a/features/khost/info.yaml b/features/khost/info.yaml
new file mode 100644
index 00000000..1d9d389e
--- /dev/null
+++ b/features/khost/info.yaml
@@ -0,0 +1,5 @@
+description: 'host for kubernetes workloads (vanilla)'
+type: element
+features:
+ include:
+ - chost
diff --git a/features/khost/pkg.include b/features/khost/pkg.include
new file mode 100644
index 00000000..487a9abe
--- /dev/null
+++ b/features/khost/pkg.include
@@ -0,0 +1,6 @@
+apparmor
+conntrack
+ethtool
+ipvsadm
+socat
+gnupg
diff --git a/features/khost/release.key b/features/khost/release.key
new file mode 100644
index 00000000..64f4d8f8
--- /dev/null
+++ b/features/khost/release.key
@@ -0,0 +1,30 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.5 (GNU/Linux)
+
+mQENBGMHoXcBCADukGOEQyleViOgtkMVa7hKifP6POCTh+98xNW4TfHK/nBJN2sm
+u4XaiUmtB9UuGt9jl8VxQg4hOMRf40coIwHsNwtSrc2R9v5Kgpvcv537QVIigVHH
+WMNvXeoZkkoDIUljvbCEDWaEhS9R5OMYKd4AaJ+f1c8OELhEcV2dAQLLyjtnEaF/
+qmREN+3Y9+5VcRZvQHeyBxCG+hdUGE740ixgnY2gSqZ/J4YeQntQ6pMUEhT6pbaE
+10q2HUierj/im0V+ZUdCh46Lk/Rdfa5ZKlqYOiA2iN1coDPIdyqKavcdfPqSraKF
+Lan2KLcZcgTxP+0+HfzKefvGEnZa11civbe9ABEBAAG0PmlzdjprdWJlcm5ldGVz
+IE9CUyBQcm9qZWN0IDxpc3Y6a3ViZXJuZXRlc0BidWlsZC5vcGVuc3VzZS5vcmc+
+iQE+BBMBCAAoBQJnFF34AhsDBQkIK2yBBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIX
+gAAKCRAjRlTamilkNtOACACDK9dQ8CH2Ji9C3Q926nVMUiXdyJK1onCBrQSEBqdR
+LJaT6hGx5pzxkQGgUDpS9p7LA0u920HKLwGb7yIAWtyE5TAj2CYprGgpq98sfsGC
++U5T9IrAdya/BaTAkkP6gNhfMjNaK3bOWsvuLRlluKMNch4ify+IwLqc1JLG40bj
+2HnKBGYkC3m0VtQfUuPQMImSLta/NwRHJMPo8jfGyManqMMxp35/ecP2rXMfb/l1
+WjFDY7h+6nqXay20ljMXkN23W8wFTdvC6lq45wwM5IBnKNR/TjNNYAIizZoHFWz1
+c/ecMWWWCB2S7WbY4xI3JSCOD4XIff3ie7pc68/kgPytiQIcBBMBAgAGBQJjB6F3
+AAoJEM8Lkoze1k873TQP/0t2F/jltLRQMG7VCLw7+ps5JCW5FIqu/S2i9gSdNA0E
+42u+LyxjG3YxmVoVRMsxeu4kErxr8bLcA4p71W/nKeqwF9VLuXKirsBC7z2syFiL
+Ndl0ARnC3ENwuMVlSCwJO0MM5NiJuLOqOGYyD1XzSfnCzkXN0JGA/bfPRS5mPfoW
+0OHIRZFhqE7ED6wyWpHIKT8rXkESFwszUwW/D7o1HagX7+duLt8WkrohGbxTJ215
+YanOKSqyKd+6YGzDNUoGuMNPZJ5wTrThOkTzEFZ4HjmQ16w5xmcUISnCZd4nhsbS
+qN/UyV9Vu3lnkautS15E4CcjP1RRzSkT0jka62vPtAzw+PiGryM1F7svuRaEnJD5
+GXzj9RCUaR6vtFVvqqo4fvbA99k4XXj+dFAXW0TRZ/g2QMePW9cdWielcr+vHF4Z
+2EnsAmdvF7r5e2JCOU3N8OUodebU6ws4VgRVG9gptQgfMR0vciBbNDG2Xuk1WDk1
+qtscbfm5FVL36o7dkjA0x+TYCtqZIr4x3mmfAYFUqzxpfyXbSHqUJR2CoWxlyz72
+XnJ7UEo/0UbgzGzscxLPDyJHMM5Dn/Ni9FVTVKlALHnFOYYSTluoYACF1DMt7NJ3
+oyA0MELL0JQzEinixqxpZ1taOmVR/8pQVrqstqwqsp3RABaeZ80JbigUC29zJUVf
+=Eplj
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/features/khost/test/test_packages_musthave.py b/features/khost/test/test_packages_musthave.py
new file mode 100644
index 00000000..4b2783d2
--- /dev/null
+++ b/features/khost/test/test_packages_musthave.py
@@ -0,0 +1 @@
+from helper.tests.packages_musthave import packages_musthave as test_packages_musthave
diff --git a/features/khost/test/test_systemd_unit.py b/features/khost/test/test_systemd_unit.py
new file mode 100644
index 00000000..0bc474ab
--- /dev/null
+++ b/features/khost/test/test_systemd_unit.py
@@ -0,0 +1,16 @@
+import pytest
+from helper.utils import execute_remote_command
+from helper.utils import validate_systemd_unit
+
+
+@pytest.mark.parametrize(
+ "systemd_unit",
+ [
+ "kubelet"
+ ]
+)
+
+
+def test_systemd_unit(client, systemd_unit, non_provisioner_chroot):
+ execute_remote_command(client, f"systemctl start {systemd_unit}")
+ validate_systemd_unit(client, f"{systemd_unit}")
diff --git a/features/metal3/exec.config b/features/metal3/exec.config
index b15043a1..4fdb8e0f 100755
--- a/features/metal3/exec.config
+++ b/features/metal3/exec.config
@@ -26,7 +26,7 @@ apt-mark hold ${package_name}
K8S_VERSION=v1.30.7
K8S_VERSION_REPO="${K8S_VERSION%.*}"
-gpg --dearmor -o "/etc/apt/keyrings/kubernetes-${K8S_VERSION_REPO}-apt-keyring.gpg"
-This platform feature creates an artifact for SCI Baremetal OS. Which is exposing a KVM hypervisor.
+This platform feature creates an artifact for SCI Baremetal OS. Which is
+exposing a KVM hypervisor.
### Features
@@ -18,5 +19,5 @@ This feature creates a image including the hypervisor.
|---|---|
|type|element|
|artifact|None|
-|included_features|`scibase`,`vhost`|
+|included_features|`scibase`,`server`|
|excluded_features|None|
diff --git a/features/sci/exec.config b/features/sci/exec.config
index 3817f6d7..0688cc97 100755
--- a/features/sci/exec.config
+++ b/features/sci/exec.config
@@ -1,6 +1,10 @@
#!/usr/bin/env bash
+
set -Eeuo pipefail
+# Apply systemd presets
+systemctl preset-all
+
# Undo the gardener feature disablement
systemctl enable ssh
@@ -15,11 +19,11 @@ function create() {
shift
ID=$1
shift
- adduser --uid $ID --home /var/lib/$NAME $NAME \
+ adduser --uid "$ID" --home "/var/lib/$NAME" "$NAME" \
--system --group --disabled-password --disabled-login
echo "$@"
for group in "$@"; do
- adduser $NAME $group
+ adduser "$NAME" "$group"
done
}
@@ -30,13 +34,9 @@ create kvm-node-agent 42438 libvirt
chsh -s /bin/bash nova
mkdir -p /var/lib/nova/{.ssh,instances,mnt}
-chown -R nova:libvirt-qemu /var/lib/nova/{.ssh,instances,mnt}
+chown -R nova:nova /var/lib/nova/{.ssh,instances,mnt}
chmod 0600 /var/lib/nova/.ssh
mkdir -p /etc/pki/CA /etc/pki/libvirt /etc/pki/qemu
chown kvm-node-agent:kvm-node-agent /etc/pki/CA /etc/pki/libvirt /etc/pki/qemu
chmod 0755 /etc/pki/CA /etc/pki/libvirt /etc/pki/qemu
-
-# limit vnc port autorange to possible kubernetes nodeports
-sed -i 's/#remote_display_port_min = 5900/remote_display_port_min = 32200/' /etc/libvirt/qemu.conf
-sed -i 's/#remote_display_port_max = 65535/remote_display_port_max = 32299/' /etc/libvirt/qemu.conf
diff --git a/features/sci/file.include/etc/modprobe.d/kvm-amd.conf b/features/sci/file.include/etc/modprobe.d/kvm-amd.conf
new file mode 100644
index 00000000..79910fc2
--- /dev/null
+++ b/features/sci/file.include/etc/modprobe.d/kvm-amd.conf
@@ -0,0 +1 @@
+install kvm_amd if grep -q AuthenticAMD /proc/cpuinfo; then modprobe --ignore-install kvm_amd; else echo "WARNING kvm_amd: no AMD cpu found, skipping"; exit 0; fi
diff --git a/features/sci/file.include/etc/modprobe.d/kvm-intel.conf b/features/sci/file.include/etc/modprobe.d/kvm-intel.conf
new file mode 100644
index 00000000..67abf1e0
--- /dev/null
+++ b/features/sci/file.include/etc/modprobe.d/kvm-intel.conf
@@ -0,0 +1 @@
+install kvm_intel if grep -q GenuineIntel /proc/cpuinfo; then modprobe --ignore-install kvm_intel; else echo "WARNING kvm_intel: no Intel cpu found, skipping"; exit 0; fi
diff --git a/features/sci/file.include/etc/modprobe.d/nfsclient.conf b/features/sci/file.include/etc/modprobe.d/nfsclient.conf
new file mode 100644
index 00000000..d1587635
--- /dev/null
+++ b/features/sci/file.include/etc/modprobe.d/nfsclient.conf
@@ -0,0 +1,3 @@
+# According to Netapp KVM Best Practices mount options this value should be nconnect*64 (nconnect=8)
+options nfs max_session_slots=512
+
diff --git a/features/sci/file.include/etc/modules-load.d/kvm.conf b/features/sci/file.include/etc/modules-load.d/kvm.conf
new file mode 100644
index 00000000..01884b87
--- /dev/null
+++ b/features/sci/file.include/etc/modules-load.d/kvm.conf
@@ -0,0 +1,3 @@
+kvm
+kvm_amd
+kvm_intel
diff --git a/features/sci/file.include/etc/systemd/system-preset/00-sci-libvirt.preset b/features/sci/file.include/etc/systemd/system-preset/00-sci-libvirt.preset
new file mode 100644
index 00000000..a45ccf70
--- /dev/null
+++ b/features/sci/file.include/etc/systemd/system-preset/00-sci-libvirt.preset
@@ -0,0 +1,5 @@
+# default presets for sci image
+disable virtchd-admin.socket
+disable virtchd-ro.socket
+disable virtchd.service
+disable virtchd.socket
diff --git a/features/sci/file.include/etc/systemd/system-preset/10-ipmiev.preset b/features/sci/file.include/etc/systemd/system-preset/10-ipmiev.preset
new file mode 100644
index 00000000..17ed7623
--- /dev/null
+++ b/features/sci/file.include/etc/systemd/system-preset/10-ipmiev.preset
@@ -0,0 +1,2 @@
+# default presets for sci image
+disable ipmievd.service
diff --git a/features/sci/info.yaml b/features/sci/info.yaml
index 617f2bc6..153df672 100644
--- a/features/sci/info.yaml
+++ b/features/sci/info.yaml
@@ -2,5 +2,6 @@ description: "SCI Baremetal OS (virtual host feature)"
type: element
features:
include:
+ - _kvmCh
- scibase
- - vhost
+ - server
diff --git a/features/sci/pkg.include b/features/sci/pkg.include
index 71c8ba35..d1e6847e 100644
--- a/features/sci/pkg.include
+++ b/features/sci/pkg.include
@@ -1,6 +1,5 @@
-cloud-hypervisor-gl
-edk2-cloud-hypervisor-gl
-libvirt-daemon-driver-ch-gl
multipath-tools
open-iscsi
openvswitch-switch
+xz-utils
+
diff --git a/features/scibase/README.md b/features/scibase/README.md
index 9a5454a1..361ed71c 100644
--- a/features/scibase/README.md
+++ b/features/scibase/README.md
@@ -1,4 +1,4 @@
-## Feature: sci
+## Feature: scibase
### Description
@@ -8,8 +8,8 @@ This platform feature creates the base artifact for SCI Baremetal OS.
### Features
-This feature the base for the SCI Baremetal OS including the common features
-and flags.
+This feature serves as the base layer for the SCI Baremetal OS and includes the
+common features and flags.
### Unit testing
diff --git a/features/scidev/README.md b/features/scidev/README.md
new file mode 100644
index 00000000..465eaac9
--- /dev/null
+++ b/features/scidev/README.md
@@ -0,0 +1,23 @@
+## Feature: scidev
+
+### Description
+
+
+This platform feature creates an artifact for development of SCI Baremetal OS.
+Which is exposing a KVM hypervisor.
+
+
+### Features
+
+This feature creates a image including the hypervisor.
+
+### Unit testing
+
+### Meta
+
+|||
+|---|---|
+|type|element|
+|artifact|None|
+|included_features|`scibase`,`vhost`|
+|excluded_features|None|
diff --git a/features/scidev/info.yaml b/features/scidev/info.yaml
new file mode 100644
index 00000000..6cf8ffff
--- /dev/null
+++ b/features/scidev/info.yaml
@@ -0,0 +1,9 @@
+description: "SCI Baremetal OS - dev (virtual host feature)"
+type: element
+features:
+ include:
+ - _kvmCh
+ - _kvmQemu
+ - sci
+ - scibase
+ - server
diff --git a/features/sslfips b/features/sslfips
new file mode 120000
index 00000000..94a753fc
--- /dev/null
+++ b/features/sslfips
@@ -0,0 +1 @@
+../gardenlinux/features/sslfips
\ No newline at end of file
diff --git a/flavors.yaml b/flavors.yaml
index 5dd93a8a..97154b0f 100644
--- a/flavors.yaml
+++ b/flavors.yaml
@@ -1,5 +1,5 @@
targets:
- - name: metal
+ - name: metal
category: baremetal
flavors:
- features:
@@ -18,7 +18,7 @@ targets:
test-platform: false
publish: false
- features:
- - scibase
+ - controlplane
- _usi
arch: amd64
build: true
@@ -34,13 +34,21 @@ targets:
test-platform: false
publish: false
- features:
- - sci
+ - scidev
- _usidev
arch: amd64
build: true
test: true
test-platform: false
publish: false
+ - features:
+ - sci
+ - _iso
+ arch: amd64
+ build: true
+ test: true
+ test-platform: false
+ publish: false
# this is needed as bare_flavors step in build.yml is currently hard wired
- name: bare
category: container
diff --git a/gardenlinux b/gardenlinux
index 40e7dfa8..2c13d3c6 160000
--- a/gardenlinux
+++ b/gardenlinux
@@ -1 +1 @@
-Subproject commit 40e7dfa820cb8bd5e0317779f818d31464c18c63
+Subproject commit 2c13d3c6f94c8ad315b2817493464c87b525a946
diff --git a/renovate.json b/renovate.json
new file mode 100644
index 00000000..3c1d8c18
--- /dev/null
+++ b/renovate.json
@@ -0,0 +1,51 @@
+{
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
+ "customManagers": [
+ {
+ "customType": "regex",
+ "description": "Update libvirt package version for rel-1877-dev",
+ "managerFilePatterns": [
+ "/features/_kvmCh/exec\\.config$/",
+ "/features/_kvmQemu/exec\\.config$/"
+ ],
+ "matchStrings": [
+ "LIBVIRT_VERSION=\"(?.+)\\+bp1877\""
+ ],
+ "depNameTemplate": "gardenlinux/package-libvirt",
+ "datasourceTemplate": "github-releases",
+ "extractVersionTemplate": "^(?.+)\\+bp1877$",
+ "versioningTemplate": "loose",
+ "autoReplaceStringTemplate": "LIBVIRT_VERSION=\"{{{newValue}}}+bp1877\""
+ },
+ {
+ "customType": "regex",
+ "description": "Update cloud-hypervisor-gl package version for rel-1877-dev",
+ "managerFilePatterns": [
+ "/features/_kvmCh/exec\\.config$/"
+ ],
+ "matchStrings": [
+ "CLOUD_HYPERVISOR_VERSION=\"(?.+)\\+bp1877\""
+ ],
+ "depNameTemplate": "gardenlinux/package-cloud-hypervisor-gl",
+ "datasourceTemplate": "github-releases",
+ "extractVersionTemplate": "^(?.+)\\+bp1877$",
+ "versioningTemplate": "loose",
+ "autoReplaceStringTemplate": "CLOUD_HYPERVISOR_VERSION=\"{{{newValue}}}+bp1877\""
+ },
+ {
+ "customType": "regex",
+ "description": "Update edk2-cloud-hypervisor-gl package version for rel-1877-dev",
+ "managerFilePatterns": [
+ "/features/_kvmBase/exec\\.config$/"
+ ],
+ "matchStrings": [
+ "EDK2_VERSION=\"(?.+)\\+bp1877\""
+ ],
+ "depNameTemplate": "gardenlinux/package-edk2-cloud-hypervisor-gl",
+ "datasourceTemplate": "github-releases",
+ "extractVersionTemplate": "^(?.+)\\+bp1877$",
+ "versioningTemplate": "loose",
+ "autoReplaceStringTemplate": "EDK2_VERSION=\"{{{newValue}}}+bp1877\""
+ }
+ ]
+}
diff --git a/requirements.defs b/requirements.defs
new file mode 120000
index 00000000..fcbe4947
--- /dev/null
+++ b/requirements.defs
@@ -0,0 +1 @@
+gardenlinux/requirements.defs
\ No newline at end of file