From e4289f4394536582a957c311100f0a217a48a3d4 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Thu, 5 Dec 2024 22:33:02 -0500 Subject: [PATCH 1/4] osbuild: use sparse for GCP tar artifact The support for this was added to the tar stage upstream in [1] and we just never applied it to the manifests here. [1] https://github.com/osbuild/osbuild/pull/1614 --- src/osbuild-manifests/platform.gcp.ipp.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/osbuild-manifests/platform.gcp.ipp.yaml b/src/osbuild-manifests/platform.gcp.ipp.yaml index 65d2ab8ab1..9147073d34 100644 --- a/src/osbuild-manifests/platform.gcp.ipp.yaml +++ b/src/osbuild-manifests/platform.gcp.ipp.yaml @@ -68,6 +68,7 @@ pipelines: filename: disk.tar format: oldgnu root-node: omit + sparse: true # Set these to false so GCP image upload/create will succeed acls: false selinux: false From a7e602382b09f97196185feeb1c7e2fd9b8388f5 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Thu, 5 Dec 2024 22:36:42 -0500 Subject: [PATCH 2/4] runvm-osbuild: delete commented out code This shouldn't have been left in there so let's drop it. --- src/runvm-osbuild | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/runvm-osbuild b/src/runvm-osbuild index 03eecdb30f..b8d2fd70dd 100755 --- a/src/runvm-osbuild +++ b/src/runvm-osbuild @@ -125,7 +125,5 @@ osbuild \ ${platforms[@]/#/--export=} \ "${processed_json}" -# --break org.osbuild.coreos.live-artifacts.mono \ - mv "${outdir}"/* "${orig_outdir}/" rm -f "${processed_json}" From 1b8c72e28f535e55b9fe44753ab2463c730c5b81 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Thu, 5 Dec 2024 22:34:35 -0500 Subject: [PATCH 3/4] runvm-osbuild: drop set -x Let's make the script a little less verbose by just doing set -x for the osbuild commands that get called. --- src/runvm-osbuild | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/runvm-osbuild b/src/runvm-osbuild index b8d2fd70dd..4a3a043b10 100755 --- a/src/runvm-osbuild +++ b/src/runvm-osbuild @@ -1,5 +1,5 @@ #!/bin/bash -set -eux -o pipefail +set -euo pipefail usage() { cat < /dev/null # Run through the preprocessor # Note: don't quote the size arguements since they are numbers, not strings -osbuild-mpp \ +set -x; osbuild-mpp \ -D arch=\""$(arch)"\" \ -D artifact_name_prefix=\""${artifact_name_prefix}"\" \ -D ostree_ref=\""${ostree_ref}"\" \ @@ -110,8 +110,10 @@ osbuild-mpp \ -D cloud_image_size_mb="${cloud_image_size_mb}" \ -D rootfs_size_mb="${rootfs_size_mb}" \ "${mppyaml}" "${processed_json}" +set +x # Build the image +set -x # shellcheck disable=SC2068 osbuild \ --out "$outdir" \ @@ -124,6 +126,7 @@ osbuild \ --checkpoint metal4k \ ${platforms[@]/#/--export=} \ "${processed_json}" +set +x mv "${outdir}"/* "${orig_outdir}/" rm -f "${processed_json}" From bc287ff922e738794ac19d2f827358aba51f7af2 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Thu, 5 Dec 2024 22:37:35 -0500 Subject: [PATCH 4/4] runvm-osbuild: log disk usage during run At least temporarily let's output some logging about how much of the filesystem under cache/ we are using so we can see if we're getting close to limits and also maybe see which stages are taking up the most space. --- src/runvm-osbuild | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/runvm-osbuild b/src/runvm-osbuild index 4a3a043b10..a881f24e09 100755 --- a/src/runvm-osbuild +++ b/src/runvm-osbuild @@ -32,6 +32,17 @@ getconfig_def() { jq -re .\""$k"\"//\""${default}"\" < "${config}" } +log_disk_usage(){ + # spawn off a subshell in the background to log disk usage every + # 10 seconds. + yellow="\033[33m"; default="\033[39m" + (while true; do + echo -e "$yellow"; df -kh ./cache; echo -e "$default"; + sleep 10; + pgrep --exact osbuild >/dev/null || break; + done) & +} + while [ $# -gt 0 ]; do flag="${1}"; shift; @@ -112,6 +123,8 @@ set -x; osbuild-mpp \ "${mppyaml}" "${processed_json}" set +x +log_disk_usage + # Build the image set -x # shellcheck disable=SC2068