packaging: Track files correctly when naming builder image for agent

The necessary files for the agent builder image can be found in
`tools/packaging/static-build/agent`,
`ci/install_libseccomp.sh` and
`tools/packaging/kata-deploy/local-build/kata-deploy-copy-libseccomp-installer.sh`.
Identifying the correct files addresses the previously misreferenced path
used to name the builder image.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
This commit is contained in:
Hyounggyu Choi 2024-01-30 14:10:51 +01:00
parent f3bc6e4155
commit 2e1d770fcf
2 changed files with 18 additions and 5 deletions

View File

@ -181,11 +181,13 @@ install_image() {
local osbuilder_last_commit="$(get_last_modification "${repo_root_dir}/tools/osbuilder")" local osbuilder_last_commit="$(get_last_modification "${repo_root_dir}/tools/osbuilder")"
local guest_image_last_commit="$(get_last_modification "${repo_root_dir}/tools/packaging/guest-image")" local guest_image_last_commit="$(get_last_modification "${repo_root_dir}/tools/packaging/guest-image")"
local agent_last_commit="$(get_last_modification "${repo_root_dir}/src/agent")"
local libs_last_commit="$(get_last_modification "${repo_root_dir}/src/libs")" local libs_last_commit="$(get_last_modification "${repo_root_dir}/src/libs")"
local gperf_version="$(get_from_kata_deps "externals.gperf.version")" local gperf_version="$(get_from_kata_deps "externals.gperf.version")"
local libseccomp_version="$(get_from_kata_deps "externals.libseccomp.version")" local libseccomp_version="$(get_from_kata_deps "externals.libseccomp.version")"
local rust_version="$(get_from_kata_deps "languages.rust.meta.newest-version")" local rust_version="$(get_from_kata_deps "languages.rust.meta.newest-version")"
local agent_last_commit=$(merge_two_hashes \
"$(get_last_modification "${repo_root_dir}/src/agent")" \
"$(get_last_modification "${repo_root_dir}/tools/packaging/static-build/agent")")
latest_artefact="${osbuilder_last_commit}-${guest_image_last_commit}-${agent_last_commit}-${libs_last_commit}-${gperf_version}-${libseccomp_version}-${rust_version}-${image_type}" latest_artefact="${osbuilder_last_commit}-${guest_image_last_commit}-${agent_last_commit}-${libs_last_commit}-${gperf_version}-${libseccomp_version}-${rust_version}-${image_type}"
latest_builder_image="" latest_builder_image=""
@ -231,11 +233,13 @@ install_initrd() {
local osbuilder_last_commit="$(get_last_modification "${repo_root_dir}/tools/osbuilder")" local osbuilder_last_commit="$(get_last_modification "${repo_root_dir}/tools/osbuilder")"
local guest_image_last_commit="$(get_last_modification "${repo_root_dir}/tools/packaging/guest-image")" local guest_image_last_commit="$(get_last_modification "${repo_root_dir}/tools/packaging/guest-image")"
local agent_last_commit="$(get_last_modification "${repo_root_dir}/src/agent")"
local libs_last_commit="$(get_last_modification "${repo_root_dir}/src/libs")" local libs_last_commit="$(get_last_modification "${repo_root_dir}/src/libs")"
local gperf_version="$(get_from_kata_deps "externals.gperf.version")" local gperf_version="$(get_from_kata_deps "externals.gperf.version")"
local libseccomp_version="$(get_from_kata_deps "externals.libseccomp.version")" local libseccomp_version="$(get_from_kata_deps "externals.libseccomp.version")"
local rust_version="$(get_from_kata_deps "languages.rust.meta.newest-version")" local rust_version="$(get_from_kata_deps "languages.rust.meta.newest-version")"
local agent_last_commit=$(merge_two_hashes \
"$(get_last_modification "${repo_root_dir}/src/agent")" \
"$(get_last_modification "${repo_root_dir}/tools/packaging/static-build/agent")")
latest_artefact="${osbuilder_last_commit}-${guest_image_last_commit}-${agent_last_commit}-${libs_last_commit}-${gperf_version}-${libseccomp_version}-${rust_version}-${initrd_type}" latest_artefact="${osbuilder_last_commit}-${guest_image_last_commit}-${agent_last_commit}-${libs_last_commit}-${gperf_version}-${libseccomp_version}-${rust_version}-${initrd_type}"
latest_builder_image="" latest_builder_image=""

View File

@ -95,6 +95,13 @@ get_kata_hash() {
git ls-remote --heads --tags "https://github.com/${project}/${repo}.git" | grep "${ref}" | awk '{print $1}' git ls-remote --heads --tags "https://github.com/${project}/${repo}.git" | grep "${ref}" | awk '{print $1}'
} }
merge_two_hashes() {
local hash1="${1}"
local hash2="${2}"
echo "${hash1}${hash2}" | sha256sum | cut -c1-9
}
# $1 - The file we're looking for the last modification # $1 - The file we're looking for the last modification
get_last_modification() { get_last_modification() {
local file="${1}" local file="${1}"
@ -211,10 +218,12 @@ get_tools_image_name() {
} }
get_agent_image_name() { get_agent_image_name() {
libs_dir="${repo_root_dir}/src/libs" libseccomp_hash=$(merge_two_hashes \
agent_dir="${repo_root_dir}/src/agent" "$(get_last_modification "${repo_root_dir}/ci/install_libseccomp.sh")" \
"$(get_last_modification "${repo_root_dir}/tools/packaging/kata-deploy/local-build/kata-deploy-copy-libseccomp-installer.sh")")
agent_dir="${repo_root_dir}/tools/packaging/static-build/agent"
echo "${BUILDER_REGISTRY}:agent-$(get_last_modification ${libs_dir})-$(get_last_modification ${agent_dir})-$(uname -m)" echo "${BUILDER_REGISTRY}:agent-${libseccomp_hash}-$(get_last_modification ${agent_dir})-$(uname -m)"
} }
get_coco_guest_components_image_name() { get_coco_guest_components_image_name() {