Skip to content

Commit

Permalink
Merge pull request kata-containers#9550 from stevenhorsman/tag-compon…
Browse files Browse the repository at this point in the history
…ent-caches

Tag component caches
  • Loading branch information
stevenhorsman authored May 16, 2024
2 parents b31ff09 7f41329 commit d8468cb
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 18 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/build-kata-static-tarball-amd64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 60,8 @@ jobs:
stage:
- ${{ inputs.stage }}
exclude:
- asset: agent
stage: release
- asset: cloud-hypervisor-glibc
stage: release
- asset: pause-image
stage: release
- asset: coco-guest-components
stage: release
steps:
- name: Login to Kata Containers quay.io
if: ${{ inputs.push-to-registry == 'yes' }}
Expand Down Expand Up @@ -102,8 96,10 @@ jobs:
ARTEFACT_REGISTRY_USERNAME: ${{ github.actor }}
ARTEFACT_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
TARGET_BRANCH: ${{ inputs.target-branch }}
RELEASE: ${{ if inputs.stage == 'release' && 'yes' || 'no' }}

- name: store-artifact ${{ matrix.asset }}
if: ${{ matrix.stage != 'release' || (matrix.component != 'agent' && matrix.component != 'coco-guest-components' && matrix.component != 'pause-image') }}
uses: actions/upload-artifact@v4
with:
name: kata-artifacts-amd64-${{ matrix.asset }}${{ inputs.tarball-suffix }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-kata-static-tarball-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 39,6 @@ jobs:
- rootfs-initrd
- shim-v2
- virtiofsd
stage:
- ${{ inputs.stage }}
steps:
- name: Adjust a permission for repo
run: |
Expand Down Expand Up @@ -79,8 77,10 @@ jobs:
ARTEFACT_REGISTRY_USERNAME: ${{ github.actor }}
ARTEFACT_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
TARGET_BRANCH: ${{ inputs.target-branch }}
RELEASE: ${{ if inputs.stage == 'release' && 'yes' || 'no' }}

- name: store-artifact ${{ matrix.asset }}
if: ${{ inputs.stage != 'release' || matrix.component != 'agent' }}
uses: actions/upload-artifact@v4
with:
name: kata-artifacts-arm64-${{ matrix.asset }}${{ inputs.tarball-suffix }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-kata-static-tarball-ppc64le.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 80,10 @@ jobs:
ARTEFACT_REGISTRY_USERNAME: ${{ github.actor }}
ARTEFACT_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
TARGET_BRANCH: ${{ inputs.target-branch }}
RELEASE: ${{ if inputs.stage == 'release' && 'yes' || 'no' }}

- name: store-artifact ${{ matrix.asset }}
if: ${{ input.stage != 'release' || matrix.component != 'agent' }}
uses: actions/upload-artifact@v4
with:
name: kata-artifacts-ppc64le-${{ matrix.asset }}${{ inputs.tarball-suffix }}
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/build-kata-static-tarball-s390x.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 39,6 @@ jobs:
- rootfs-initrd-confidential
- shim-v2
- virtiofsd
stage:
- ${{ inputs.stage }}
exclude:
- asset: pause-image
stage: release
- asset: coco-guest-components
stage: release
steps:
- name: Take a pre-action for self-hosted runner
run: ${HOME}/script/pre_action.sh ubuntu-2204
Expand Down Expand Up @@ -84,8 77,10 @@ jobs:
ARTEFACT_REGISTRY_USERNAME: ${{ github.actor }}
ARTEFACT_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
TARGET_BRANCH: ${{ inputs.target-branch }}
RELEASE: ${{ if inputs.stage == 'release' && 'yes' || 'no' }}

- name: store-artifact ${{ matrix.asset }}
if: ${{ inputs.stage != 'release' || (matrix.component != 'agent' && matrix.component != 'coco-guest-components' && matrix.component != 'pause-image') }}
uses: actions/upload-artifact@v4
with:
name: kata-artifacts-s390x-${{ matrix.asset }}${{ inputs.tarball-suffix }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-amd64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 10,7 @@ jobs:
build-kata-static-tarball-amd64:
uses: ./.github/workflows/build-kata-static-tarball-amd64.yaml
with:
push-to-registry: yes
stage: release

kata-deploy:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 10,7 @@ jobs:
build-kata-static-tarball-arm64:
uses: ./.github/workflows/build-kata-static-tarball-arm64.yaml
with:
push-to-registry: yes
stage: release

kata-deploy:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-ppc64le.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 10,7 @@ jobs:
build-kata-static-tarball-ppc64le:
uses: ./.github/workflows/build-kata-static-tarball-ppc64le.yaml
with:
push-to-registry: yes
stage: release

kata-deploy:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-s390x.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 10,7 @@ jobs:
build-kata-static-tarball-s390x:
uses: ./.github/workflows/build-kata-static-tarball-s390x.yaml
with:
push-to-registry: yes
stage: release
secrets: inherit

Expand Down
40 changes: 37 additions & 3 deletions tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 50,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 @@ -800,6 801,7 @@ install_ovmf_sev() {

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

install_cached_tarball_component \
Expand All @@ -821,6 823,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 @@ -837,6 840,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 @@ -1064,8 1068,8 @@ handle_build() {

rootfs-nvidia-gpu-image) install_image_nvidia_gpu ;;

rootfs-nvidia-gpu-initrd) install_initrd_nvidia_gpu ;;
rootfs-nvidia-gpu-initrd) install_initrd_nvidia_gpu ;;

rootfs-nvidia-gpu-confidential-image) install_image_nvidia_gpu_confidential ;;

rootfs-nvidia-gpu-confidential-initrd) install_initrd_nvidia_gpu_confidential ;;
Expand Down Expand Up @@ -1093,7 1097,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 @@ -1171,6 1175,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 d8468cb

Please sign in to comment.