diff --git a/deploy/ci/tasks/dev-releases/check-gh-release.yml b/deploy/ci/tasks/dev-releases/check-gh-release.yml index b9a23fc69f..64c34f6ddd 100644 --- a/deploy/ci/tasks/dev-releases/check-gh-release.yml +++ b/deploy/ci/tasks/dev-releases/check-gh-release.yml @@ -16,14 +16,13 @@ run: - | # Check that the Github release DOES NOT exist ROOT_DIR=${PWD} - VERSION=$(cat image-tag/v2-version) - FULL_VERSION=$(cat image-tag/v2-alpha-tag) - GIT_TAG=$(cat image-tag/v2-tag) STRATOS=${ROOT_DIR}/stratos + source "${STRATOS}/deploy/ci/tasks/dev-releases/vars-helper.sh" + source ${STRATOS}/deploy/ci/tasks/dev-releases/github-helper.sh # Check tagged release version is consistent with package.json version - TAG_RELEASE_VERSION=$(echo ${FULL_VERSION} | cut -d"-" -f1) + TAG_RELEASE_VERSION=$(echo ${LATEST_TAG} | cut -d"-" -f1) if [ "${TAG_RELEASE_VERSION}" != "${VERSION}" ]; then echo "Package.json version is not consistent with tag release version! ${TAG_RELEASE_VERSION} != ${VERSION}" exit 1 @@ -32,7 +31,7 @@ run: # Check that the release exists set +e - github-release info -t ${GIT_TAG} + github-release info -t ${RELEASE_TAG} RETVAL=$? set -e diff --git a/deploy/ci/tasks/dev-releases/create-chart.yml b/deploy/ci/tasks/dev-releases/create-chart.yml index 9cb8935fd7..55fb8f9eca 100644 --- a/deploy/ci/tasks/dev-releases/create-chart.yml +++ b/deploy/ci/tasks/dev-releases/create-chart.yml @@ -21,12 +21,14 @@ run: helm init --client-only ROOT_DIR=$PWD STRATOS=${ROOT_DIR}/stratos + source "${STRATOS}/deploy/ci/tasks/dev-releases/vars-helper.sh" + source ${STRATOS}/deploy/ci/tasks/dev-releases/create-chart-helper.sh HELM_REPO=${ROOT_DIR}/helm-repo/${HELM_REPO_PATH} - GIT_TAG=$(cat image-tag/v2-alpha-tag) - VERSION=$(cat image-tag/v2-version) - RELEASE_VERSION=$(cat image-tag/v2-tag) - COMMIT=$(cat image-tag/v2-commit) + + GIT_TAG=${LATEST_TAG} + RELEASE_VERSION=${RELEASE_TAG} + COMMIT=${COMMIT_HASH} # Required for setupAndPushChange commit message IMAGE_TAG=${GIT_TAG} diff --git a/deploy/ci/tasks/dev-releases/generate-tag-files.yml b/deploy/ci/tasks/dev-releases/generate-tag-files.yml index 18c0918107..1a56bae074 100644 --- a/deploy/ci/tasks/dev-releases/generate-tag-files.yml +++ b/deploy/ci/tasks/dev-releases/generate-tag-files.yml @@ -18,27 +18,12 @@ run: - | echo "Generate tag files started..." - cd stratos - - RELEASE_TAG=$(cat .git/ref) - - # RELEASE_TAG is the full tag that started the pipleinee, e.g. '2.0.0-rc.1' - VERSION=$(cat package.json | grep version | grep -Po "([0-9\.]?)*") - COMMIT_HASH=$(git log -1 --format="%h") - LATEST_TAG=$VERSION-${COMMIT_HASH} - SOURCE_CODE_REPO=$(git config --get remote.origin.url) + ROOT_DIR=${PWD} + STRATOS=${ROOT_DIR}/stratos + source "${STRATOS}/deploy/ci/tasks/dev-releases/vars-helper.sh" - echo "Got version $VERSION from package.json." - - echo "Got $LATEST_TAG as the latest git tag." + cd stratos - if [ ! -z ${TAG_SUFFIX} ]; then - if [ "${TAG_SUFFIX}" != "null" ]; then - echo "Adding tag suffix '$TAG_SUFFIX' to the latest tag." - LATEST_TAG=${LATEST_TAG}-${TAG_SUFFIX} - echo "The latest tag is now $LATEST_TAG." - fi - fi echo "Running store-git-metadata.sh..." ./build/store-git-metadata.sh @@ -73,17 +58,13 @@ run: echo "Created v2-alpha-tag, v2-version and build-args." - echo "Contents of build-args:" - cat build-args - - echo "Contents of ui-build-args:" - cat ui-build-args + echo "Contents of files to be packaged:" - echo "Contents of v2-alpha-tag:" - cat v2-alpha-tag - - echo "Contents of image-labels:" - cat image-labels + for f in *; do + echo "File: $f ______________________________________________________" + cat $f + echo "" + done set -x diff --git a/deploy/ci/tasks/dev-releases/update-gh-release.yml b/deploy/ci/tasks/dev-releases/update-gh-release.yml index 80a79a98ec..f3897c03d3 100644 --- a/deploy/ci/tasks/dev-releases/update-gh-release.yml +++ b/deploy/ci/tasks/dev-releases/update-gh-release.yml @@ -17,10 +17,12 @@ run: - | # Create Github release ROOT_DIR=${PWD} - VERSION=$(cat image-tag/v2-version) - FULL_VERSION=$(cat image-tag/v2-alpha-tag) - GIT_TAG=$(cat image-tag/v2-tag) STRATOS=${ROOT_DIR}/stratos + source "${STRATOS}/deploy/ci/tasks/dev-releases/vars-helper.sh" + + FULL_VERSION=${LATEST_TAG} + GIT_TAG=${RELEASE_TAG} + source ${STRATOS}/deploy/ci/tasks/dev-releases/github-helper.sh # Check tagged release version is consistent with package.json version diff --git a/deploy/ci/tasks/dev-releases/vars-helper.sh b/deploy/ci/tasks/dev-releases/vars-helper.sh new file mode 100755 index 0000000000..edc0c1cd16 --- /dev/null +++ b/deploy/ci/tasks/dev-releases/vars-helper.sh @@ -0,0 +1,32 @@ + +pushd stratos + +VERSION=$(cat package.json | grep version | grep -Po "([0-9\.]?)*") +COMMIT_HASH=$(git log -1 --format="%h") +LATEST_TAG=$VERSION-${COMMIT_HASH} +SOURCE_CODE_REPO=$(git config --get remote.origin.url) + +# Check that the RELEASE_TAG matches the version +RELEASE_TAG=$(git describe) +if [[ "${RELEASE_TAG}" != ${VERSION}* ]]; then + echo "Error: Can not get tag for this release - got ${RELEASE_TAG}" + exit 1 +fi + +if [ ! -z ${TAG_SUFFIX} ]; then + if [ "${TAG_SUFFIX}" != "null" ]; then + echo "Adding tag suffix '$TAG_SUFFIX' to the latest tag." + LATEST_TAG=${LATEST_TAG}-${TAG_SUFFIX} + echo "The latest tag is now $LATEST_TAG." + fi +fi + +popd + +set +x +echo "VERSION : ${VERSION}" +echo "COMMIT_HASH : ${COMMIT_HASH}" +echo "LATEST_TAG : ${LATEST_TAG}" +echo "SOURCE_CODE_REPO : ${SOURCE_CODE_REPO}" +echo "RELEASE_TAG : ${RELEASE_TAG}" +set -x diff --git a/deploy/kubernetes/console/templates/deployment.yaml b/deploy/kubernetes/console/templates/deployment.yaml index 40280e1ba8..919098add4 100644 --- a/deploy/kubernetes/console/templates/deployment.yaml +++ b/deploy/kubernetes/console/templates/deployment.yaml @@ -29,7 +29,7 @@ spec: type: RollingUpdate rollingUpdate: maxSurge: 0 - maxUnavailable: 1 + maxUnavailable: 1 selector: matchLabels: app.kubernetes.io/name: "stratos" diff --git a/src/jetstream/config.dev b/src/jetstream/config.dev index d22fff32f8..fa8c377f29 100644 --- a/src/jetstream/config.dev +++ b/src/jetstream/config.dev @@ -67,4 +67,4 @@ HELM_CACHE_FOLDER=./.helm-cache # DB_USER=stratos # DB_PASSWORD=strat0s # DB_DATABASE_NAME=stratosdb -# DB_SSL_MODE=disable \ No newline at end of file +# DB_SSL_MODE=disable