From acdcdc2a744f50c0731da2361bd31dc1a5a335f8 Mon Sep 17 00:00:00 2001 From: Soby Chacko Date: Fri, 26 Jun 2020 18:37:12 -0400 Subject: [PATCH] Release tool scripts changes --- etc/release-tools/apps-upgrade-dryrun.sh | 67 +++++++++++++++++ etc/release-tools/apps-upgrade.sh | 74 +++++++++++++++++++ etc/release-tools/core-upgrade-dryrun.sh | 4 +- etc/release-tools/core-upgrade.sh | 2 + etc/release-tools/functions-upgrade-dryrun.sh | 4 + etc/release-tools/functions-upgrade.sh | 4 +- etc/release-tools/processor-upgrade-dryrun.sh | 34 --------- etc/release-tools/processor-upgrade.sh | 43 ----------- etc/release-tools/sink-upgrade-dryrun.sh | 34 --------- etc/release-tools/sink-upgrade.sh | 43 ----------- etc/release-tools/source-upgrade-dryrun.sh | 38 ---------- etc/release-tools/source-upgrade.sh | 43 ----------- etc/release-tools/tag-update-next.sh | 5 +- 13 files changed, 157 insertions(+), 238 deletions(-) create mode 100755 etc/release-tools/apps-upgrade-dryrun.sh create mode 100755 etc/release-tools/apps-upgrade.sh delete mode 100755 etc/release-tools/processor-upgrade-dryrun.sh delete mode 100755 etc/release-tools/processor-upgrade.sh delete mode 100755 etc/release-tools/sink-upgrade-dryrun.sh delete mode 100755 etc/release-tools/sink-upgrade.sh delete mode 100755 etc/release-tools/source-upgrade-dryrun.sh delete mode 100755 etc/release-tools/source-upgrade.sh diff --git a/etc/release-tools/apps-upgrade-dryrun.sh b/etc/release-tools/apps-upgrade-dryrun.sh new file mode 100755 index 00000000..348bf9a0 --- /dev/null +++ b/etc/release-tools/apps-upgrade-dryrun.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +if [ "$#" -ne 2 ]; then + echo "Please specify the release and core parent versions" + exit +fi + +pushd ../.. + +VERSION=$1 +PARENT_VERSION=$2 + +function iterate_through_apps_folders_and_update { + + ./mvnw -Ddisable.checks=true -f $BASE_DIR versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false + ./mvnw -Ddisable.checks=true -f $BASE_DIR versions:update-parent -DparentVersion=$PARENT_VERSION -Pspring -DgenerateBackupPoms=false + + cd $BASE_DIR + + # Remove any lingering apps folders + find . -name "apps" -type d -exec rm -r "{}" \; + + for folder in *; do + [ -d "${folder}" ] || continue # if not a directory, skip + echo "FOLDER NAME - ${folder}" + pushd ${folder} + ../../../mvnw -Ddisable.checks=true versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false + ../../../mvnw -Ddisable.checks=true versions:update-parent -DparentVersion=$PARENT_VERSION -Pspring -DgenerateBackupPoms=false + popd + done + + cd ../../ + + if [[ $VERSION =~ M[0-9]|RC[0-9] ]]; then + lines=$(find $BASE_DIR -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex | wc -l) + if [ $lines -eq 0 ]; then + echo "All good" + else + echo "Snapshots found under $BASE_DIR. Exiting build" + find $BASE_DIR -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex + git checkout -f + exit 1 + fi + else + lines=$(find $BASE_DIR -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex | wc -l) + if [ $lines -eq 0 ]; then + echo "All good" + else + echo "Non Release versions found under $BASE_DIR. Exiting build" + find $BASE_DIR -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex + git checkout -f + exit 1 + fi + fi + +} + +BASE_DIR=applications/source +iterate_through_apps_folders_and_update + +BASE_DIR=applications/sink +iterate_through_apps_folders_and_update + +BASE_DIR=applications/processor +iterate_through_apps_folders_and_update + +popd diff --git a/etc/release-tools/apps-upgrade.sh b/etc/release-tools/apps-upgrade.sh new file mode 100755 index 00000000..8b9e7865 --- /dev/null +++ b/etc/release-tools/apps-upgrade.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +if [ "$#" -ne 2 ]; then + echo "Please specify the release and core parent versions" + exit +fi + +function git_commit_push { + echo "in git commit" + git commit -am"Source Applications: Release - $VERSION" + git push origin master && git push upstream master +} + +function iterate_through_apps_folders_and_update { + + ./mvnw -Ddisable.checks=true -f $BASE_DIR versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false + ./mvnw -Ddisable.checks=true -f $BASE_DIR versions:update-parent -DparentVersion=$PARENT_VERSION -Pspring -DgenerateBackupPoms=false + + cd $BASE_DIR + + # Remove any lingering apps folders + find . -name "apps" -type d -exec rm -r "{}" \; + + for folder in *; do + [ -d "${folder}" ] || continue # if not a directory, skip + echo "FOLDER NAME - ${folder}" + pushd ${folder} + ../../../mvnw -Ddisable.checks=true versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false + ../../../mvnw -Ddisable.checks=true versions:update-parent -DparentVersion=$PARENT_VERSION -Pspring -DgenerateBackupPoms=false + popd + done + + cd ../../ + + if [[ $VERSION =~ M[0-9]|RC[0-9] ]]; then + lines=$(find $BASE_DIR -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex | wc -l) + if [ $lines -eq 0 ]; then + echo "All good" + else + echo "Snapshots found under $BASE_DIR. Exiting build" + find $BASE_DIR -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex + git checkout -f + exit 1 + fi + else + lines=$(find $BASE_DIR -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex | wc -l) + if [ $lines -eq 0 ]; then + echo "All good" + else + echo "Non Release versions found under $BASE_DIR. Exiting build" + find $BASE_DIR -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex + git checkout -f + exit 1 + fi + fi +} + +pushd ../.. + +VERSION=$1 +PARENT_VERSION=$2 + +BASE_DIR=applications/source +iterate_through_apps_folders_and_update + +BASE_DIR=applications/sink +iterate_through_apps_folders_and_update + +BASE_DIR=applications/processor +iterate_through_apps_folders_and_update + +git_commit_push + +popd diff --git a/etc/release-tools/core-upgrade-dryrun.sh b/etc/release-tools/core-upgrade-dryrun.sh index 854bc451..3491134d 100755 --- a/etc/release-tools/core-upgrade-dryrun.sh +++ b/etc/release-tools/core-upgrade-dryrun.sh @@ -22,6 +22,7 @@ if [[ $VERSION =~ M[0-9]|RC[0-9] ]]; then echo "Snapshots found. Exiting build" find applications/stream-applications-core -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex git checkout -f + exit 1 fi else lines=$(find applications/stream-applications-core -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex | wc -l) @@ -31,9 +32,10 @@ else echo "Non Release versions found. Exiting build" find applications/stream-applications-core -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex git checkout -f + exit 1 fi fi -git checkout -f +#git checkout -f popd diff --git a/etc/release-tools/core-upgrade.sh b/etc/release-tools/core-upgrade.sh index 3ee96e35..9a81b68a 100755 --- a/etc/release-tools/core-upgrade.sh +++ b/etc/release-tools/core-upgrade.sh @@ -30,6 +30,7 @@ if [[ $VERSION =~ M[0-9]|RC[0-9] ]]; then echo "Snapshots found. Exiting build" find applications/stream-applications-core -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex git checkout -f + exit 1 fi else lines=$(find applications/stream-applications-core -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex | wc -l) @@ -40,6 +41,7 @@ else echo "Non Release versions found. Exiting build" find applications/stream-applications-core -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex git checkout -f + exit 1 fi fi diff --git a/etc/release-tools/functions-upgrade-dryrun.sh b/etc/release-tools/functions-upgrade-dryrun.sh index 011db6cc..ab5f1d60 100755 --- a/etc/release-tools/functions-upgrade-dryrun.sh +++ b/etc/release-tools/functions-upgrade-dryrun.sh @@ -20,6 +20,7 @@ if [[ $VERSION =~ M[0-9]|RC[0-9] ]]; then echo "Snapshots found. Exiting build" find functions -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex git checkout -f + exit 1 fi else lines=$(find functions -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex | wc -l) @@ -29,7 +30,10 @@ else echo "Non Release versions found. Exiting build" find functions -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex git checkout -f + exit 1 fi fi +#git checkout -f + popd diff --git a/etc/release-tools/functions-upgrade.sh b/etc/release-tools/functions-upgrade.sh index 765818a7..e7222c71 100755 --- a/etc/release-tools/functions-upgrade.sh +++ b/etc/release-tools/functions-upgrade.sh @@ -12,7 +12,7 @@ VERSION=$1 function git_commit_push { echo "in git commit" git commit -am"Functions: Release - $VERSION" - git push upstream master + git push origin master && git push upstream master } pushd ../.. @@ -29,6 +29,7 @@ if [[ $VERSION =~ M[0-9]|RC[0-9] ]]; then echo "Snapshots found. Exiting build" find functions -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex git checkout -f + exit 1 fi else lines=$(find functions -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex | wc -l) @@ -39,6 +40,7 @@ else echo "Non Release versions found. Exiting build" find functions -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex git checkout -f + exit 1 fi fi diff --git a/etc/release-tools/processor-upgrade-dryrun.sh b/etc/release-tools/processor-upgrade-dryrun.sh deleted file mode 100755 index 80661fe1..00000000 --- a/etc/release-tools/processor-upgrade-dryrun.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -if [ "$#" -ne 2 ]; then - echo "Please specify the release and core parent versions" - exit -fi - -pushd ../.. - -VERSION=$1 -./mvnw -f applications/processor versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false -DupdateMatchingVersions=false -./mvnw -f applications/processor versions:update-parent -DparentVersion=$2 -Pspring -DgenerateBackupPoms=false - -if [[ $VERSION =~ M[0-9]|RC[0-9] ]]; then - lines=$(find applications/processor -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex | wc -l) - if [ $lines -eq 0 ]; then - echo "All good" - else - echo "Snapshots found. Exiting build" - find applications/processor -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex - git checkout -f - fi -else - lines=$(find applications/processor -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex | wc -l) - if [ $lines -eq 0 ]; then - echo "All good" - else - echo "Non Release versions found. Exiting build" - find applications/processor -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex - git checkout -f - fi -fi - -popd diff --git a/etc/release-tools/processor-upgrade.sh b/etc/release-tools/processor-upgrade.sh deleted file mode 100755 index 29ce5534..00000000 --- a/etc/release-tools/processor-upgrade.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -if [ "$#" -ne 2 ]; then - echo "Please specify the release and core parent versions" - exit -fi - -VERSION=$1 - -function git_commit_push { - echo "in git commit" - git commit -am"Processor Applications: Release - $VERSION" - git push origin master && git push upstream master -} - -pushd ../.. - -./mvnw -f applications/processor versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false -DupdateMatchingVersions=false -./mvnw -f applications/processor versions:update-parent -DparentVersion=$2 -Pspring -DgenerateBackupPoms=false - -if [[ $VERSION =~ M[0-9]|RC[0-9] ]]; then - lines=$(find applications/processor -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex | wc -l) - if [ $lines -eq 0 ]; then - echo "All good" - git_commit_push - else - echo "Snapshots found. Exiting build" - find applications/processor -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex - git checkout -f - fi -else - lines=$(find applications/processor -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex | wc -l) - if [ $lines -eq 0 ]; then - echo "All good" - git_commit_push - else - echo "Non Release versions found. Exiting build" - find applications/processor -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex - git checkout -f - fi -fi - -popd diff --git a/etc/release-tools/sink-upgrade-dryrun.sh b/etc/release-tools/sink-upgrade-dryrun.sh deleted file mode 100755 index 7f7d5cfe..00000000 --- a/etc/release-tools/sink-upgrade-dryrun.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -if [ "$#" -ne 2 ]; then - echo "Please specify the release and core parent versions" - exit -fi - -pushd ../.. - -VERSION=$1 -./mvnw -f applications/sink versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false -DupdateMatchingVersions=false -./mvnw -f applications/sink versions:update-parent -DparentVersion=$2 -Pspring -DgenerateBackupPoms=false - -if [[ $VERSION =~ M[0-9]|RC[0-9] ]]; then - lines=$(find applications/sink -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex | wc -l) - if [ $lines -eq 0 ]; then - echo "All good" - else - echo "Snapshots found. Exiting build" - find applications/sink -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex - git checkout -f - fi -else - lines=$(find applications/sink -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex | wc -l) - if [ $lines -eq 0 ]; then - echo "All good" - else - echo "Non Release versions found. Exiting build" - find applications/sink -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex - git checkout -f - fi -fi - -popd diff --git a/etc/release-tools/sink-upgrade.sh b/etc/release-tools/sink-upgrade.sh deleted file mode 100755 index 0b97ebb2..00000000 --- a/etc/release-tools/sink-upgrade.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -if [ "$#" -ne 2 ]; then - echo "Please specify the release and core parent versions" - exit -fi - -VERSION=$1 - -function git_commit_push { - echo "in git commit" - git commit -am"Sink Applications: Release - $VERSION" - git push origin master && git push upstream master -} - -pushd ../.. - -./mvnw -f applications/sink versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false -DupdateMatchingVersions=false -./mvnw -f applications/sink versions:update-parent -DparentVersion=$2 -Pspring -DgenerateBackupPoms=false - -if [[ $VERSION =~ M[0-9]|RC[0-9] ]]; then - lines=$(find applications/sink -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex | wc -l) - if [ $lines -eq 0 ]; then - echo "All good" - git_commit_push - else - echo "Snapshots found. Exiting build" - find applications/sink -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex - git checkout -f - fi -else - lines=$(find applications/sink -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex | wc -l) - if [ $lines -eq 0 ]; then - echo "All good" - git_commit_push - else - echo "Non Release versions found. Exiting build" - find applications/sink -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex - git checkout -f - fi -fi - -popd diff --git a/etc/release-tools/source-upgrade-dryrun.sh b/etc/release-tools/source-upgrade-dryrun.sh deleted file mode 100755 index 16b6fc1c..00000000 --- a/etc/release-tools/source-upgrade-dryrun.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -if [ "$#" -ne 2 ]; then - echo "Please specify the release and core parent versions" - exit -fi - -pushd ../.. - -VERSION=$1 -./mvnw -f applications/source versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false -DupdateMatchingVersions=false -./mvnw -f applications/source versions:update-parent -DparentVersion=$2 -Pspring -DgenerateBackupPoms=false - -cd applications/source -find . -name "apps" -type d -exec rm -r "{}" \; -cd - - -if [[ $VERSION =~ M[0-9]|RC[0-9] ]]; then - lines=$(find applications/source -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex | wc -l) - if [ $lines -eq 0 ]; then - echo "All good" - else - echo "Snapshots found. Exiting build" - find applications/source -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex - git checkout -f - fi -else - lines=$(find applications/source -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex | wc -l) - if [ $lines -eq 0 ]; then - echo "All good" - else - echo "Non Release versions found. Exiting build" - find applications/source -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex - git checkout -f - fi -fi - -popd diff --git a/etc/release-tools/source-upgrade.sh b/etc/release-tools/source-upgrade.sh deleted file mode 100755 index 789a0277..00000000 --- a/etc/release-tools/source-upgrade.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -if [ "$#" -ne 2 ]; then - echo "Please specify the release and core parent versions" - exit -fi - -VERSION=$1 - -function git_commit_push { - echo "in git commit" - git commit -am"Source Applications: Release - $VERSION" - git push origin master && git push upstream master -} - -pushd ../.. - -./mvnw -f applications/source versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false -DupdateMatchingVersions=false -./mvnw -f applications/source versions:update-parent -DparentVersion=$2 -Pspring -DgenerateBackupPoms=false - -if [[ $VERSION =~ M[0-9]|RC[0-9] ]]; then - lines=$(find applications/source -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex | wc -l) - if [ $lines -eq 0 ]; then - echo "All good" - git_commit_push - else - echo "Snapshots found. Exiting build" - find applications/source -type f -name pom.xml | xargs grep SNAPSHOT | grep -v ".contains(" | grep -v regex - git checkout -f - fi -else - lines=$(find applications/source -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex | wc -l) - if [ $lines -eq 0 ]; then - echo "All good" - git_commit_push - else - echo "Non Release versions found. Exiting build" - find applications/source -type f -name pom.xml | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v ".contains(" | grep -v regex - git checkout -f - fi -fi - -popd diff --git a/etc/release-tools/tag-update-next.sh b/etc/release-tools/tag-update-next.sh index 81fb5527..32aa996e 100755 --- a/etc/release-tools/tag-update-next.sh +++ b/etc/release-tools/tag-update-next.sh @@ -83,12 +83,15 @@ cd ../.. popd -echo "in git commit" +echo "Committing and pushing the changes." + COMMIT_MSG="Next version updates + Functions: $FUNCTIONS_NEXT Core Apps: $CORE_NEXT Apps: $APPS_NEXT Aggregate Next:$AGGREGATOR_NEXT" + git commit -am"$COMMIT_MSG" git push origin master && git push upstream master