From f93924dbc7c7a4fa4bf94d16b3244914862c2a3e Mon Sep 17 00:00:00 2001 From: sai chaithanya Date: Mon, 29 Jun 2020 16:54:36 +0530 Subject: [PATCH] fix(VERSION): remove version dependecy during volume provisioning (#97) This PR does the following changes - Removes the dependency with CVC Version during volume provisioing. - Updates the VERSION variable with ${CURRENT_BRANCH_NAME}-dev during build time Signed-off-by: mittachaitu --- buildscripts/build.sh | 29 +++++++++++++++-------------- pkg/utils/maya.go | 2 -- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/buildscripts/build.sh b/buildscripts/build.sh index b14efdf01..54022f880 100755 --- a/buildscripts/build.sh +++ b/buildscripts/build.sh @@ -17,16 +17,6 @@ # This script builds the application from source for multiple platforms. set -e -VERSION_FILE_PATH="$GOPATH/src/github.com/openebs/cstor-csi/VERSION" - -on_exit() { - ## Delete VERSION file - echo "Deleteing VERSION File($VERSION_FILE_PATH) that got generated during build time" - rm -f "$VERSION_FILE_PATH" -} - -trap 'on_exit' EXIT - # Get the parent directory of where this script is. SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done @@ -51,6 +41,15 @@ fi # Get the version details # VERSION="$(cat $GOPATH/src/github.com/openebs/cstor-csi/VERSION)" +# Determine the current branch +CURRENT_BRANCH="" +if [ -z "${TRAVIS_BRANCH}" ]; +then + CURRENT_BRANCH=$(git branch | grep "\*" | cut -d ' ' -f2) +else + CURRENT_BRANCH="${TRAVIS_BRANCH}" +fi + ## Populate the version based on release tag ## If travis tag is set then assign it as VERSION and ## if travis tag is empty then mark version as ci @@ -59,15 +58,17 @@ if [ -n "$TRAVIS_TAG" ]; then # Example: v1.10.0 maps to 1.10.0 # Example: 1.10.0 maps to 1.10.0 # Example: v1.10.0-custom maps to 1.10.0-custom + # So Version will be same as TRAVIS_TAG by triming v VERSION="${TRAVIS_TAG#v}" else - VERSION="dev" + ## Marking VERSION as current_branch-dev + ## Example: master maps to master-dev + ## Example: v1.11.x-ee to 1.11.x-ee-dev + ## Example: v1.10.x to 1.10.x-dev + VERSION="${CURRENT_BRANCH#v}-dev" fi echo "Building for VERSION ${VERSION}" -## Below line will help to get current version for various binaries -echo "${VERSION}" > "$VERSION_FILE_PATH" - # Determine the arch/os combos we're building for UNAME=$(uname) diff --git a/pkg/utils/maya.go b/pkg/utils/maya.go index a0824a440..5ac1b1c0c 100644 --- a/pkg/utils/maya.go +++ b/pkg/utils/maya.go @@ -12,7 +12,6 @@ import ( csivol "github.com/openebs/cstor-csi/pkg/cstor/volumeattachment" cvc "github.com/openebs/cstor-csi/pkg/cstor/volumeconfig" pvc "github.com/openebs/cstor-csi/pkg/kubernetes/persistentvolumeclaim" - "github.com/openebs/cstor-csi/pkg/version" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" @@ -107,7 +106,6 @@ func ProvisionVolume( WithNodeID(nodeID). WithReplicaCount(replicaCount). WithProvisionCapacityQty(sSize). - WithNewVersion(version.Current()). WithDependentsUpgraded(). WithStatusPhase(cstorapis.CStorVolumeConfigPhasePending).Build() if err != nil {