Skip to content

Commit

Permalink
refactor(travis): tag to release branch conversion (#56)
Browse files Browse the repository at this point in the history
There are cases where the tags can be on custom release branches
like v1.9.x-hotfix or v1.9.x-custom, apart from regular release
branch (v1.9.x).

This commit helps with translating the given tag to corresponding
release branch with custom suffixes.

Using the new logic, some examples of tag to branch mappings are:

v1.9.0-RC1 => v1.9.x
v1.9.0-hotfixid => v1.9.x-hotfixid
v1.9.0 => v1.9.x
v1.9.1 => v1.9.x
v1.9.0-custom-RC1 => v1.9.x-custom
v1.9.0-custom => v1.9.x-custom
v1.9.1-custom => v1.9.x-custom

Signed-off-by: kmova <[email protected]>
  • Loading branch information
kmova authored May 6, 2020
1 parent deb276c commit 31e4bc2
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,22 @@ script:
# If this build is running due to travis release tag, then
# go ahead and tag the dependent repo.
#
# $TRAVIS_BRANCH contains the same value as $TRAVIS_TAG.
# Example: v1.9.0-RC1 tag and 1.9.0-RC1 branch.
# OpenEBS release are done from branches named as v1.9.x.
# Convert the TRAVIS_TAG to the corresponding release branch.
# $TRAVIS_BRANCH contains the same value as $TRAVIS_TAG.
# Example: TRAVIS_TAG and TRAVIS_BRANCH will have v1.9.0-RC1,
# when github release tag is v1.9.0-RC1
#
# OpenEBS release are triggered from release branches that are named
# as v1.9.x or v1.9.x-hotfix or v1.9.x-custom
#
# The tag to release branch conversion should be handled as follows:
# v1.9.0-RC1 => should be v1.9.x
# v1.9.0-hotfixid => should be v1.9.x-hotfixid
# v1.9.0 => should be v1.9.x
# v1.9.1 => should be v1.9.x
# v1.9.0-custom-RC1 => should be v1.9.x-custom
# v1.9.0-custom => should be v1.9.x-custom
# v1.9.1-custom => should be v1.9.x-custom
#
# Allow for building forked openebs pipelines.
# Tag the downstream repos under current repo org.
Expand All @@ -92,7 +104,13 @@ script:
export REPO_ORG;
fi
- if [ ! -z $TRAVIS_TAG ] && [ "$TRAVIS_REPO_SLUG" == "$REPO_ORG/libcstor" ]; then
REL_BRANCH=$(echo $(echo "$TRAVIS_TAG" | cut -d'-' -f1 | rev | cut -d'.' -f2- | rev).x) ;
TAG_SUFFIX=$(echo "$TRAVIS_TAG" | cut -d'-' -f2);
if [ "$TAG_SUFFIX" == "$TRAVIS_TAG" ] || [[ $TAG_SUFFIX =~ ^RC ]]; then
REL_SUFFIX="";
else
REL_SUFFIX="-$TAG_SUFFIX";
fi;
REL_BRANCH=$(echo $(echo "$TRAVIS_TAG" | cut -d'-' -f1 | rev | cut -d'.' -f2- | rev).x$REL_SUFFIX) ;
./buildscripts/git-release "$REPO_ORG/cstor" "$TRAVIS_TAG" "$REL_BRANCH" || travis_terminate 1;
fi
after_failure:
Expand Down

0 comments on commit 31e4bc2

Please sign in to comment.