mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-13 12:59:36 +00:00
kata-deploy-binaries: Use cached shim-v2 when possible
As done for different components, let's also use a cached version of the shim-v2 whenever it's possible. Fixes: #5838 Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
@@ -143,6 +143,64 @@ install_cached_component() {
|
||||
mv "${component_tarball_name}" "${component_tarball_path}"
|
||||
}
|
||||
|
||||
# We've to add a different cached function here as for using the shim-v2 caching
|
||||
# we have to rely and check some artefacts coming from the cc-rootfs-image and the
|
||||
# cc-tdx-rootfs-image jobs.
|
||||
install_cached_cc_shim_v2() {
|
||||
local component="${1}"
|
||||
local jenkins_build_url="${2}"
|
||||
local current_version="${3}"
|
||||
local current_image_version="${4}"
|
||||
local component_tarball_name="${5}"
|
||||
local component_tarball_path="${6}"
|
||||
local root_hash_vanilla="${repo_root_dir}/tools/osbuilder/root_hash_vanilla.txt"
|
||||
local root_hash_tdx="${repo_root_dir}/tools/osbuilder/root_hash_tdx.txt"
|
||||
|
||||
local rootfs_image_cached_root_hash="${jenkins_url}/job/kata-containers-2.0-rootfs-image-cc-$(uname -m)/${cached_artifacts_path}/root_hash_vanilla.txt"
|
||||
local tdx_rootfs_image_cached_root_hash="${jenkins_url}/job/kata-containers-2.0-rootfs-image-tdx-cc-$(uname -m)/${cached_artifacts_path}/root_hash_tdx.txt"
|
||||
|
||||
|
||||
wget "${rootfs_image_cached_root_hash}" -O "rootfs_root_hash_vanilla.txt" || return 1
|
||||
if [ -f "${root_hash_vanilla}" ]; then
|
||||
# There's already a pre-existent root_hash_vanilla.txt,
|
||||
# let's check whether this is the same one cached on the
|
||||
# rootfs job.
|
||||
|
||||
# In case it's not the same, let's proceed building the
|
||||
# shim-v2 with what we have locally.
|
||||
diff "${root_hash_vanilla}" "rootfs_root_hash_vanilla.txt" > /dev/null || return 1
|
||||
fi
|
||||
mv "rootfs_root_hash_vanilla.txt" "${root_hash_vanilla}"
|
||||
|
||||
wget "${rootfs_image_cached_root_hash}" -O "rootfs_root_hash_tdx.txt" || return 1
|
||||
if [ -f "${root_hash_tdx}" ]; then
|
||||
# There's already a pre-existent root_hash_tdx.txt,
|
||||
# let's check whether this is the same one cached on the
|
||||
# rootfs job.
|
||||
|
||||
# In case it's not the same, let's proceed building the
|
||||
# shim-v2 with what we have locally.
|
||||
diff "${root_hash_tdx}" "rootfs_root_hash_tdx.txt" > /dev/null || return 1
|
||||
fi
|
||||
mv "rootfs_root_hash_tdx.txt" "${root_hash_tdx}"
|
||||
|
||||
wget "${jenkins_build_url}/root_hash_vanilla.txt" -O "shim_v2_root_hash_vanilla.txt" || return 1
|
||||
diff "${root_hash_vanilla}" "shim_v2_root_hash_vanilla.txt" > /dev/null || return 1
|
||||
|
||||
wget "${jenkins_build_url}/root_hash_tdx.txt" -O "shim_v2_root_hash_tdx.txt" || return 1
|
||||
diff "${root_hash_tdx}" "shim_v2_root_hash_tdx.txt" > /dev/null || return 1
|
||||
|
||||
install_cached_component \
|
||||
"${component}" \
|
||||
"${jenkins_build_url}" \
|
||||
"${current_version}" \
|
||||
"${current_image_version}" \
|
||||
"${component_tarball_name}" \
|
||||
"${component_tarball_path}" \
|
||||
"$(basename ${root_hash_vanilla})" \
|
||||
"$(basename ${root_hash_tdx})"
|
||||
}
|
||||
|
||||
# Install static CC cloud-hypervisor asset
|
||||
install_cc_clh() {
|
||||
install_cached_component \
|
||||
@@ -273,6 +331,20 @@ install_cc_qemu() {
|
||||
|
||||
#Install all components that are not assets
|
||||
install_cc_shimv2() {
|
||||
local shim_v2_last_commit="$(get_last_modification "${repo_root_dir}/src/runtime")"
|
||||
local golang_version="$(get_from_kata_deps "languages.golang.meta.newest-version")"
|
||||
local rust_version="$(get_from_kata_deps "languages.rust.meta.newest-version")"
|
||||
local shim_v2_version="${shim_v2_last_commit}-${golang_version}-${rust_version}"
|
||||
|
||||
install_cached_cc_shim_v2 \
|
||||
"shim-v2" \
|
||||
"${jenkins_url}/job/kata-containers-2.0-shim-v2-cc-$(uname -m)/${cached_artifacts_path}" \
|
||||
"${shim_v2_version}" \
|
||||
"$(get_shim_v2_image_name)" \
|
||||
"${final_tarball_name}" \
|
||||
"${final_tarball_path}" \
|
||||
&& return 0
|
||||
|
||||
GO_VERSION="$(yq r ${versions_yaml} languages.golang.meta.newest-version)"
|
||||
export GO_VERSION
|
||||
export REMOVE_VMM_CONFIGS="acrn fc"
|
||||
|
Reference in New Issue
Block a user