From 5dbd752f8ff7bb271d8463a558df2102be5f5691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Tue, 23 Nov 2021 11:45:16 +0100 Subject: [PATCH] tools: Remove the check for the VERSION file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All repos we release (https://github.com/kata-containers/kata-containers and https://github.com/kata-containers/tests) have a VERSION file. Keeping a check for it, although useful for a new repo, just complicates the use-case we currently deal with. While here, let's also anchor the '#' and potentially exclude blank lines, following James' suggestion. Signed-off-by: Fabiano FidĂȘncio --- .../release/update-repository-version.sh | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/tools/packaging/release/update-repository-version.sh b/tools/packaging/release/update-repository-version.sh index 5a01b1840..c80277369 100755 --- a/tools/packaging/release/update-repository-version.sh +++ b/tools/packaging/release/update-repository-version.sh @@ -36,10 +36,6 @@ trap 'handle_error $LINENO' ERR get_changes() { local current_version=$1 [ -n "${current_version}" ] || die "current version not provided" - if [ "${current_version}" == "new" ];then - echo "Starting to version this repository" - return - fi # If for some reason there is not a tag this could fail # better fail and write the error in the PR @@ -134,20 +130,13 @@ bump_repo() { git fetch origin "${target_branch}" git checkout "origin/${target_branch}" -b "${branch}" - # All repos we build should have a VERSION file - if [ ! -f "VERSION" ]; then - current_version="new" - echo "${new_version}" >VERSION - else - current_version="$(grep -v '#' ./VERSION)" + local current_version="$(egrep -v '^(#|$)' ./VERSION)" - info "Updating VERSION file" - echo "${new_version}" >VERSION - if git diff --exit-code; then - info "${repo} already in version ${new_version}" - cat VERSION - return 0 - fi + info "Updating VERSION file" + echo "${new_version}" >VERSION + if git diff --exit-code; then + info "${repo} already in version ${new_version}" + return 0 fi if [ "${repo}" == "kata-containers" ]; then