Skip to content

Commit

Permalink
fix(VERSION): remove version dependecy during volume provisioning (#97)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
sai chaithanya authored Jun 29, 2020
1 parent 68bb336 commit f93924d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
29 changes: 15 additions & 14 deletions buildscripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions pkg/utils/maya.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -107,7 +106,6 @@ func ProvisionVolume(
WithNodeID(nodeID).
WithReplicaCount(replicaCount).
WithProvisionCapacityQty(sSize).
WithNewVersion(version.Current()).
WithDependentsUpgraded().
WithStatusPhase(cstorapis.CStorVolumeConfigPhasePending).Build()
if err != nil {
Expand Down

0 comments on commit f93924d

Please sign in to comment.