Skip to content

Commit

Permalink
cmd-build: Conditionally change the packing structure of container-image
Browse files Browse the repository at this point in the history
When the previous build exists, use its packing structure otherwise container-encapsulate
generates a new one
  • Loading branch information
RishabhSaini committed May 2, 2023
1 parent d1e794e commit 7d88222
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cmd-build
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,12 @@ else
"--label=io.openshift.build.versions=machine-os=${buildid}"
)
fi
previous_build=$(get_latest_build)
oci_tag=""
if [ -n "${previous_build}" ]; then
previous_builddir=$(get_build_dir "${previous_build}")
oci_tag+="--prior-build=oci-archive:${previous_builddir}/fedora-coreos-${previous_build}-ostree.${basearch}.ociarchive"
fi
runv rpm-ostree compose container-encapsulate --max-layers="$MAX_OSTREECONTAINER_LAYERS" --format-version=1 \
--repo="${tmprepo}" \
--label="coreos-assembler.image-config-checksum=${image_config_checksum}" \
Expand All @@ -448,6 +454,7 @@ else
--label="org.opencontainers.image.revision=${config_gitrev}" \
--copymeta-opt=fedora-coreos.stream \
"${labels[@]}" \
"${oci_tag}" \
"${buildid}" \
oci-archive:"${ostree_tarfile_path}".tmp:latest
/usr/lib/coreos-assembler/finalize-artifact "${ostree_tarfile_path}"{.tmp,}
Expand Down

0 comments on commit 7d88222

Please sign in to comment.