packaging: Fix sev cache kernel issue

Fix cache kernel issue introduced by #6177

Fixes: #6362

Signed-off-by: Unmesh Deodhar <udeodhar@amd.com>
This commit is contained in:
Unmesh Deodhar 2023-02-23 11:33:31 -06:00
parent 2d525bbf1b
commit 46a6fe75dc
6 changed files with 17 additions and 17 deletions

View File

@ -19,9 +19,6 @@ source "${packaging_root_dir}/scripts/lib.sh"
readonly osbuilder_dir="$(cd "${repo_root_dir}/tools/osbuilder" && pwd)"
patches_path=""
readonly default_patches_dir="${packaging_root_dir}/kernel/patches"
export GOPATH=${GOPATH:-${HOME}/go}
final_image_name="kata-containers"

View File

@ -239,13 +239,14 @@ install_cc_image() {
local root_hash_tdx=""
local initramfs_last_commit=""
if [ -n "${tee}" ]; then
jenkins="${jenkins_url}/job/kata-containers-2.0-rootfs-image-${tee}-cc-$(uname -m)/${cached_artifacts_path}"
if [ "${tee}" == "tdx" ]; then
jenkins="${jenkins_url}/job/kata-containers-2.0-rootfs-image-${tee}-cc-$(uname -m)/${cached_artifacts_path}"
component="${tee}-rootfs-image"
root_hash_vanilla=""
root_hash_tdx="root_hash_${tee}.txt"
fi
if [ "${tee}" == "sev" ]; then
jenkins="${jenkins_url}/job/kata-containers-2.0-rootfs-initrd-${tee}-cc-$(uname -m)/${cached_artifacts_path}"
component="${tee}-rootfs-initrd"
root_hash_vanilla=""
initramfs_last_commit="$(get_initramfs_image_name)"
@ -265,7 +266,7 @@ install_cc_image() {
install_cached_component \
"${component}" \
"${jenkins}" \
"${osbuilder_last_commit}-${guest_image_last_commit}$-${initramfs_last_commit}-${agent_last_commit}-${libs_last_commit}-${attestation_agent_version}-${gperf_version}-${libseccomp_version}-${pause_version}-${rust_version}-${image_type}-${AA_KBC}" \
"${osbuilder_last_commit}-${guest_image_last_commit}-${initramfs_last_commit}-${agent_last_commit}-${libs_last_commit}-${attestation_agent_version}-${gperf_version}-${libseccomp_version}-${pause_version}-${rust_version}-${image_type}-${AA_KBC}" \
"" \
"${final_tarball_name}" \
"${final_tarball_path}" \
@ -285,7 +286,7 @@ install_cc_image() {
install_cc_sev_image() {
AA_KBC="online_sev_kbc"
image_type="initrd"
install_cc_image "${AA_KBC}" "${image_type}" "sev"
install_cc_image "${AA_KBC}" "${image_type}" "" "" "sev"
}
install_cc_tdx_image() {
@ -400,7 +401,7 @@ install_cached_kernel_component() {
kernel_version="${2}"
module_dir="${3:-}"
install_cached_compnent \
install_cached_component \
"kernel" \
"${jenkins_url}/job/kata-containers-2.0-kernel-${tee}-cc-$(uname -m)/${cached_artifacts_path}" \
"${kernel_version}" \
@ -453,7 +454,9 @@ install_cc_tdx_kernel() {
install_cc_sev_kernel() {
kernel_version="$(yq r $versions_yaml assets.kernel.sev.version)"
install_cc_tee_kernel "sev" "${kernel_version}"
default_patches_dir="${repo_root_dir}/tools/packaging/kernel/patches"
module_dir="${repo_root_dir}/tools/packaging/kata-deploy/local-build/build/cc-sev-kernel/builddir/kata-linux-${kernel_version#v}-$(get_config_version)/lib/modules/${kernel_version#v}"
install_cc_tee_kernel "sev" "${kernel_version}" "${module_dir}"
}
install_cc_tee_qemu() {

View File

@ -24,8 +24,6 @@ download_kernel=false
# The repository where kernel configuration lives
readonly kernel_config_repo="github.com/${project_name}/kata-containers/tools/packaging"
readonly patches_repo="github.com/${project_name}/kata-containers/tools/packaging"
# Default path to search patches to apply to kernel
readonly default_patches_dir="${script_dir}/patches"
# Default path to search config for kata
readonly default_kernel_config_dir="${script_dir}/configs"
# Default path to search for kernel config fragments

View File

@ -1 +1 @@
100
101

View File

@ -19,6 +19,9 @@ short_commit_length=10
hub_bin="hub-bin"
patches_path=""
default_patches_dir="${repo_root_dir}/tools/packaging/kernel/patches"
# Jenkins URL
jenkins_url="http://jenkins.katacontainers.io"
# Path where cached artifacts are found.
@ -115,7 +118,7 @@ get_config_and_patches() {
get_config_version() {
get_config_and_patches
config_version_file="${default_patches_dir}/../kata_config_version"
config_version_file="${repo_root_dir}/tools/packaging/kernel/kata_config_version"
if [ -f "${config_version_file}" ]; then
cat "${config_version_file}"
else

View File

@ -47,11 +47,9 @@ cache_kernel_artifacts() {
create_cache_asset "${kernel_tarball_name}" "${current_kernel_version}" "${current_kernel_image}"
if [ "${TEE}" == "sev" ]; then
module_dir="${repo_root_dir}/tools/packaging/kata-deploy/local-build/build/cc-sev-kernel/builddir/kata-linux-${kernel_version#v}-${get_config_version}/lib/modules/${kernel_version#v}"
pushd "${repo_root_dir}/tools/packaging/kata-deploy/local-build/build/"
tar cvfJ "kata-static-cc-sev-kernel-modules.tar.xz" "${module_dir}/kernel/drivers/virt/coco/efi_secret/"
popd
create_cache_asset "kata-static-cc-kernel-modules.tar.xz" "${current_kernel_version}" "${current_kernel_image}"
module_dir="${repo_root_dir}/tools/packaging/kata-deploy/local-build/build/cc-sev-kernel/builddir/kata-linux-${current_kernel_version#v}-$(get_config_version)/lib/modules/${current_kernel_version#v}"
tar cvfJ "${repo_root_dir}/tools/packaging/kata-deploy/local-build/build/kata-static-cc-sev-kernel-modules.tar.xz" "${module_dir}/kernel/drivers/virt/coco/efi_secret/"
create_cache_asset "kata-static-cc-sev-kernel-modules.tar.xz" "${current_kernel_version}" "${current_kernel_image}"
fi
}
@ -114,6 +112,7 @@ cache_rootfs_artifacts() {
root_hash_tdx="${repo_root_dir}/tools/osbuilder/root_hash_tdx.txt"
fi
if [ "${TEE}" == "sev" ]; then
root_hash_vanilla=""
rootfs_tarball_name="kata-static-cc-sev-rootfs-initrd.tar.xz"
aa_kbc="online_sev_kbc"
image_type="initrd"