diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index efc8288b..9b9ccc09 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -41,13 +41,16 @@ jobs: ./gradlew build -Dperformance-analyzer-rca.build=true \ -Dperformance-analyzer-rca.repo="https://github.com/opensearch-project/performance-analyzer-rca.git" \ -Dperformance-analyzer-rca.branch=main \ - -Dopensearch.version=1.3.0-SNAPSHOT - name: Assemble PA jar for BWC tests working-directory: ./tmp/performance-analyzer run: | - ./gradlew assemble -Dopensearch.version=1.3.0-SNAPSHOT - mkdir -p ./src/test/resources/org/opensearch/performanceanalyzer/bwc/1.3.0.0-SNAPSHOT - cp ./build/distributions/*.zip ./src/test/resources/org/opensearch/performanceanalyzer/bwc/1.3.0.0-SNAPSHOT + ./gradlew assemble + version=`./gradlew properties -q | grep "opensearch_version:" | awk '{print $2}'` + IFS='-' read -r -a version_array <<< "$version" + plugin_version="${version_array[0]}.0"; for entry in ${version_array[@]:1}; do plugin_version+="-$entry"; done + echo $plugin_version + mkdir -p ./src/test/resources/org/opensearch/performanceanalyzer/bwc/$plugin_version + cp ./build/distributions/*.zip ./src/test/resources/org/opensearch/performanceanalyzer/bwc/$plugin_version - name: Generate Jacoco coverage report working-directory: ./tmp/performance-analyzer run: ./gradlew jacocoTestReport @@ -58,7 +61,7 @@ jobs: run: bash <(curl -s https://codecov.io/bash) -f ./build/reports/jacoco/test/jacocoTestReport.xml - name: Run Integration Tests working-directory: ./tmp/performance-analyzer - run: ./gradlew integTest -Dtests.enableIT -Dtests.useDockerCluster -Dopensearch.version=1.3.0-SNAPSHOT + run: ./gradlew integTest -Dtests.enableIT -Dtests.useDockerCluster - name: Run PerformanceAnalzyer Backwards Compatibility Tests working-directory: ./tmp/performance-analyzer run: ./gradlew bwcTestSuite -Dtests.security.manager=false diff --git a/build.gradle b/build.gradle index 86dd785e..b9ab99e8 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,19 @@ buildscript { ext { - opensearch_version = System.getProperty("opensearch.version", "1.3.0-SNAPSHOT") + opensearch_version = System.getProperty("opensearch.version", "2.0.0-alpha1-SNAPSHOT") + isSnapshot = "true" == System.getProperty("build.snapshot", "true") + buildVersionQualifier = System.getProperty("build.version_qualifier", "alpha1") + + // 2.0.0-alpha1-SNAPSHOT -> 2.0.0.0-alpha1-SNAPSHOT + version_tokens = opensearch_version.tokenize('-') + opensearch_build = version_tokens[0] + '.0' + if (buildVersionQualifier) { + opensearch_build += "-${buildVersionQualifier}" + } + if (isSnapshot) { + opensearch_build += "-SNAPSHOT" + } } // Used to resolve build file dependencies @@ -48,7 +60,6 @@ spotbugsTest { } ext { - isSnapshot = "true" == System.getProperty("build.snapshot", "true") // The RCA branch that will be built. Default branch is main. rcaProjectRepo = System.getProperty("performance-analyzer-rca.repo", "https://github.com/opensearch-project/performance-analyzer-rca.git") @@ -63,10 +74,7 @@ ext { allprojects { group = "org.opensearch" - version = opensearch_version - '-SNAPSHOT' + '.0' - if (isSnapshot) { - version += "-SNAPSHOT" - } + version = opensearch_build } apply plugin: 'opensearch.opensearchplugin' @@ -363,11 +371,21 @@ task buildRca() { doLast { exec { workingDir("$rcaProjectDir") - commandLine './gradlew', 'build', '-x', 'test', "-Dopensearch.version=${opensearch_version}", "-Dbuild.snapshot=${isSnapshot}" + if (buildVersionQualifier == null || buildVersionQualifier == '' || buildVersionQualifier == 'null') { + commandLine './gradlew', 'build', '-x', 'test', "-Dopensearch.version=${opensearch_version}", "-Dbuild.snapshot=${isSnapshot}" + } + else { + commandLine './gradlew', 'build', '-x', 'test', "-Dopensearch.version=${opensearch_version}", "-Dbuild.snapshot=${isSnapshot}", "-Dbuild.version_qualifier=${buildVersionQualifier}" + } } exec { workingDir("$rcaProjectDir") - commandLine './gradlew', 'publishToMavenLocal', "-Dopensearch.version=${opensearch_version}", "-Dbuild.snapshot=${isSnapshot}" + if (buildVersionQualifier == null || buildVersionQualifier == '' || buildVersionQualifier == 'null') { + commandLine './gradlew', 'publishToMavenLocal', "-Dopensearch.version=${opensearch_version}", "-Dbuild.snapshot=${isSnapshot}" + } + else { + commandLine './gradlew', 'publishToMavenLocal', "-Dopensearch.version=${opensearch_version}", "-Dbuild.snapshot=${isSnapshot}", "-Dbuild.version_qualifier=${buildVersionQualifier}" + } } exec { def licenseDir = "$projectDir/licenses" @@ -515,7 +533,7 @@ String bwcFilePath = "src/test/resources/org/opensearch/performanceanalyzer/bwc/ testClusters { "${baseName}$i" { testDistribution = "ARCHIVE" - versions = ["7.10.2","1.3.0-SNAPSHOT"] + versions = ["7.10.2", opensearch_version] numberOfNodes = 3 plugin(provider(new Callable(){ @Override @@ -655,7 +673,7 @@ afterEvaluate { ospackage { packageName = "opensearch-performance-analyzer" release = isSnapshot ? "0.1" : '1' - version = "${project.version}" - "-SNAPSHOT" + version = "${project.version}" into '/usr/share/opensearch/plugins' from(zipTree(bundlePlugin.archivePath)) {