diff --git a/src/cmd-buildextend-metal b/src/cmd-buildextend-metal index 4be486d84f052a111817d99e097a3929284e921b..990210bf57eb901a6f5b12e9f9f52bd5ba19e95f 100755 --- a/src/cmd-buildextend-metal +++ b/src/cmd-buildextend-metal @@ -262,13 +262,20 @@ cat "${image_json}" image-dynamic.json | jq -s add > image-for-disk.json platforms_json="${workdir}/tmp/platforms.json" yaml2json "${configdir}/platforms.yaml" "${platforms_json}" +if [ "${image_type}" == "qemu" ] && [ "${COSA_USE_OSBUILD:-}" != "" ]; then + runvm -- /usr/lib/coreos-assembler/runvm-osbuild \ + "${ostree_repo}" "${ref}" \ + /usr/lib/coreos-assembler/coreos.osbuild.mpp.yaml \ + "${path}.tmp" +else runvm "${qemu_args[@]}" -- \ - /usr/lib/coreos-assembler/create_disk.sh \ - --config "$(pwd)"/image-for-disk.json \ - --kargs "${kargs}" \ - --platform "${ignition_platform_id}" \ - --platforms-json "${platforms_json}" \ - "${disk_args[@]}" + /usr/lib/coreos-assembler/create_disk.sh \ + --config "$(pwd)"/image-for-disk.json \ + --kargs "${kargs}" \ + --platform "${ignition_platform_id}" \ + --platforms-json "${platforms_json}" \ + "${disk_args[@]}" +fi if [[ $secure_execution -eq "1" && -z "${hostkey}" ]]; then /usr/lib/coreos-assembler/secex-genprotimgvm-scripts/runvm.sh \ diff --git a/src/deps.txt b/src/deps.txt index 5d38e443d93936c101bfa7bfdc3792125c64536b..da8dba87924fff15de7e523509e05184c2fbcdc9 100644 --- a/src/deps.txt +++ b/src/deps.txt @@ -16,12 +16,6 @@ dumb-init rpm-ostree createrepo_c openssh-clients python3-createrepo_c dnf-utils -# We don't actually use this right now but we intend to share -# code in the future. -# XXX: temporarily disabled until we fix -# https://github.com/osbuild/osbuild-composer/issues/1915 -# osbuild-composer - # For generating ISO images genisoimage diff --git a/src/runvm-osbuild b/src/runvm-osbuild new file mode 100755 index 0000000000000000000000000000000000000000..92328a7551dae0f6f1383368f79bc9e15ecae296 --- /dev/null +++ b/src/runvm-osbuild @@ -0,0 +1,30 @@ +#!/bin/bash +set -eux -o pipefail + +repo=$1 +ref=$2 +mppyaml=$3 +path=$4 + +# Since it doesn't exist create loop-control +mknod /dev/loop-control c 10 237 + +# get away from the virtiofs share because the xattrs that +# are written out by the ostree deploy will cause SELinux denials. +mkdir /root/osbuild && cd /root/osbuild + +# Run through the preprocessor +osbuild-mpp \ + -D ref=\""${ref}"\" \ + -D repourl=\""file://${repo}"\" \ + "${mppyaml}" \ + processed.json + +# Build the image +osbuild --store store/ \ + --output-directory out/ \ + --export qcow2 processed.json + + +# Copy it out to the specified location +cp out/qcow2/disk.qcow2 "${path}" diff --git a/src/vmdeps.txt b/src/vmdeps.txt index 2cc6098ed14c58193f230f77c5989c47c34251d7..37fb0b3e293bc24a61e82cdae9c0b03e09a08566 100644 --- a/src/vmdeps.txt +++ b/src/vmdeps.txt @@ -35,3 +35,7 @@ tar # needed for extensions container build podman + +# For running osbuild +# NestOS currently does not plan to introduce the osbuild build way +# osbuild osbuild-ostree osbuild-selinux osbuild-tools python3-pyrsistent