From 2ea5ccee702235d4a0a52d8793a651f2b8c20edb Mon Sep 17 00:00:00 2001 From: pgodithi Date: Sun, 10 Jul 2022 18:09:13 -0400 Subject: [PATCH 1/8] Version increment automation Signed-off-by: pgodithi --- build.gradle | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6dbe7952ca..f1ce7027e7 100644 --- a/build.gradle +++ b/build.gradle @@ -337,7 +337,7 @@ dependencies { exclude(group:'org.springframework', module: 'spring-jcl' ) } testRuntimeOnly 'org.scala-lang:scala-library:2.13.8' - testRuntimeOnly 'com.yammer.metrics:metrics-core:2.2.0' + testRuntimeOnly 'com.yammer.metrics:metrics-core:2.1.0' testRuntimeOnly 'com.typesafe.scala-logging:scala-logging_3:3.9.5' testRuntimeOnly 'org.apache.zookeeper:zookeeper:3.7.1' testRuntimeOnly 'org.apache.kafka:kafka-metadata:3.0.1' @@ -486,3 +486,20 @@ afterEvaluate { tasks = ['build', 'buildRpm', 'buildDeb'] } } + +// versionIncrement: Task to auto increment to the next development iteration +task versionIncrement { + onlyIf { System.getProperty('newVersion') } + doLast { + ext.newVersion = System.getProperty('newVersion') + println "Setting version to ${newVersion}." + // String tokenization to support -SNAPSHOT + ant.replaceregexp(match: opensearch_version.tokenize('-')[0], replace: newVersion.tokenize('-')[0], flags:'g', byline:true) { + fileset(dir: projectDir) { + // Include the required files that needs to be updated with new Version + include(name: "build.gradle") + include(name: "bwc-test/build.gradle") + } + } + } +} \ No newline at end of file From 343110f986d57ddea9b62f7c106171393a84a89c Mon Sep 17 00:00:00 2001 From: pgodithi Date: Sun, 10 Jul 2022 18:47:33 -0400 Subject: [PATCH 2/8] Version increment automation Signed-off-by: pgodithi --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index f1ce7027e7..04c334d813 100644 --- a/build.gradle +++ b/build.gradle @@ -337,7 +337,7 @@ dependencies { exclude(group:'org.springframework', module: 'spring-jcl' ) } testRuntimeOnly 'org.scala-lang:scala-library:2.13.8' - testRuntimeOnly 'com.yammer.metrics:metrics-core:2.1.0' + testRuntimeOnly 'com.yammer.metrics:metrics-core:2.2.0' testRuntimeOnly 'com.typesafe.scala-logging:scala-logging_3:3.9.5' testRuntimeOnly 'org.apache.zookeeper:zookeeper:3.7.1' testRuntimeOnly 'org.apache.kafka:kafka-metadata:3.0.1' @@ -497,9 +497,9 @@ task versionIncrement { ant.replaceregexp(match: opensearch_version.tokenize('-')[0], replace: newVersion.tokenize('-')[0], flags:'g', byline:true) { fileset(dir: projectDir) { // Include the required files that needs to be updated with new Version - include(name: "build.gradle") include(name: "bwc-test/build.gradle") } } + ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true) } } \ No newline at end of file From 61f46c384fbe0fce8da77cefb155557139138326 Mon Sep 17 00:00:00 2001 From: pgodithi Date: Sun, 10 Jul 2022 18:50:43 -0400 Subject: [PATCH 3/8] Version increment automation Signed-off-by: pgodithi --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 04c334d813..a2f45ba8f4 100644 --- a/build.gradle +++ b/build.gradle @@ -502,4 +502,4 @@ task versionIncrement { } ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true) } -} \ No newline at end of file +} From 484635944aa056a47c6404973c4e7fcb5e22b11b Mon Sep 17 00:00:00 2001 From: pgodithi Date: Mon, 11 Jul 2022 20:47:46 -0400 Subject: [PATCH 4/8] Version increment automation: added ci tests Signed-off-by: pgodithi --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8972ac82b..a09ec1c636 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -125,6 +125,8 @@ jobs: - run: ./gradlew clean assemble -Dbuild.version_qualifier=${{ env.TEST_QUALIFIER }} && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION_ONLY_NUMBER }}-${{ env.TEST_QUALIFIER }}-SNAPSHOT.zip + - run: ./gradlew clean versionIncrement -DnewVersion=3.0.0-SNAPSHOT + - name: List files in the build directory if there was an error run: ls -al ./build/distributions/ if: failure() From fce900c9203fdf011a07baf7fbb1f3f59e9683d1 Mon Sep 17 00:00:00 2001 From: pgodithi Date: Tue, 12 Jul 2022 18:11:58 -0400 Subject: [PATCH 5/8] Version increment automation: task rename updateVersion Signed-off-by: pgodithi --- .github/workflows/ci.yml | 2 +- build.gradle | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a09ec1c636..d1a3b79a1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -125,7 +125,7 @@ jobs: - run: ./gradlew clean assemble -Dbuild.version_qualifier=${{ env.TEST_QUALIFIER }} && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION_ONLY_NUMBER }}-${{ env.TEST_QUALIFIER }}-SNAPSHOT.zip - - run: ./gradlew clean versionIncrement -DnewVersion=3.0.0-SNAPSHOT + - run: ./gradlew clean updateVersion -DnewVersion=3.0.0-SNAPSHOT - name: List files in the build directory if there was an error run: ls -al ./build/distributions/ diff --git a/build.gradle b/build.gradle index a2f45ba8f4..6b258fd450 100644 --- a/build.gradle +++ b/build.gradle @@ -487,8 +487,8 @@ afterEvaluate { } } -// versionIncrement: Task to auto increment to the next development iteration -task versionIncrement { +// updateVersion: Task to auto increment to the next development iteration +task updateVersion { onlyIf { System.getProperty('newVersion') } doLast { ext.newVersion = System.getProperty('newVersion') From 5cdfaff6cf2ee00ac87701c7c3984e6c200e9712 Mon Sep 17 00:00:00 2001 From: pgodithi Date: Mon, 25 Jul 2022 22:53:15 -0400 Subject: [PATCH 6/8] gradle updateVersion add CI tests Signed-off-by: pgodithi --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1a3b79a1d..ebc96dba55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -125,7 +125,11 @@ jobs: - run: ./gradlew clean assemble -Dbuild.version_qualifier=${{ env.TEST_QUALIFIER }} && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION_ONLY_NUMBER }}-${{ env.TEST_QUALIFIER }}-SNAPSHOT.zip - - run: ./gradlew clean updateVersion -DnewVersion=3.0.0-SNAPSHOT + - run: | + EXISTING_OS_VERSION=$(./gradlew properties | grep opensearch.version | cut -d':' -f2- | awk '{$1=$1};1' | cut -d '-' -f1 | cut -d '.' -f1) + INCREMENT_OS_VERSION=$((++EXISTING_OS_VERSION)) + ./gradlew clean updateVersion -DnewVersion=$INCREMENT_OS_VERSION.0.0-SNAPSHOT + test `./gradlew properties | grep opensearch.version | cut -d':' -f2- | awk '{$1=$1};1'` = '$INCREMENT_OS_VERSION.0.0-SNAPSHOT' - name: List files in the build directory if there was an error run: ls -al ./build/distributions/ From a4f16fbad672fe594bdadee3ad0a7cb2b4e32e8b Mon Sep 17 00:00:00 2001 From: pgodithi Date: Mon, 25 Jul 2022 22:58:18 -0400 Subject: [PATCH 7/8] gradle updateVersion add CI tests Signed-off-by: pgodithi --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebc96dba55..de8fa4bbef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,7 +129,7 @@ jobs: EXISTING_OS_VERSION=$(./gradlew properties | grep opensearch.version | cut -d':' -f2- | awk '{$1=$1};1' | cut -d '-' -f1 | cut -d '.' -f1) INCREMENT_OS_VERSION=$((++EXISTING_OS_VERSION)) ./gradlew clean updateVersion -DnewVersion=$INCREMENT_OS_VERSION.0.0-SNAPSHOT - test `./gradlew properties | grep opensearch.version | cut -d':' -f2- | awk '{$1=$1};1'` = '$INCREMENT_OS_VERSION.0.0-SNAPSHOT' + test `./gradlew properties | grep opensearch.version | cut -d':' -f2- | awk '{$1=$1};1'` = $INCREMENT_OS_VERSION.0.0-SNAPSHOT - name: List files in the build directory if there was an error run: ls -al ./build/distributions/ From 8c9a499caec3fb9cd0b917a0b5e41209003b0e75 Mon Sep 17 00:00:00 2001 From: pgodithi Date: Mon, 25 Jul 2022 23:02:24 -0400 Subject: [PATCH 8/8] gradle updateVersion add CI tests Signed-off-by: pgodithi --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de8fa4bbef..2863d027da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,7 +126,9 @@ jobs: - run: ./gradlew clean assemble -Dbuild.version_qualifier=${{ env.TEST_QUALIFIER }} && test -s ./build/distributions/opensearch-security-${{ env.SECURITY_PLUGIN_VERSION_ONLY_NUMBER }}-${{ env.TEST_QUALIFIER }}-SNAPSHOT.zip - run: | + ## EXISTING_OS_VERSION outputs the major version, example as 2 EXISTING_OS_VERSION=$(./gradlew properties | grep opensearch.version | cut -d':' -f2- | awk '{$1=$1};1' | cut -d '-' -f1 | cut -d '.' -f1) + ## INCREMENT_OS_VERSION in an increment of 1, example if EXISTING_OS_VERSION is 2, INCREMENT_OS_VERSION is 3 INCREMENT_OS_VERSION=$((++EXISTING_OS_VERSION)) ./gradlew clean updateVersion -DnewVersion=$INCREMENT_OS_VERSION.0.0-SNAPSHOT test `./gradlew properties | grep opensearch.version | cut -d':' -f2- | awk '{$1=$1};1'` = $INCREMENT_OS_VERSION.0.0-SNAPSHOT