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 31, 2023
1 parent dd7315e commit ca5266f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/cmd-build
Original file line number Diff line number Diff line change
Expand Up @@ -452,18 +452,31 @@ else
"--label=io.openshift.build.versions=machine-os=${buildid}"
)
fi

last_build_manifest=()
#Use the last stable release if buildfetch used
if [ -n "${PARENT_BUILD}" ]; then
last_build_manifest+=("--previous_build_manifest=${parent_builddir}/${name}-${PARENT_BUILD}-ostree.${basearch}-manifest.json")
#Use the previous local build
elif [ -n "${previous_build}" ]; then
last_build_manifest+=("--previous_build_manifest=${previous_builddir}/${name}-${previous_build}-ostree.${basearch}-manifest.json")
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}" \
--label="coreos-assembler.image-input-checksum=${image_input_checksum}" \
--label="org.opencontainers.image.source=${gitsrc}" \
--label="org.opencontainers.image.revision=${config_gitrev}" \
--copymeta-opt=fedora-coreos.stream \
"${last_build_manifest[@]}" \
"${labels[@]}" \
"${buildid}" \
oci-archive:"${ostree_tarfile_path}".tmp:latest
/usr/lib/coreos-assembler/finalize-artifact "${ostree_tarfile_path}"{.tmp,}
ostree_tarfile_sha256=$(sha256sum "${ostree_tarfile_path}" | awk '{print$1}')
ostree_oci_manifest_path="${name}-${buildid}-ostree.${basearch}-manifest.json"
skopeo inspect --raw oci-archive:"${ostree_tarfile_path}" > tmp/manifest.json
/usr/lib/coreos-assembler/finalize-artifact tmp/manifest.json "${ostree_oci_manifest_path}"
fi

# The base metadata, plus locations for code sources.
Expand Down

0 comments on commit ca5266f

Please sign in to comment.