From 309e232553e3dcb26fca70ee941d8d34451371d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 20 Jul 2023 14:24:08 +0200 Subject: [PATCH] cache: kernel: Consider changes in tools/packaging/kernel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Any change in the script used to build the kernel should invalidate the cache. Fixes: #7403 Signed-off-by: Fabiano FidĂȘncio --- .../packaging/kata-deploy/local-build/kata-deploy-binaries.sh | 4 ++-- tools/packaging/static-build/cache_components_main.sh | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh b/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh index bcd3a6bb11..aac4513501 100755 --- a/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh +++ b/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh @@ -247,7 +247,7 @@ install_cached_kernel_tarball_component() { install_cached_tarball_component \ "${kernel_name}" \ "${jenkins_url}/job/kata-containers-main-${kernel_name}-$(uname -m)/${cached_artifacts_path}" \ - "${kernel_version}-${kernel_kata_config_version}" \ + "${kernel_version}-${kernel_kata_config_version}-$(get_last_modification $(dirname $kernel_builder))" \ "$(get_kernel_image_name)" \ "${final_tarball_name}" \ "${final_tarball_path}" \ @@ -261,7 +261,7 @@ install_cached_kernel_tarball_component() { install_cached_tarball_component \ "${kernel_name}" \ "${jenkins_url}/job/kata-containers-main-${kernel_name}-$(uname -m)/${cached_artifacts_path}" \ - "${kernel_version}-${kernel_kata_config_version}" \ + "${kernel_version}-${kernel_kata_config_version}-$(get_last_modification $(dirname $kernel_builder))" \ "$(get_kernel_image_name)" \ "kata-static-kernel-sev-modules.tar.xz" \ "${workdir}/kata-static-kernel-sev-modules.tar.xz" \ diff --git a/tools/packaging/static-build/cache_components_main.sh b/tools/packaging/static-build/cache_components_main.sh index 50b2ba83e5..a971c98aa9 100755 --- a/tools/packaging/static-build/cache_components_main.sh +++ b/tools/packaging/static-build/cache_components_main.sh @@ -33,6 +33,7 @@ cache_kernel_artifacts() { local kernel_tarball_name="kata-static-${KERNEL_FLAVOUR}.tar.xz" local current_kernel_image="$(get_kernel_image_name)" local current_kernel_kata_config_version="$(cat ${repo_root_dir}/tools/packaging/kernel/kata_config_version)" + local kernel_last_commit="$(get_last_modification ${repo_root_dir}/tools/packaging/kernel)" local kernel_modules_tarball_path="${repo_root_dir}/tools/packaging/kata-deploy/local-build/build/kata-static-kernel-sev-modules.tar.xz" # The ${vendor}-gpu kernels are based on an already existing entry, and does not require @@ -59,7 +60,7 @@ cache_kernel_artifacts() { ;; esac - create_cache_asset "${kernel_tarball_name}" "${current_kernel_version}-${current_kernel_kata_config_version}" "${current_kernel_image}" + create_cache_asset "${kernel_tarball_name}" "${current_kernel_version}-${current_kernel_kata_config_version}-${kernel_last_commit}" "${current_kernel_image}" if [[ "${KERNEL_FLAVOUR}" == "kernel-sev" ]]; then module_dir="${repo_root_dir}/tools/packaging/kata-deploy/local-build/build/kernel-sev/builddir/kata-linux-${current_kernel_version#v}-${current_kernel_kata_config_version}/lib/modules/${current_kernel_version#v}" if [ ! -f "${kernel_modules_tarball_path}" ]; then