From 12578f11bc0db3dd1f9cd40a68bda2b2600f96e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Sat, 16 Mar 2024 13:27:37 +0100 Subject: [PATCH] releases: Assume VERSION has the correct version to be released MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is done in order to avoid having to push a commit to the main branch, which is against the defined rules on GitHub. By doing this, we need to educate ourselves to always bump the VERSION file as soon as a release is cut out. As a side effect of this change, we can drop the release-major and release-minor workflows, as those are not needed anymore. Fixes: #9064 - part IV Signed-off-by: Fabiano FidĂȘncio --- .github/workflows/release-major.yaml | 10 ----- .github/workflows/release-minor.yaml | 10 ----- .github/workflows/release.yaml | 14 ++---- docs/Release-Process.md | 11 ++--- tools/packaging/release/release.sh | 64 +++------------------------- 5 files changed, 14 insertions(+), 95 deletions(-) delete mode 100644 .github/workflows/release-major.yaml delete mode 100644 .github/workflows/release-minor.yaml diff --git a/.github/workflows/release-major.yaml b/.github/workflows/release-major.yaml deleted file mode 100644 index 6cdc71cb2e..0000000000 --- a/.github/workflows/release-major.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: Major Release -on: - workflow_dispatch - -jobs: - major-release: - uses: ./.github/workflows/release.yaml - with: - release-type: major - secrets: inherit \ No newline at end of file diff --git a/.github/workflows/release-minor.yaml b/.github/workflows/release-minor.yaml deleted file mode 100644 index 9b285d03c8..0000000000 --- a/.github/workflows/release-minor.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: Minor Release -on: - workflow_dispatch - -jobs: - minor-release: - uses: ./.github/workflows/release.yaml - with: - release-type: minor - secrets: inherit \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e243400805..dbd8db1acd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,10 +1,6 @@ name: Release Kata Containers on: - workflow_call: - inputs: - release-type: - required: true - type: string + workflow_dispatch jobs: release: @@ -19,13 +15,9 @@ jobs: - name: Get the new release version run: | - release_version=$(./tools/packaging/release/release.sh next-release-version) + release_version=$(./tools/packaging/release/release.sh release-version) echo "RELEASE_VERSION=$release_version" >> "$GITHUB_ENV" - - name: Update VERSION file - run: | - ./tools/packaging/release/release.sh update-version-file - - name: Create a new release run: | ./tools/packaging/release/release.sh create-new-release @@ -88,7 +80,7 @@ jobs: - name: Get the image tags run: | - release_version=$(./tools/packaging/release/release.sh next-release-version) + release_version=$(./tools/packaging/release/release.sh release-version) echo "KATA_DEPLOY_IMAGE_TAGS=$release_version latest" >> "$GITHUB_ENV" - name: Push multi-arch manifest diff --git a/docs/Release-Process.md b/docs/Release-Process.md index 53a89a1d67..13dab66741 100644 --- a/docs/Release-Process.md +++ b/docs/Release-Process.md @@ -10,14 +10,11 @@ This document lists the tasks required to create a Kata Release. ### Check GitHub Actions We make use of [GitHub actions](https://github.com/features/actions) in the -[minor](https://github.com/kata-containers/kata-containers/actions/workflows/release-minor.yaml) -and -[major](https://github.com/kata-containers/kata-containers/actions/workflows/release-major.yaml) -files from the -`kata-containers/kata-containers` repository to build and upload release -artifacts. +[release](https://github.com/kata-containers/kata-containers/actions/workflows/release.yaml) +file from the `kata-containers/kata-containers` repository to build and upload +release artifacts. -Those actions are manually triggered and are responsible for generating a new +The action is manually triggered and is responsible for generating a new release (including a new tag), pushing those to the `kata-containers/kata-containers` repository. diff --git a/tools/packaging/release/release.sh b/tools/packaging/release/release.sh index fbfd472434..42b70534bc 100755 --- a/tools/packaging/release/release.sh +++ b/tools/packaging/release/release.sh @@ -22,7 +22,6 @@ IFS=' ' read -a REGISTRIES <<< "${KATA_DEPLOY_REGISTRIES}" GH_TOKEN="${GH_TOKEN:-}" ARCHITECTURE="${ARCHITECTURE:-}" KATA_STATIC_TARBALL="${KATA_STATIC_TARBALL:-}" -RELEASE_TYPE="${RELEASE_TYPE:-}" function _die() { @@ -35,7 +34,6 @@ function _check_required_env_var() local env_var case ${1} in - RELEASE_TYPE) env_var="${RELEASE_TYPE}" ;; RELEASE_VERSION) env_var="${RELEASE_VERSION}" ;; GH_TOKEN) env_var="${GH_TOKEN}" ;; ARCHITECTURE) env_var="${ARCHITECTURE}" ;; @@ -51,56 +49,9 @@ function _check_required_env_var() return 0 } -function _next_release_version() +function _release_version() { - _check_required_env_var "RELEASE_TYPE" - - local current_release=$(cat "${repo_root_dir}/VERSION") - local current_major - local current_everything_else - local next_major - local next_minor - - IFS="." read current_major current_minor current_everything_else <<< ${current_release} - - case ${RELEASE_TYPE} in - major) - next_major=$(expr $current_major + 1) - next_minor=0 - ;; - minor) - next_major=${current_major} - # TODO: As we're moving from an alpha release to the - # new scheme, this check is needed for the very first - # release, after that it can be dropped and only the - # else part can be kept. - if grep -qE "alpha|rc" <<< ${current_everything_else}; then - next_minor=${current_minor} - else - next_minor=$(expr $current_minor + 1) - fi - ;; - *) - _die "${RELEASE_TYPE} is not a valid release type, it must be: major or minor" - ;; - esac - - next_release_number="${next_major}.${next_minor}.0" - echo "${next_release_number}" -} - -function _update_version_file() -{ - _check_required_env_var "RELEASE_VERSION" - - git config user.email "katacontainersbot@gmail.com" - git config user.name "Kata Containers Bot" - - echo "${RELEASE_VERSION}" > "${repo_root_dir}/VERSION" - git diff - git add "${repo_root_dir}/VERSION" - git commit -s -m "release: Kata Containers ${RELEASE_VERSION}" - git push + cat "${repo_root_dir}/VERSION" } function _create_our_own_notes() @@ -191,7 +142,7 @@ function _upload_kata_static_tarball() _check_required_env_var "ARCHITECTURE" _check_required_env_var "KATA_STATIC_TARBALL" - RELEASE_VERSION="$(_next_release_version)" + RELEASE_VERSION="$(_release_version)" new_tarball_name="kata-static-${RELEASE_VERSION}-${ARCHITECTURE}.tar.xz" mv ${KATA_STATIC_TARBALL} "${new_tarball_name}" @@ -201,7 +152,7 @@ function _upload_kata_static_tarball() function _upload_versions_yaml_file() { - RELEASE_VERSION="$(_next_release_version)" + RELEASE_VERSION="$(_release_version)" versions_file="kata-containers-${RELEASE_VERSION}-versions.yaml" cp "${repo_root_dir}/versions.yaml" ${versions_file} @@ -212,7 +163,7 @@ function _upload_vendored_code_tarball() { _check_required_env_var "GH_TOKEN" - RELEASE_VERSION="$(_next_release_version)" + RELEASE_VERSION="$(_release_version)" vendored_code_tarball="kata-containers-${RELEASE_VERSION}-vendor.tar.gz" bash -c "${repo_root_dir}/tools/packaging/release/generate_vendor.sh ${vendored_code_tarball}" @@ -223,7 +174,7 @@ function _upload_libseccomp_tarball() { _check_required_env_var "GH_TOKEN" - RELEASE_VERSION="$(_next_release_version)" + RELEASE_VERSION="$(_release_version)" GOPATH=${HOME}/go ./ci/install_yq.sh @@ -245,8 +196,7 @@ function main() case "${action}" in publish-multiarch-manifest) _publish_multiarch_manifest ;; - update-version-file) _update_version_file ;; - next-release-version) _next_release_version;; + release-version) _release_version;; create-new-release) _create_new_release ;; upload-kata-static-tarball) _upload_kata_static_tarball ;; upload-versions-yaml-file) _upload_versions_yaml_file ;;