openebs-archive / libcstor

CAS Data Engine - Library to serve IOs on uZFS with synchronous replication, snapshots and clones
https://www.openebs.io
Apache License 2.0
18 stars 27 forks source link

refactor(travis): tag to release branch conversion #56

Closed kmova closed 4 years ago

kmova commented 4 years ago

Why is this PR required? What issue does it fix?: 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).

What this PR does?:

This commit helps with translating the given tag to the 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

Does this PR require any upgrade changes?: NA

If the changes in this PR are manually verified, list down the scenarios covered and commands you used for testing with logs: Manually verified the script changes using a test script as follows:

#!/bin/bash
set -e
starts_with() {
  INPUT=$1
  REL_SUFFIX=$(echo "$INPUT" | cut -d'-' -f2)
  if [ "$REL_SUFFIX" == "$INPUT" ] || [[ $REL_SUFFIX =~ ^RC ]]; then 
    REL_SUFFIX=""
  else
    REL_SUFFIX="-$REL_SUFFIX"
  fi
  echo "$INPUT is" $(echo "$INPUT" | cut -d'-' -f1 | rev | cut -d'.' -f2- | rev).x$REL_SUFFIX
}
starts_with "v1.10.0-RC1"
starts_with "v1.10.0"
starts_with "v1.10.1-RC1"
starts_with "v1.10.1"
starts_with "v1.10.0-custom-RC1"
starts_with "v1.10.0-custom"
starts_with "v1.10.1-custom-RC1"
starts_with "v1.10.1-custom"
starts_with "v1.10.1-hostfixid"

Output:

v1.10.0-RC1 is v1.10.x
v1.10.0 is v1.10.x
v1.10.1-RC1 is v1.10.x
v1.10.1 is v1.10.x
v1.10.0-custom-RC1 is v1.10.x-custom
v1.10.0-custom is v1.10.x-custom
v1.10.1-custom-RC1 is v1.10.x-custom
v1.10.1-custom is v1.10.x-custom
v1.10.1-hostfixid is v1.10.x-hostfixid

Any additional information for your reviewer?: Mention if this PR is part of any design or a continuation of previous PRs

Checklist:

Signed-off-by: kmova kiran.mova@mayadata.io