Check release tag version and chart versions during the release process (#2524)
Co-authored-by: Bassem Dghaidi <568794+Link-@users.noreply.github.com>
This commit is contained in:
parent
41ebb43c65
commit
73e676f951
|
|
@ -46,6 +46,13 @@ jobs:
|
|||
# If inputs.ref is empty, it'll resolve to the default branch
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Check chart versions
|
||||
# Binary version and chart versions need to match.
|
||||
# In case of an upgrade, the controller will try to clean up
|
||||
# resources with older versions that should have been cleaned up
|
||||
# during the upgrade process
|
||||
run: ./hack/check-gh-chart-versions.sh ${{ inputs.release_tag_name }}
|
||||
|
||||
- name: Resolve parameters
|
||||
id: resolve_parameters
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -35,3 +35,5 @@ bin
|
|||
.DS_STORE
|
||||
|
||||
/test-assets
|
||||
|
||||
/.tools
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -202,7 +202,7 @@ generate: controller-gen
|
|||
|
||||
# Run shellcheck on runner scripts
|
||||
shellcheck: shellcheck-install
|
||||
$(TOOLS_PATH)/shellcheck --shell bash --source-path runner runner/*.sh
|
||||
$(TOOLS_PATH)/shellcheck --shell bash --source-path runner runner/*.sh hack/*.sh
|
||||
|
||||
docker-buildx:
|
||||
export DOCKER_CLI_EXPERIMENTAL=enabled ;\
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
# Checks the chart versions against an input version. Fails on mismatch.
|
||||
#
|
||||
# Usage:
|
||||
# check-gh-chart-versions.sh <VERSION>
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
TEXT_RED='\033[0;31m'
|
||||
TEXT_RESET='\033[0m'
|
||||
TEXT_GREEN='\033[0;32m'
|
||||
|
||||
target_version=$1
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo "Release version argument is required"
|
||||
echo
|
||||
echo "Usage: ${0} <VERSION>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chart_dir="$(pwd)/charts"
|
||||
|
||||
controller_version=$(yq .version < "${chart_dir}/gha-runner-scale-set-controller/Chart.yaml")
|
||||
controller_app_version=$(yq .appVersion < "${chart_dir}/gha-runner-scale-set-controller/Chart.yaml")
|
||||
|
||||
scaleset_version=$(yq .version < "${chart_dir}/gha-runner-scale-set/Chart.yaml")
|
||||
scaleset_app_version=$(yq .appVersion < "${chart_dir}/gha-runner-scale-set/Chart.yaml")
|
||||
|
||||
if [[ "${controller_version}" != "${target_version}" ]] ||
|
||||
[[ "${controller_app_version}" != "${target_version}" ]] ||
|
||||
[[ "${scaleset_version}" != "${target_version}" ]] ||
|
||||
[[ "${scaleset_app_version}" != "${target_version}" ]]; then
|
||||
echo -e "${TEXT_RED}Chart versions do not match${TEXT_RESET}"
|
||||
echo "Target version: ${target_version}"
|
||||
echo "Controller version: ${controller_version}"
|
||||
echo "Controller app version: ${controller_app_version}"
|
||||
echo "Scale set version: ${scaleset_version}"
|
||||
echo "Scale set app version: ${scaleset_app_version}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${TEXT_GREEN}Chart versions: ${controller_version}"
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
COMMIT=$(git rev-parse HEAD)
|
||||
TAG=$(git describe --exact-match --abbrev=0 --tags "${COMMIT}" 2> /dev/null || true)
|
||||
BRANCH=$(git branch | grep \* | cut -d ' ' -f2 | sed -e 's/[^a-zA-Z0-9+=._:/-]*//g' || true)
|
||||
BRANCH=$(git branch | grep "\*" | cut -d ' ' -f2 | sed -e 's/[^a-zA-Z0-9+=._:/-]*//g' || true)
|
||||
VERSION=""
|
||||
|
||||
if [ -z "$TAG" ]; then
|
||||
|
|
|
|||
Loading…
Reference in New Issue