diff --git a/ci-automation/capi_image.sh b/ci-automation/capi_image.sh new file mode 100644 index 00000000000..e5b49550df7 --- /dev/null +++ b/ci-automation/capi_image.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# +# Copyright (c) 2023 The Flatcar Maintainers. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# >>> This file is supposed to be SOURCED from the repository ROOT. <<< +# +# -- +function capi_image_build() { + # Run a subshell, so the traps, environment changes and global + # variables are not spilled into the caller. + ( + set -euo pipefail + + _capi_image_build_impl "${@}" + ) +} + +function capi_image_publish() { + # Run a subshell, so the traps, environment changes and global + # variables are not spilled into the caller. + ( + set -euo pipefail + + _capi_image_publish_impl "${@}" + ) +} + +function setup_capi_params() { + source sdk_lib/sdk_container_common.sh + source ci-automation/ci_automation_common.sh + source ci-automation/gpg_setup.sh + source sdk_container/.repo/manifests/version.txt + + echo "===================================================================" + azure_profile_config_file="" + secret_to_file azure_profile_config_file "${AZURE_PROFILE}" + azure_auth_config_file="" + secret_to_file azure_auth_config_file "${AZURE_AUTH_CREDENTIALS}" + + FLATCAR_CHANNEL="$(get_git_channel)" + FLATCAR_AZURE_AUTH_CREDENTIALS="${AZURE_AUTH_CREDENTIALS}" + + # Provide a python3 command for the k8s schedule parsing + export PATH="$PATH:$PWD/ci-automation/python-bin" + k8s_release_versions=$(ci-automation/get_kubernetes_releases.py) +} + +function _capi_image_build_impl() { + local arch="$1" + setup_capi_params + + for k8s_version in $k8s_release_versions + do + KUBERNETES_SEMVER="v${k8s_version}" + echo "== Building Flatcar SIG images from VHDs" + ci-automation/azure-sig.sh ensure-flatcar-staging-sig-image-version-from-vhd + echo "== Building Flatcar CAPI SIG image" + ci-automation/azure-sig.sh build-capi-staging-image + done +} + +function _capi_image_publish_impl() { + local arch="$1" + setup_capi_params + + for k8s_version in $k8s_release_versions + do + KUBERNETES_SEMVER="v${k8s_version}" + echo "== Publishing Flatcar SIG image" + ci-automation/azure-sig.sh publish-flatcar-image + # Publish Flatcar CAPI image + ci-automation/azure-sig.sh publish-flatcar-capi-image + done +} +# -- diff --git a/ci-automation/release.sh b/ci-automation/release.sh index 8e98d604c46..930fd9d9044 100644 --- a/ci-automation/release.sh +++ b/ci-automation/release.sh @@ -67,45 +67,6 @@ function release_build() { ) } -function stg_release_build() { - # This is a staging release build, run via a staging job. - # Thi - # Run a subshell, so the traps, environment changes and global - # variables are not spilled into the caller. - ( - set -euo pipefail - - _release_build_impl "${@}" - ) -} - -function _stg_release_build_impl() { - source sdk_lib/sdk_container_common.sh - source ci-automation/ci_automation_common.sh - source ci-automation/gpg_setup.sh - - source sdk_container/.repo/manifests/version.txt - # Needed because we are not the SDK container here - source sdk_container/.env - local sdk_version="${FLATCAR_SDK_VERSION}" - CHANNEL="$(get_git_channel)" - VERSION="${FLATCAR_VERSION}" - - azure_profile_config_file="" - secret_to_file azure_profile_config_file "${AZURE_PROFILE}" - azure_auth_config_file="" - secret_to_file azure_auth_config_file "${AZURE_AUTH_CREDENTIALS}" - - # Provide a python3 command for the k8s schedule parsing - export PATH="$PATH:$PWD/ci-automation/python-bin" - k8s_release_versions= $(ci-automation/get_kubernetes_releases.py) - for k8s_version in $k8s_release_versions - do - FLATCAR_CHANNEL="${CHANNEL}" FLATCAR_AZURE_AUTH_CREDENTIALS="${AZURE_AUTH_CREDENTIALS}" KUBERNETES_SEMVER="v${k8s_version}" ci-automation/azure-sig.sh - done -} - - function _inside_mantle() { # Run a subshell for the same reasons as above (