Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
fix(build): pom_version in release
Browse files Browse the repository at this point in the history
Even though the daily release passed, it did so due to poor error
handling. This should fix the error handling and the error that occurred
in the daily release.

For some reason (no error text so no way to know), fetching the version
from `pom.xml` via Maven failed. This uses the same `grep` based command
we use for incremental license format in `bin/misc/format-license.sh`
against the `app/pom.xml` to fetch the version instead of using Maven.

Should fix: `ERROR: Cannot extract version from app/pom.xml`

(cherry picked from commit d48f164)
  • Loading branch information
zregvart committed Apr 2, 2020
1 parent 99319e9 commit 1f9830d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tools/bin/commands/release
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ EOT
get_release_version() {

if [ $(hasflag --snapshot-release) ]; then
echo $(calc_timestamp_version "$topdir")
return
echo $(calc_timestamp_version "$topdir")
return 1
fi

local release_version=$(readopt --release-version)
Expand Down Expand Up @@ -179,8 +179,7 @@ create_moving_tag_release() {

calc_timestamp_version() {
local topdir=$1
cd $topdir/app
local pom_version=$(./mvnw -N help:evaluate -Dexpression="project.version" | grep '^[0-9]' | sed -e 's/\([0-9]*\.[0-9]*\).*/\1/')
local pom_version=$(grep -oPm2 "(?<=<version>)[^<]+" "$topdir/app/pom.xml"| tail -1| sed -e 's/\([0-9]*\.[0-9]*\).*/\1/')
if [ -z "${pom_version}" ]; then
echo "ERROR: Cannot extract version from app/pom.xml"
return 1
Expand Down Expand Up @@ -579,8 +578,8 @@ extract_minor_version() {
local version=$1
local minor_version=$(echo $version | sed 's/^\([0-9]*\.[0-9]*\)\.[0-9]*\(-.*\)*$/\1/')
if [ "$minor_version" = "$version" ]; then
echo "ERROR: Cannot extract minor version from $version"
return
echo "ERROR: Cannot extract minor version from ${version}, computed ${minor_version}"
return 1
fi
echo $minor_version
}

0 comments on commit 1f9830d

Please sign in to comment.