chore: enforce chart version matching release version in emqx_release.hrl

This commit is contained in:
Ivan Dyachkov 2023-08-11 09:15:27 +02:00
parent be9b8e5fa8
commit 8e384ddb6b
4 changed files with 20 additions and 11 deletions

View File

@ -14,8 +14,8 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 5.1.5
version: 5.1.5-build.3
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 5.1.5
appVersion: 5.1.5-build.3

View File

@ -11,6 +11,8 @@ help() {
echo "$0 PROFILE [options]"
echo
echo "-h|--help: To display this usage information"
echo "--release: Print release version from emqx_release.hrl"
echo
echo "--long: Print long vsn number. e.g. 5.0.0-ubuntu20.04-amd64"
echo " Otherwise short e.g. 5.0.0"
echo "--elixir: Include elixir version in the long version string"
@ -33,6 +35,10 @@ while [ "$#" -gt 0 ]; do
help
exit 0
;;
--release)
RELEASE_VERSION='yes'
shift 1
;;
--long)
LONG_VERSION='yes'
shift 1
@ -88,6 +94,11 @@ esac
## emqx_release.hrl is the single source of truth for release version
RELEASE="$(grep -E "define.+${RELEASE_EDITION}" apps/emqx/include/emqx_release.hrl | cut -d '"' -f2)"
if [ "${RELEASE_VERSION:-}" = 'yes' ]; then
echo "$RELEASE"
exit 0
fi
git_exact_vsn() {
local tag
tag="$(git describe --tags --match "${GIT_TAG_PREFIX}*" --exact 2>/dev/null)"

View File

@ -25,11 +25,11 @@ if [ "$CHART_VSN" != "$APP_VSN" ]; then
exit 2
fi
PKG_VSN="$(./pkg-vsn.sh "$PROFILE" | cut -d '-' -f 1)"
RELEASE_VSN="$(./pkg-vsn.sh "$PROFILE" --release)"
if [ "$CHART_VSN" != "$PKG_VSN" ]; then
if [ "$CHART_VSN" != "$RELEASE_VSN" ]; then
echo "Chart version in $CHART_FILE is not in sync with release version."
echo "Chart version: $CHART_VSN"
echo "Release version: $PKG_VSN"
echo "Release version: $RELEASE_VSN"
exit 3
fi

View File

@ -182,15 +182,13 @@ assert_tag_absent() {
}
assert_tag_absent "$TAG"
PKG_VSN=$(./pkg-vsn.sh "$PROFILE")
RELEASE_VSN=$(./pkg-vsn.sh "$PROFILE" --release)
## Assert package version is updated to the tag which is being created
assert_release_version() {
local tag="$1"
# shellcheck disable=SC2001
pkg_vsn="$(echo "$PKG_VSN" | sed 's/-g[0-9a-f]\{8\}$//g')"
if [ "${TAG_PREFIX}${pkg_vsn}" != "${tag}" ]; then
logerr "The release version ($pkg_vsn) is different from the desired git tag."
if [ "${TAG_PREFIX}${RELEASE_VSN}" != "${tag}" ]; then
logerr "The release version ($RELEASE_VSN) is different from the desired git tag."
logerr "Update the release version in emqx_release.hrl"
exit 1
fi
@ -220,7 +218,7 @@ fi
## Ensure relup paths are updated
## TODO: add relup path db
#./scripts/relup-base-vsns.escript check-vsn-db "$PKG_VSN" "$RELUP_PATHS"
#./scripts/relup-base-vsns.escript check-vsn-db "$RELEASE_VSN" "$RELUP_PATHS"
## Run some additional checks (e.g. some for enterprise edition only)
CHECKS_DIR="./scripts/rel/checks"