From 288978012dff56019cc5bb669fc877def3dffccf Mon Sep 17 00:00:00 2001 From: David Edwards Date: Tue, 3 Mar 2020 16:21:18 +0000 Subject: [PATCH] Clean variables + comments [skip ci] --- .travis.yml | 10 +++++----- scripts/travis/companyReleaseDeployment.sh | 5 +++-- scripts/travis/prepareEngineeringRelease.sh | 4 ++-- scripts/travis/verifyReleaseTag.sh | 12 ++++++------ 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 51e11e65e..0ab002fcb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,8 @@ env: global: - VERSION_EDITION=Community # Must be in the format - ie. 6.3.0-repo-xxxx-x or 6.3.0-A-x - - release_version=6.3.0-repo-4735-2-13 - - development_version=6.3.0-SNAPSHOT + - RELEASE_VERSION=6.3.0-repo-4735-2-13 + - DEVELOPMENT_VERSION=6.3.0-SNAPSHOT - COMM_RELEASE_VERSION=202003-test-release branches: @@ -110,11 +110,10 @@ matrix: - travis_wait 30 mvn install -q -f tests/tas-integration/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false - stage: Engineering Release name: "Maven release" - # Leaving blank will auto increment the install: skip - # Fail the job if there is a docker image tag that matches the release_version (or project version in the POM if not set) + # Fail the job if there is a docker image tag that matches the RELEASE_VERSION (or project version in the POM if not set) before_script: bash ./scripts/travis/verifyReleaseTag.sh - script: bash ./scripts/travis/buildRelease.sh ${release_version} ${development_version} + script: bash ./scripts/travis/buildRelease.sh ${RELEASE_VERSION} ${DEVELOPMENT_VERSION} # if the release stage fails rollback after_failure: - mvn release:rollback -DscmCommentPrefix="[maven-release-plugin][skip ci] " @@ -130,6 +129,7 @@ matrix: acl: private upload_dir: "/alfresco-content-services-community/release/${TRAVIS_BRANCH}/${TRAVIS_BUILD_NUMBER}/" local_dir: deploy_dir + # extra check to run only on master or develop branch on: all_branches: true condition: $TRAVIS_BRANCH =~ ^(master|develop|feature/REPO-4735_Add-release-stages-2)$ diff --git a/scripts/travis/companyReleaseDeployment.sh b/scripts/travis/companyReleaseDeployment.sh index dbd0b7f8b..4abd3f322 100755 --- a/scripts/travis/companyReleaseDeployment.sh +++ b/scripts/travis/companyReleaseDeployment.sh @@ -1,8 +1,9 @@ #!/usr/bin/env bash set -e -if [ ${COMM_RELEASE_VERSION} = "" ]; +if [ -z ${COMM_RELEASE_VERSION} ] || [ -z ${RELEASE_VERSION} ]; then + echo "Please provide a COMM_RELEASE_VERSION and Development verison in the format - (6.3.0-EA or 6.3.0-SNAPSHOT)" exit -1 fi @@ -13,4 +14,4 @@ SOURCE=s3://alfresco-artefacts-staging/alfresco-content-services-community/$buil DESTINATION=s3://eu.dl.alfresco.com/release/community/$COMM_RELEASE_VERSION-build-$build_number aws s3 cp --acl private $SOURCE/alfresco.war $DESTINATION/alfresco.war -aws s3 cp --acl private $SOURCE/alfresco-content-services-community-distribution-$release_version.zip $DESTINATION/alfresco-content-services-community-distribution-$release_version.zip \ No newline at end of file +aws s3 cp --acl private $SOURCE/alfresco-content-services-community-distribution-$RELEASE_VERSION.zip $DESTINATION/alfresco-content-services-community-distribution-$RELEASE_VERSION.zip \ No newline at end of file diff --git a/scripts/travis/prepareEngineeringRelease.sh b/scripts/travis/prepareEngineeringRelease.sh index e10b218d4..f3befca83 100644 --- a/scripts/travis/prepareEngineeringRelease.sh +++ b/scripts/travis/prepareEngineeringRelease.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -ev -if [ -z ${release_version} ]; +if [ -z ${RELEASE_VERSION} ]; then exit -1 fi @@ -10,4 +10,4 @@ DEPLOYMENT_DIR=deploy_dir mkdir $DEPLOYMENT_DIR -p cp war/target/alfresco.war ${DEPLOYMENT_DIR} -cp distribution/target/alfresco-content-services-community-distribution-$release_version.zip ${DEPLOYMENT_DIR} \ No newline at end of file +cp distribution/target/alfresco-content-services-community-distribution-$RELEASE_VERSION.zip ${DEPLOYMENT_DIR} \ No newline at end of file diff --git a/scripts/travis/verifyReleaseTag.sh b/scripts/travis/verifyReleaseTag.sh index 8cc06c5a0..aafc1eb9e 100755 --- a/scripts/travis/verifyReleaseTag.sh +++ b/scripts/travis/verifyReleaseTag.sh @@ -3,16 +3,16 @@ set -e # get the image name from the pom file alfresco_docker_image=$(mvn help:evaluate -f ./docker-alfresco/pom.xml -Dexpression=image.name -q -DforceStdout) -if [ -v ${release_version} ]||[ -z ${release_version} ]; then +if [ -v ${RELEASE_VERSION} ]||[ -z ${RELEASE_VERSION} ]; then # if we don't have a user added release version, get the verison from the pom pom_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) if echo $pom_version | grep -q ".*-SNAPSHOT"; then - release_version=${pom_version%-*} # remove everything after the last '-' + RELEASE_VERSION=${pom_version%-*} # remove everything after the last '-' else - release_version=$pom_version + RELEASE_VERSION=$pom_version fi fi -docker_image_full_name="$alfresco_docker_image:$release_version" +docker_image_full_name="$alfresco_docker_image:$RELEASE_VERSION" function docker_image_exists() { local image_full_name="$1"; shift @@ -29,8 +29,8 @@ function docker_image_exists() { } if docker_image_exists $docker_image_full_name; then - echo "Tag $release_version already pushed, release process will interrupt." + echo "Tag $RELEASE_VERSION already pushed, release process will interrupt." exit -1 else - echo "The $release_version tag was not found" + echo "The $RELEASE_VERSION tag was not found" fi \ No newline at end of file