diff --git a/tools/packaging/kata-deploy/local-build/Makefile b/tools/packaging/kata-deploy/local-build/Makefile index 3b90a34697..39eb7e001e 100644 --- a/tools/packaging/kata-deploy/local-build/Makefile +++ b/tools/packaging/kata-deploy/local-build/Makefile @@ -118,6 +118,7 @@ nvgpu-tarball: BASE_TARBALLS="$(NVGPU_BASE_TARBALLS)" \ BASE_SERIAL_TARBALLS="rootfs-image-nvidia-gpu-tarball rootfs-image-nvidia-gpu-confidential-tarball" \ FINAL_TARBALL_INPUTS="$(NVGPU_FINAL_TARBALL_INPUTS)" \ + FINAL_TARBALL_MERGE_MODE=passthrough \ DEPS= else nvgpu-tarball: @@ -304,12 +305,15 @@ kata-deploy-binary-tarball: nydus-snapshotter-for-coco-guest-pull-tarball: $(call BUILD_KATA_DEPLOY_COMPONENT,nydus-snapshotter-for-coco-guest-pull) +FINAL_TARBALL_MERGE_MODE ?= merge + merge-builds: $(MK_DIR)/kata-deploy-merge-builds.sh \ build \ "$(MK_DIR)/../../../../versions.yaml" \ kata-static.tar.zst \ - "$(FINAL_TARBALL_INPUTS)" + "$(FINAL_TARBALL_INPUTS)" \ + "$(FINAL_TARBALL_MERGE_MODE)" .PHONY: install-prebuilt-artifacts install-prebuilt-artifacts: diff --git a/tools/packaging/kata-deploy/local-build/kata-deploy-merge-builds.sh b/tools/packaging/kata-deploy/local-build/kata-deploy-merge-builds.sh index 6ea03ddc5a..cd095ee846 100755 --- a/tools/packaging/kata-deploy/local-build/kata-deploy-merge-builds.sh +++ b/tools/packaging/kata-deploy/local-build/kata-deploy-merge-builds.sh @@ -17,6 +17,7 @@ kata_build_dir=${1:-build} kata_versions_yaml_file=${2:-""} output_tarball_name=${3:-kata-static.tar.zst} known_tarballs=${4:-""} +merge_mode=${5:-merge} tar_path=$(readlink -f "${output_tarball_name}") if [[ -n "${kata_versions_yaml_file}" ]]; then @@ -45,26 +46,35 @@ for c in ${known_tarballs:-kata-static-*.tar.zst}; do echo "skipping missing tarball \"${c}\"" continue fi - echo "untarring tarball \"${c}\" into ${tarball_content_dir}" - tar --zstd -xvf "${c}" -C "${tarball_content_dir}" + if [[ "${merge_mode}" == "passthrough" ]]; then + echo "copying tarball \"${c}\" into ${tarball_content_dir}" + cp "${c}" "${tarball_content_dir}/" + else + echo "untarring tarball \"${c}\" into ${tarball_content_dir}" + tar --zstd -xvf "${c}" -C "${tarball_content_dir}" + fi done pushd "${tarball_content_dir}" - any_binary=$(find . -path "*/opt/kata/bin/*" -type f | head -1) - if [[ -z "${any_binary}" ]]; then - echo "Error: No binaries found in opt/kata/bin/" >&2 - exit 1 - fi - prefix=${any_binary%bin/*} - - if [[ "${RELEASE:-no}" == "yes" ]] && [[ -f "${repo_root_dir}/VERSION" ]]; then - # In this case the tag was not published yet, - # thus we need to rely on the VERSION file. - cp "${repo_root_dir}/VERSION" "${prefix}/" + if [[ "${merge_mode}" == "passthrough" ]]; then + [[ -n "${kata_versions_yaml_file}" ]] && cp "${kata_versions_yaml_file}" . else - git describe --tags > "${prefix}/VERSION" + any_binary=$(find . -path "*/opt/kata/bin/*" -type f | head -1) + if [[ -z "${any_binary}" ]]; then + echo "Error: No binaries found in opt/kata/bin/" >&2 + exit 1 + fi + prefix=${any_binary%bin/*} + + if [[ "${RELEASE:-no}" == "yes" ]] && [[ -f "${repo_root_dir}/VERSION" ]]; then + # In this case the tag was not published yet, + # thus we need to rely on the VERSION file. + cp "${repo_root_dir}/VERSION" "${prefix}/" + else + git describe --tags > "${prefix}/VERSION" + fi + [[ -n "${kata_versions_yaml_file}" ]] && cp "${kata_versions_yaml_file}" "${prefix}/" fi - [[ -n "${kata_versions_yaml_file}" ]] && cp "${kata_versions_yaml_file}" "${prefix}/" popd echo "create ${tar_path}"