pingtimeout commented on code in PR #2383: URL: https://github.com/apache/polaris/pull/2383#discussion_r2510628439
########## releasey/libs/_version.sh: ########## @@ -0,0 +1,179 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# +# Utility functions for version validation and version.txt manipulation +# + +LIBS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +source "$LIBS_DIR/_constants.sh" +source "$LIBS_DIR/_exec.sh" + +function validate_and_extract_branch_version { + # This function validates the format of a release branch version and extracts its components (major.minor). + # It now accepts the major.minor.x format (e.g., "1.1.x") instead of exact version format. + # It returns 0 if the version is valid and sets the global variables major, minor. + # The patch version is not extracted from the branch name as it uses the "x" placeholder. + # Otherwise, it returns 1. + local version="$1" + + if [[ ! ${version} =~ ${BRANCH_VERSION_REGEX} ]]; then + return 1 + fi + + major="${BASH_REMATCH[1]}" + minor="${BASH_REMATCH[2]}" + # patch is not set from branch name since it uses "x" placeholder + + return 0 +} + +function validate_and_extract_git_tag_version { + # This function validates the format of a git tag version and extracts its components (major.minor.patch and rc number). + # It is similar to validate_and_extract_rc_version, but for git tag format. + # It returns 0 if the version is valid and sets the global variables major, minor, patch, and rc_number. + # It also sets the global variable version_without_rc to the "major.minor.patch-incubating" format without the rc number. + # Otherwise, it returns 1. + local version="$1" + + if [[ ! ${version} =~ ${VERSION_REGEX_GIT_TAG} ]]; then + return 1 + fi + + major="${BASH_REMATCH[1]}" + minor="${BASH_REMATCH[2]}" + patch="${BASH_REMATCH[3]}" + rc_number="${BASH_REMATCH[4]}" + version_without_rc="${major}.${minor}.${patch}-incubating" + + return 0 +} + +function validate_and_extract_polaris_version { + # This function validates the format of a Polaris version and extracts its components (major.minor.patch). + # It accepts the full version format (e.g., "1.0.0-incubating") and sets the global variables major, minor, patch. + # It also sets the global variable version_without_rc to the "major.minor.patch-incubating" format. + # Returns 0 if the version is valid, 1 otherwise. + local version="$1" + + if [[ ! ${version} =~ ${VERSION_REGEX} ]]; then + return 1 + fi + + major="${BASH_REMATCH[1]}" + minor="${BASH_REMATCH[2]}" + patch="${BASH_REMATCH[3]}" + version_without_rc="${major}.${minor}.${patch}-incubating" + + return 0 +} + +function update_version { + local version="$1" + local current_version + current_version=$(cat "$VERSION_FILE") + update_version_txt "${version}" + update_helm_version "${current_version}" "${version}" Review Comment: Ack. With you change it works. That being said, I think it is a problem of the release guide not asking for the versions in `helm/` to be bumped after a release. Like, they are currently still `1.2.0-SNAPSHOT`, which has already been released final, so this is an error. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
