From f374020b17d3d0fbbc34d15f10ece3fc335d248a Mon Sep 17 00:00:00 2001 From: shubham Date: Mon, 6 Jul 2020 09:01:10 +0530 Subject: [PATCH 1/2] fix(VERSION): omit generation of VERSION file Signed-off-by: shubham --- VERSION | 1 - buildscripts/build.sh | 29 ++++++++++++++++++- .../openebs.io/v1alpha1/versionDetails.go | 4 +-- pkg/upgrade/upgrader/exec.go | 14 +++++++-- 4 files changed, 41 insertions(+), 7 deletions(-) delete mode 100644 VERSION diff --git a/VERSION b/VERSION deleted file mode 100644 index 1cac385c6c..0000000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.11.0 diff --git a/buildscripts/build.sh b/buildscripts/build.sh index b9a91ad967..12d4b657c4 100755 --- a/buildscripts/build.sh +++ b/buildscripts/build.sh @@ -25,7 +25,34 @@ if [[ -n "$TRAVIS_TAG" ]] && [[ $TRAVIS_TAG != *"RC"* ]]; then fi # Get the version details -VERSION="$(cat $GOPATH/src/github.com/openebs/maya/VERSION)" +#VERSION="$(cat $GOPATH/src/github.com/openebs/cstor-operators/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 +if [ -n "$TRAVIS_TAG" ]; then + # Trim the `v` from the TRAVIS_TAG if it exists + # 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 + VERSION="${TRAVIS_TAG#v}" +else + ## Marking VERSION as current_branch-dev + ## Example: master branch maps to master-dev + ## Example: v1.11.x-ee branch to 1.11.x-ee-dev + ## Example: v1.10.x branch to 1.10.x-dev + VERSION="${CURRENT_BRANCH#v}-dev" +fi + +echo "Building for ${VERSION} VERSION" + VERSION_META="$(cat $GOPATH/src/github.com/openebs/maya/BUILDMETA)" # Determine the arch/os combos we're building for diff --git a/pkg/apis/openebs.io/v1alpha1/versionDetails.go b/pkg/apis/openebs.io/v1alpha1/versionDetails.go index 925523d504..22b3eb4219 100644 --- a/pkg/apis/openebs.io/v1alpha1/versionDetails.go +++ b/pkg/apis/openebs.io/v1alpha1/versionDetails.go @@ -19,7 +19,6 @@ package v1alpha1 import ( "strings" - "github.com/openebs/maya/pkg/version" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -28,8 +27,9 @@ var ( "1.0.0": true, "1.1.0": true, "1.2.0": true, "1.3.0": true, "1.4.0": true, "1.5.0": true, "1.6.0": true, "1.7.0": true, "1.8.0": true, "1.9.0": true, "1.10.0": true, "1.11.0": true, + "1.12.0": true, } - validDesiredVersion = version.GetVersion() + validDesiredVersion = "1.12.0" ) // IsCurrentVersionValid verifies if the current version is valid or not diff --git a/pkg/upgrade/upgrader/exec.go b/pkg/upgrade/upgrader/exec.go index 0fb1402d8f..1aeb76db05 100644 --- a/pkg/upgrade/upgrader/exec.go +++ b/pkg/upgrade/upgrader/exec.go @@ -186,15 +186,23 @@ func verifyMayaApiserver(openebsNamespace string) error { }, ) if err != nil { - return errors.Wrapf(err, "failed to get maya-apiserver deployment") + return errors.Wrapf(err, "failed to list maya-apiserver pod(s)") } if len(mayaPods.Items) == 0 { return errors.Errorf( - "failed to get maya-apiserver deployment in %s", + "failed to get maya-apiserver pod(s) in %s", openebsNamespace, ) } - if len(mayaPods.Items) > 1 { + mayaDeploy, err := deployClient.WithNamespace(openebsNamespace).List( + &metav1.ListOptions{ + LabelSelector: mayaLabels, + }, + ) + if err != nil { + return errors.Wrapf(err, "failed to get maya-apiserver deployment") + } + if len(mayaPods.Items) != int(*mayaDeploy.Items[0].Spec.Replicas) { return errors.Errorf("control plane upgrade is not complete try after some time") } if mayaPods.Items[0].Labels["openebs.io/version"] != upgradeVersion { From c1129c1d24ded81bcce636ac6fa57d04ff6a5cf1 Mon Sep 17 00:00:00 2001 From: shubham Date: Mon, 6 Jul 2020 11:21:34 +0530 Subject: [PATCH 2/2] revert version file changes Signed-off-by: shubham --- VERSION | 1 + buildscripts/build.sh | 29 +------------------ .../openebs.io/v1alpha1/versionDetails.go | 3 +- 3 files changed, 4 insertions(+), 29 deletions(-) create mode 100644 VERSION diff --git a/VERSION b/VERSION new file mode 100644 index 0000000000..0eed1a29ef --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.12.0 diff --git a/buildscripts/build.sh b/buildscripts/build.sh index 12d4b657c4..b9a91ad967 100755 --- a/buildscripts/build.sh +++ b/buildscripts/build.sh @@ -25,34 +25,7 @@ if [[ -n "$TRAVIS_TAG" ]] && [[ $TRAVIS_TAG != *"RC"* ]]; then fi # Get the version details -#VERSION="$(cat $GOPATH/src/github.com/openebs/cstor-operators/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 -if [ -n "$TRAVIS_TAG" ]; then - # Trim the `v` from the TRAVIS_TAG if it exists - # 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 - VERSION="${TRAVIS_TAG#v}" -else - ## Marking VERSION as current_branch-dev - ## Example: master branch maps to master-dev - ## Example: v1.11.x-ee branch to 1.11.x-ee-dev - ## Example: v1.10.x branch to 1.10.x-dev - VERSION="${CURRENT_BRANCH#v}-dev" -fi - -echo "Building for ${VERSION} VERSION" - +VERSION="$(cat $GOPATH/src/github.com/openebs/maya/VERSION)" VERSION_META="$(cat $GOPATH/src/github.com/openebs/maya/BUILDMETA)" # Determine the arch/os combos we're building for diff --git a/pkg/apis/openebs.io/v1alpha1/versionDetails.go b/pkg/apis/openebs.io/v1alpha1/versionDetails.go index 22b3eb4219..ebc83c92eb 100644 --- a/pkg/apis/openebs.io/v1alpha1/versionDetails.go +++ b/pkg/apis/openebs.io/v1alpha1/versionDetails.go @@ -19,6 +19,7 @@ package v1alpha1 import ( "strings" + "github.com/openebs/maya/pkg/version" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -29,7 +30,7 @@ var ( "1.8.0": true, "1.9.0": true, "1.10.0": true, "1.11.0": true, "1.12.0": true, } - validDesiredVersion = "1.12.0" + validDesiredVersion = version.GetVersion() ) // IsCurrentVersionValid verifies if the current version is valid or not