@@ -16,7 +16,6 @@ apply plugin: 'jacoco'
16
16
17
17
def usingRemoteCluster = System . properties. containsKey(' tests.rest.cluster' ) || System . properties. containsKey(' tests.cluster' )
18
18
def usingMultiNode = project. properties. containsKey(' numNodes' )
19
- String bwcVersion = " 2.12.0.0"
20
19
21
20
ext {
22
21
projectSubstitutions = [:]
@@ -93,16 +92,37 @@ configurations.testImplementation {
93
92
}
94
93
95
94
configurations {
95
+ opensearchPlugin
96
96
zipArchive
97
97
}
98
98
99
+ // Always be minimumCompatibilityVersion of current opensearch version(3.0.0)
100
+ // get latest 2.x version from OpenSearch 2.x branch
101
+ static def fetchVersionProperties () {
102
+ def url = ' https://raw.githubusercontent.com/opensearch-project/OpenSearch/refs/heads/2.x/buildSrc/version.properties'
103
+ def content = new URL (url). text
104
+ // Use regex to extract the version number
105
+ def matcher = content =~ / opensearch\s *=\s *(\d +\.\d +\.\d +)/
106
+ if (matcher. find()) {
107
+ def version = matcher. group(1 )
108
+ println (" Extracted latest 2.x version: $version " )
109
+ return version
110
+ } else {
111
+ return " 2.19.0"
112
+ }
113
+ }
114
+ String bwcVersionShort = fetchVersionProperties()
115
+ def bwcVersion = bwcVersionShort + " .0"
116
+ def bwcOpenSearchVersion = bwcVersionShort + " -SNAPSHOT"
117
+ def bwcPluginVersion = bwcVersion + " -SNAPSHOT"
118
+
99
119
dependencies {
100
120
// Needed for integ tests
101
121
zipArchive group : ' org.opensearch.plugin' , name :' opensearch-notifications-core' , version : " ${ opensearch_build} "
102
122
zipArchive group : ' org.opensearch.plugin' , name :' notifications' , version : " ${ opensearch_build} "
103
123
104
124
// Needed for BWC tests
105
- zipArchive group : ' org.opensearch.plugin' , name : ' alerting' , version : " ${ bwcVersion } -SNAPSHOT "
125
+ opensearchPlugin " org.opensearch.plugin: alerting: ${ bwcPluginVersion } @zip "
106
126
107
127
compileOnly " org.opensearch.plugin:opensearch-scripting-painless-spi:${ versions.opensearch} "
108
128
api " org.opensearch.plugin:percolator-client:${ opensearch_version} "
@@ -261,7 +281,7 @@ String baseName = "alertingBwcCluster"
261
281
testClusters {
262
282
" ${ baseName} $i " {
263
283
testDistribution = " ARCHIVE"
264
- versions = [" 2.12.0-SNAPSHOT " , " 3.0.0-SNAPSHOT " ]
284
+ versions = [bwcOpenSearchVersion, opensearch_version ]
265
285
numberOfNodes = 3
266
286
plugin(provider(new Callable<RegularFile > (){
267
287
@Override
0 commit comments