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]>

 No commands remaining.
  • Loading branch information
stevenhorsman committed May 14, 2024
1 parent c781a4e commit e02e9f2
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 49,7 @@ ARTEFACT_REGISTRY_PASSWORD="${ARTEFACT_REGISTRY_PASSWORD:-}"
TARGET_BRANCH="${TARGET_BRANCH:-main}"
PUSH_TO_REGISTRY="${PUSH_TO_REGISTRY:-}"
KERNEL_HEADERS_PKG_TYPE="${KERNEL_HEADERS_PKG_TYPE:-deb}"
RELEASE="${RELEASE:-"no"}"

workdir="${WORKDIR:-$PWD}"

Expand Down Expand Up @@ -767,6 768,7 @@ install_ovmf_sev() {

install_agent() {
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 All @@ -788,6 790,7 @@ install_agent() {

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 @@ -804,6 807,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 @@ -1052,7 1056,7 @@ handle_build() {
kernel-nvidia-gpu*)
local kernel_headers_final_tarball_path="${workdir}/kata-static-${build_target}-headers.tar.xz"
if [ ! -f "${kernel_headers_final_tarball_path}" ]; then
local kernel_headers_dir
local kernel_headers_dir
kernel_headers_dir=$(get_kernel_headers_dir "${build_target}")

pushd "${kernel_headers_dir}"
Expand Down Expand Up @@ -1129,6 1133,36 @@ handle_build() {
${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 e02e9f2

Please sign in to comment.