From 25eb787e26af0f976823617e18e7fa93d0775a33 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Fri, 22 Nov 2024 08:29:53 -0500 Subject: [PATCH 1/4] cmdlib.sh: drop runcompose_extensions() This was used as part of the legacy building of extensions and should have been dropped alongside that code in 48414b3. --- src/cmdlib.sh | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/cmdlib.sh b/src/cmdlib.sh index 070d4d8ec8..f8b8408d3c 100755 --- a/src/cmdlib.sh +++ b/src/cmdlib.sh @@ -574,34 +574,6 @@ runcompose_tree() { fi } -runcompose_extensions() { - local outputdir=$1; shift - local workdir=${workdir:-$(pwd)} - local repo=${tmprepo:-${workdir}/tmp/repo} - - rm -f "${changed_stamp}" - # shellcheck disable=SC2086 - set - ${COSA_RPMOSTREE_GDB:-} rpm-ostree compose extensions --repo="${repo}" \ - --touch-if-changed "${changed_stamp}" --cachedir="${workdir}"/cache \ - ${COSA_RPMOSTREE_ARGS:-} "$@" --output-dir "$outputdir" - - echo "Running: $*" - - # this is the heart of the privs vs no privs dual path - if has_privileges; then - # we hardcode a umask of 0022 here to make sure that composes are run - # with a consistent value, regardless of the environment - (umask 0022 && sudo -E "$@") - sudo chown -R -h "${USER}":"${USER}" "${outputdir}" - else - # Use a snapshot version of the cache qcow2 to allow multiple users - # of the cache at the same time. This is needed because the extensions - # and other artifacts are built in parallel. - local snapshot='on' - runvm_with_cache_snapshot "${snapshot}" -- "$@" - fi -} - # Run with cache disk with optional snapshot=on, which means no changes get written back to # the cache disk. `runvm_with_cache_snapshot on` will set snapshotting to on. runvm_with_cache_snapshot() { From f8f9db3c61facf474054f9da7d130d1afae29a37 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Fri, 22 Nov 2024 22:04:16 -0500 Subject: [PATCH 2/4] ci: build metal images in one OSBuild invocation We can do this all with OSBuild now so let's not run parallel processes here. This will enable us to drop the cache snapshot bits since we won't have two processes trying to use the cache qcow at the same time. --- .cci.jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index 1f0068c141..0eba0e9168 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -30,7 +30,7 @@ pod(image: imageName + ":latest", kvm: true, cpu: "${cpuCount}", memory: "${memo kola(cosaDir: "/srv", addExtTests: ["${env.WORKSPACE}/ci/run-kola-self-tests"]) stage("Build Metal") { - cosaParallelCmds(cosaDir: "/srv", commands: ["metal", "metal4k"]) + utils.cosaCmd(cosaDir: "/srv", args: "osbuild metal metal4k") } stage("Build Live Images") { From 517317479462470b957fdb8555725e3b52bb65e1 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Fri, 22 Nov 2024 08:38:19 -0500 Subject: [PATCH 3/4] cmd-osbuild: drop use of runvm_with_cache_snapshot In the case where we were running multiple parallel tasks in the pipeline that were running VMs and accessing the cache qcow we needed this, but with [1] we are now consolidating all OSBuild pipeline tasks into single non-parallel invocations. [1] https://github.com/coreos/fedora-coreos-pipeline/pull/1055 --- src/cmd-osbuild | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/cmd-osbuild b/src/cmd-osbuild index aa2b43426a..572ffa79ca 100755 --- a/src/cmd-osbuild +++ b/src/cmd-osbuild @@ -347,7 +347,6 @@ main() { done tobuild=() - building_qemu=0 for platform in "${platforms[@]}"; do # check if the image already exists in the meta.json meta_img=$(meta_key "images.${platform}.path") @@ -357,7 +356,6 @@ main() { else tobuild+=("${platform}") echo "Will build $platform" - [ "${platform}" == 'qemu' ] && building_qemu=1 fi done if [ ${#tobuild[@]} == "0" ]; then @@ -366,17 +364,10 @@ main() { fi platforms=("${tobuild[@]}") - # Run OSBuild now to build the platforms that were requested. In the jenkins - # pipelines we build the qemu image first and that operation will do a lot of - # the same work required for later artifacts (metal, metal4k, etc) so we want - # the cached output from that run to persist. For now, later artifacts get built - # in parallel, so we need to be able to access the cache by multiple processes, - # so for those we'll set `snapshot=on` so that each will get their own disk image. - # This is OK because we don't checkpoint (cache) any of those stages. - [ "${building_qemu}" == '1' ] && snapshot="off" || snapshot="on" + # Run OSBuild now to build the platforms that were requested. runvm_osbuild_config_json="$(generate_runvm_osbuild_config)" outdir=$(mktemp -p "${tmp_builddir}" -d) - runvm_with_cache_snapshot "$snapshot" -- /usr/lib/coreos-assembler/runvm-osbuild \ + runvm_with_cache -- /usr/lib/coreos-assembler/runvm-osbuild \ --config "${runvm_osbuild_config_json}" \ --mpp "/usr/lib/coreos-assembler/osbuild-manifests/coreos.osbuild.${basearch}.mpp.yaml" \ --outdir "${outdir}" \ From d5a05c0787f75c8a53f5001c6f26db64bba68f96 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Fri, 22 Nov 2024 08:36:34 -0500 Subject: [PATCH 4/4] cmdlib.sh: drop runvm_with_cache_snapshot() This is now no longer used. runvm_with_cache_snapshot was used by runvm-osbuild previously but it's not needed any longer and cosa supermin-run --snapshot was used by build-podman-os job in the pipeline, but that isn't being used either so we can drop it. --- src/cmd-supermin-run | 7 +------ src/cmdlib.sh | 13 +++---------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/cmd-supermin-run b/src/cmd-supermin-run index dfcf2e0493..1ecde4da76 100755 --- a/src/cmd-supermin-run +++ b/src/cmd-supermin-run @@ -6,7 +6,7 @@ dn=$(dirname "$0") . "${dn}"/cmdlib.sh print_help() { - echo "Usage: cosa supermin-run [--cache|--snapshot] COMMAND [ARG...]" >&2 + echo "Usage: cosa supermin-run [--cache] COMMAND [ARG...]" >&2 } if [ $# = 0 ]; then @@ -21,11 +21,6 @@ case "$1" in set -- runvm_with_cache -- "$@" need_cache_dir=1 ;; - --snapshot) - shift - set -- runvm_with_cache_snapshot on -- "$@" - need_cache_dir=1 - ;; --*) echo "unrecognized option: $1" print_help diff --git a/src/cmdlib.sh b/src/cmdlib.sh index f8b8408d3c..9e84366f6c 100755 --- a/src/cmdlib.sh +++ b/src/cmdlib.sh @@ -574,10 +574,8 @@ runcompose_tree() { fi } -# Run with cache disk with optional snapshot=on, which means no changes get written back to -# the cache disk. `runvm_with_cache_snapshot on` will set snapshotting to on. -runvm_with_cache_snapshot() { - local snapshot=$1; shift +# Run with cache disk. +runvm_with_cache() { local cache_size=${RUNVM_CACHE_SIZE:-30G} # "cache2" has an explicit label so we can find it in qemu easily if [ ! -f "${workdir}"/cache/cache2.qcow2 ]; then @@ -590,16 +588,11 @@ runvm_with_cache_snapshot() { fi # And remove the old one rm -vf "${workdir}"/cache/cache.qcow2 - cache_args+=("-drive" "if=none,id=cache,discard=unmap,snapshot=${snapshot},file=${workdir}/cache/cache2.qcow2" \ + cache_args+=("-drive" "if=none,id=cache,discard=unmap,file=${workdir}/cache/cache2.qcow2" \ "-device" "virtio-blk,drive=cache") runvm "${cache_args[@]}" "$@" } -runvm_with_cache() { - local snapshot='off' - runvm_with_cache_snapshot $snapshot "$@" -} - # Strips out the digest field from lockfiles since they subtly conflict with # various workflows. strip_out_lockfile_digests() {