From 762f9f4c3edf44d18e8f979afc2e46cf72b29b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 16 Mar 2023 12:39:38 +0100 Subject: [PATCH] tools: Add support for caching Firecracker artefacts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's add support for caching Firecracker artefacts that are generated using the kata-deploy local-build scripts. Right now those are not used, but we'll switch to using them very soon as part of upcoming changes of how we build the components we test in our CI. Fixes: #6480 Signed-off-by: Fabiano FidĂȘncio Signed-off-by: Gabriela Cervantes --- .../static-build/cache_components_main.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/packaging/static-build/cache_components_main.sh b/tools/packaging/static-build/cache_components_main.sh index b6780e9359..4ba3d16e09 100755 --- a/tools/packaging/static-build/cache_components_main.sh +++ b/tools/packaging/static-build/cache_components_main.sh @@ -18,6 +18,12 @@ cache_clh_artifacts() { create_cache_asset "${clh_tarball_name}" "${current_clh_version}" "" } +cache_firecracker_artifacts() { + local fc_tarball_name="kata-static-firecracker.tar.xz" + local current_fc_version="$(get_from_kata_deps "assets.hypervisor.firecracker.version")" + create_cache_asset "${fc_tarball_name}" "${current_fc_version}" "" +} + create_cache_asset() { local component_name="${1}" local component_version="${2}" @@ -40,6 +46,7 @@ Usage: $0 "[options]" Builds the cache of several kata components. Options: -c Cloud hypervisor cache + -F Firecracker cache -h Shows help EOF )" @@ -47,13 +54,17 @@ EOF main() { local cloud_hypervisor_component="${cloud_hypervisor_component:-}" + local firecracker_component="${firecracker_component:-}" local OPTIND - while getopts ":ch:" opt + while getopts ":cFh:" opt do case "$opt" in c) cloud_hypervisor_component="1" ;; + F) + firecracker_component="1" + ;; h) help exit 0; @@ -68,6 +79,7 @@ main() { shift $((OPTIND-1)) [[ -z "${cloud_hypervisor_component}" ]] && \ + [[ -z "${firecracker_component}" ]] && \ help && die "Must choose at least one option" mkdir -p "${WORKSPACE}/artifacts" @@ -75,6 +87,7 @@ main() { echo "Artifacts:" [ "${cloud_hypervisor_component}" == "1" ] && cache_clh_artifacts + [ "${firecracker_component}" == "1" ] && cache_firecracker_artifacts ls -la "${WORKSPACE}/artifacts/" popd