Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increment to 2.1.1 #491

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions alerting/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ testClusters.integTest {
}

testClusters.integTest.nodes.each { node ->
node.setting("opendistro.destination.host.deny_list", "[\"10.0.0.0/8\", \"127.0.0.1\"]")
node.setting("plugins.destination.host.deny_list", "[\"10.0.0.0/8\", \"127.0.0.1\"]")
}

integTest {
Expand Down Expand Up @@ -247,17 +247,17 @@ task integTestRemote(type: RestIntegTestTask) {
}
integTestRemote.enabled = System.getProperty("tests.rest.cluster") != null

String bwcVersion = "1.13.1.0"
String bwcVersion = "1.1.0.0"
String baseName = "alertingBwcCluster"
String bwcFilePath = "src/test/resources/bwc"
String bwcOpenDistroPlugin = "opendistro-alerting-" + bwcVersion + ".zip"
String bwcRemoteFile = 'https://d3g5vo6xdbdb9a.cloudfront.net/downloads/elasticsearch-plugins/opendistro-alerting/' + bwcOpenDistroPlugin
String bwcOpenSearchPlugin = "opensearch-alerting-" + bwcVersion + ".zip"
String bwcRemoteFile = 'https://ci.opensearch.org/ci/dbc/bundle-build/1.1.0/20210930/linux/x64/builds/opensearch/plugins/' + bwcOpenSearchPlugin

2.times {i ->
testClusters {
"${baseName}$i" {
testDistribution = "ARCHIVE"
versions = ["7.10.2","2.1.0-SNAPSHOT"]
versions = ["1.1.0","2.1.1-SNAPSHOT"]
numberOfNodes = 3
plugin(provider(new Callable<RegularFile>(){
@Override
Expand All @@ -270,7 +270,7 @@ String bwcRemoteFile = 'https://d3g5vo6xdbdb9a.cloudfront.net/downloads/elastics
if (!dir.exists()) {
dir.mkdirs()
}
File f = new File(dir, bwcOpenDistroPlugin)
File f = new File(dir, bwcOpenSearchPlugin)
if (!f.exists()) {
new URL(bwcRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import org.apache.http.entity.ContentType.APPLICATION_JSON
import org.apache.http.entity.StringEntity
import org.opensearch.alerting.ALERTING_BASE_URI
import org.opensearch.alerting.AlertingRestTestCase
import org.opensearch.alerting.LEGACY_OPENDISTRO_ALERTING_BASE_URI
import org.opensearch.alerting.makeRequest
import org.opensearch.alerting.model.Monitor
import org.opensearch.common.settings.Settings
Expand Down Expand Up @@ -53,15 +52,15 @@ class AlertingBackwardsCompatibilityIT : AlertingRestTestCase() {
val pluginNames = plugins.map { plugin -> plugin["name"] }.toSet()
when (CLUSTER_TYPE) {
ClusterType.OLD -> {
assertTrue(pluginNames.contains("opendistro-alerting"))
assertTrue(pluginNames.contains("opensearch-alerting"))
createBasicMonitor()
}
ClusterType.MIXED -> {
assertTrue(pluginNames.contains("opensearch-alerting"))
verifyMonitorExists(LEGACY_OPENDISTRO_ALERTING_BASE_URI)
verifyMonitorExists(ALERTING_BASE_URI)
// TODO: Need to move the base URI being used here into a constant and rename ALERTING_BASE_URI to
// MONITOR_BASE_URI
verifyMonitorStats("/_opendistro/_alerting")
verifyMonitorStats("/_plugins/_alerting")
}
ClusterType.UPGRADED -> {
assertTrue(pluginNames.contains("opensearch-alerting"))
Expand Down Expand Up @@ -112,7 +111,7 @@ class AlertingBackwardsCompatibilityIT : AlertingRestTestCase() {
@Throws(Exception::class)
private fun createBasicMonitor() {
val indexName = "test_bwc_index"
val legacyMonitorString = """
val bwcMonitorString = """
{
"type": "monitor",
"name": "test_bwc_monitor",
Expand All @@ -123,51 +122,46 @@ class AlertingBackwardsCompatibilityIT : AlertingRestTestCase() {
"unit": "MINUTES"
}
},
"inputs": [
{
"search": {
"indices": [
"$indexName"
],
"inputs": [{
"search": {
"indices": ["$indexName"],
"query": {
"size": 0,
"aggregations": {},
"query": {
"size": 0,
"query": {
"match_all": {}
}
"match_all": {}
}
}
}
],
"triggers": [
{
"name": "abc",
"severity": "1",
"condition": {
"script": {
"source": "ctx.results[0].hits.total.value > 100000",
"lang": "painless"
}
},
"actions": []
}
]
}],
"triggers": [{
"name": "abc",
"severity": "1",
"condition": {
"script": {
"source": "ctx.results[0].hits.total.value > 100000",
"lang": "painless"
}
},
"actions": []
}]
}
""".trimIndent()
createIndex(indexName, Settings.EMPTY)

val createResponse = client().makeRequest(
method = "POST",
endpoint = "$LEGACY_OPENDISTRO_ALERTING_BASE_URI?refresh=true",
endpoint = "$ALERTING_BASE_URI?refresh=true",
params = emptyMap(),
entity = StringEntity(legacyMonitorString, APPLICATION_JSON)
entity = StringEntity(bwcMonitorString, APPLICATION_JSON)
)

assertEquals("Create monitor failed", RestStatus.CREATED, createResponse.restStatus())
val responseBody = createResponse.asMap()
val createdId = responseBody["_id"] as String
val createdVersion = responseBody["_version"] as Int
assertNotEquals("Create monitor response is missing id", Monitor.NO_ID, createdId)
assertTrue("Create monitor reponse has incorrect version", createdVersion > 0)
assertTrue("Create monitor response has incorrect version", createdVersion > 0)
}

@Throws(Exception::class)
Expand Down
21 changes: 19 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ buildscript {
apply from: 'build-tools/repositories.gradle'

ext {
opensearch_version = System.getProperty("opensearch.version", "2.1.0-SNAPSHOT")
opensearch_version = System.getProperty("opensearch.version", "2.1.1-SNAPSHOT")
buildVersionQualifier = System.getProperty("build.version_qualifier", "")
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
// 2.1.0-SNAPSHOT -> 2.1.0.0-SNAPSHOT
// 2.1.1-SNAPSHOT -> 2.1.1.0-SNAPSHOT
version_tokens = opensearch_version.tokenize('-')
opensearch_build = version_tokens[0] + '.0'
plugin_no_snapshot = opensearch_build
Expand Down Expand Up @@ -93,3 +93,20 @@ allprojects {
evaluationDependsOnChildren()

check.dependsOn subprojects*.check

// updateVersion: Task to auto increment to the next development iteration
task updateVersion {
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: "alerting/build.gradle")
}
}
ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true)
}
}