Skip to content

Commit

Permalink
ci: cache: Optional tag components with tags
Browse files Browse the repository at this point in the history
- CoCo wants to use the agent and coco-guest-components cached artifacts
so tag them with a helpful version, so make these easier to get

Signed-off-by: stevenhorsman <[email protected]>
  • Loading branch information
stevenhorsman committed Apr 25, 2024
1 parent c665162 commit dbecf55
Showing 1 changed file with 32 additions and 19 deletions.
51 changes: 32 additions & 19 deletions tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ install_agent_helper() {
agent_policy="${1:-no}"

latest_artefact="$(git log -1 --pretty=format:"%h" ${repo_root_dir}/src/agent)"
artefact_tag="$(git log -1 --pretty=format:"%h" ${repo_root_dir})"
latest_builder_image="$(get_agent_image_name)"

install_cached_tarball_component \
Expand Down Expand Up @@ -808,6 +809,7 @@ install_agent_opa() {

install_coco_guest_components() {
latest_artefact="$(get_from_kata_deps "externals.coco-guest-components.version")-$(get_from_kata_deps "externals.coco-guest-components.toolchain")"
artefact_tag="$(get_from_kata_deps "externals.coco-guest-components.version")"
latest_builder_image="$(get_coco_guest_components_image_name)"

install_cached_tarball_component \
Expand All @@ -824,6 +826,7 @@ install_coco_guest_components() {

install_pause_image() {
latest_artefact="$(get_from_kata_deps "externals.pause.repo")-$(get_from_kata_deps "externals.pause.version")"
artefact_tag=${latest_artefact}
latest_builder_image="$(get_pause_image_name)"

install_cached_tarball_component \
Expand Down Expand Up @@ -1106,25 +1109,35 @@ handle_build() {

echo "${ARTEFACT_REGISTRY_PASSWORD}" | sudo oras login "${ARTEFACT_REGISTRY}" -u "${ARTEFACT_REGISTRY_USERNAME}" --password-stdin

case ${build_target} in
kernel*-confidential)
sudo oras push \
${ARTEFACT_REGISTRY}/kata-containers/cached-artefacts/${build_target}:latest-${TARGET_BRANCH}-$(uname -m) \
${final_tarball_name} \
"kata-static-${build_target}-modules.tar.xz" \
${build_target}-version \
${build_target}-builder-image-version \
${build_target}-sha256sum
;;
*)
sudo oras push \
${ARTEFACT_REGISTRY}/kata-containers/cached-artefacts/${build_target}:latest-${TARGET_BRANCH}-$(uname -m) \
${final_tarball_name} \
${build_target}-version \
${build_target}-builder-image-version \
${build_target}-sha256sum
;;
esac
tags=(latest-${TARGET_BRANCH}-$(uname -m))
if [ -n "${artefact_tag}" ]; then
tags+=("${artefact_tag}")
fi
if [ "${RELEASE}" == "yes" ]; then
tags+=("$(cat "${version_file}")")
fi

for tag in "${tags[@]}"; do
case ${build_target} in
kernel*-confidential)
sudo oras push \
${ARTEFACT_REGISTRY}/kata-containers/cached-artefacts/${build_target}:${tag} \
${final_tarball_name} \
"kata-static-${build_target}-modules.tar.xz" \
${build_target}-version \
${build_target}-builder-image-version \
${build_target}-sha256sum
;;
*)
sudo oras push \
${ARTEFACT_REGISTRY}/kata-containers/cached-artefacts/${build_target}:${tag} \
${final_tarball_name} \
${build_target}-version \
${build_target}-builder-image-version \
${build_target}-sha256sum
;;
esac
done
sudo oras logout "${ARTEFACT_REGISTRY}"
fi

Expand Down

0 comments on commit dbecf55

Please sign in to comment.