diff --git a/alerting/build.gradle b/alerting/build.gradle index f367b659..2a4accdd 100644 --- a/alerting/build.gradle +++ b/alerting/build.gradle @@ -83,6 +83,8 @@ dependencies { javadoc.enabled = false // turn off javadoc as it barfs on Kotlin code licenseHeaders.enabled = true dependencyLicenses.enabled = false +// no need to validate pom, as this project is not uploaded to sonatype +validateNebulaPom.enabled = false thirdPartyAudit.enabled = false def es_tmp_dir = rootProject.file('build/private/es_tmp').absoluteFile diff --git a/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/AlertingPlugin.kt b/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/AlertingPlugin.kt index c5e122a3..7c2ba91e 100644 --- a/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/AlertingPlugin.kt +++ b/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/AlertingPlugin.kt @@ -57,6 +57,7 @@ import org.elasticsearch.painless.spi.WhitelistLoader import org.elasticsearch.plugins.ActionPlugin import org.elasticsearch.plugins.Plugin import org.elasticsearch.plugins.ScriptPlugin +import org.elasticsearch.repositories.RepositoriesService import org.elasticsearch.rest.RestController import org.elasticsearch.rest.RestHandler import org.elasticsearch.script.ScriptContext @@ -131,7 +132,8 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, P environment: Environment, nodeEnvironment: NodeEnvironment, namedWriteableRegistry: NamedWriteableRegistry, - indexNameExpressionResolver: IndexNameExpressionResolver + indexNameExpressionResolver: IndexNameExpressionResolver, + repositoriesServiceSupplier: Supplier ): Collection { // Need to figure out how to use the Elasticsearch DI classes rather than handwiring things here. val settings = environment.settings() diff --git a/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/alerts/AlertIndices.kt b/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/alerts/AlertIndices.kt index 064c3cd2..799f2f65 100644 --- a/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/alerts/AlertIndices.kt +++ b/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/alerts/AlertIndices.kt @@ -158,7 +158,7 @@ class AlertIndices( override fun clusterChanged(event: ClusterChangedEvent) { // if the indexes have been deleted they need to be reinitalized alertIndexInitialized = event.state().routingTable().hasIndex(ALERT_INDEX) - historyIndexInitialized = event.state().metaData().hasAlias(HISTORY_WRITE_INDEX) + historyIndexInitialized = event.state().metadata().hasAlias(HISTORY_WRITE_INDEX) } private fun rescheduleRollover() { @@ -265,7 +265,7 @@ class AlertIndices( .settings(Settings.builder().put("index.hidden", true).build()) request.addMaxIndexDocsCondition(historyMaxDocs) request.addMaxIndexAgeCondition(historyMaxAge) - val response = client.admin().indices().rolloversIndex(request).actionGet(requestTimeout) + val response = client.admin().indices().rolloverIndex(request).actionGet(requestTimeout) if (!response.isRolledOver) { logger.info("$HISTORY_WRITE_INDEX not rolled over. Conditions were: ${response.conditionStatus}") } else { @@ -280,13 +280,13 @@ class AlertIndices( val clusterStateRequest = ClusterStateRequest() .clear() .indices(HISTORY_ALL) - .metaData(true) + .metadata(true) .local(true) .indicesOptions(IndicesOptions.strictExpand()) val clusterStateResponse = client.admin().cluster().state(clusterStateRequest).actionGet() - for (entry in clusterStateResponse.state.metaData.indices) { + for (entry in clusterStateResponse.state.metadata.indices) { val indexMetaData = entry.value val creationTime = indexMetaData.creationDate diff --git a/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/util/IndexUtils.kt b/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/util/IndexUtils.kt index 10511653..7a608224 100644 --- a/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/util/IndexUtils.kt +++ b/alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/util/IndexUtils.kt @@ -22,7 +22,7 @@ import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest import org.elasticsearch.action.support.master.AcknowledgedResponse import org.elasticsearch.client.IndicesAdminClient import org.elasticsearch.cluster.ClusterState -import org.elasticsearch.cluster.metadata.IndexMetaData +import org.elasticsearch.cluster.metadata.IndexMetadata import org.elasticsearch.common.xcontent.LoggingDeprecationHandler import org.elasticsearch.common.xcontent.NamedXContentRegistry import org.elasticsearch.common.xcontent.XContentParser @@ -92,11 +92,11 @@ class IndexUtils { @JvmStatic fun getIndexNameWithAlias(clusterState: ClusterState, alias: String): String { - return clusterState.metaData.indices.first { it.value.aliases.containsKey(alias) }.key + return clusterState.metadata.indices.first { it.value.aliases.containsKey(alias) }.key } @JvmStatic - fun shouldUpdateIndex(index: IndexMetaData, mapping: String): Boolean { + fun shouldUpdateIndex(index: IndexMetadata, mapping: String): Boolean { var oldVersion = NO_SCHEMA_VERSION val newVersion = getSchemaVersion(mapping) @@ -119,8 +119,8 @@ class IndexUtils { client: IndicesAdminClient, actionListener: ActionListener ) { - if (clusterState.metaData.indices.containsKey(index)) { - if (shouldUpdateIndex(clusterState.metaData.indices[index], mapping)) { + if (clusterState.metadata.indices.containsKey(index)) { + if (shouldUpdateIndex(clusterState.metadata.indices[index], mapping)) { val putMappingRequest: PutMappingRequest = PutMappingRequest(index).type(type).source(mapping, XContentType.JSON) client.putMapping(putMappingRequest, actionListener) } else { diff --git a/alerting/src/test/kotlin/com/amazon/opendistroforelasticsearch/alerting/util/IndexUtilsTests.kt b/alerting/src/test/kotlin/com/amazon/opendistroforelasticsearch/alerting/util/IndexUtilsTests.kt index 0040e3f8..1463bea1 100644 --- a/alerting/src/test/kotlin/com/amazon/opendistroforelasticsearch/alerting/util/IndexUtilsTests.kt +++ b/alerting/src/test/kotlin/com/amazon/opendistroforelasticsearch/alerting/util/IndexUtilsTests.kt @@ -16,7 +16,7 @@ package com.amazon.opendistroforelasticsearch.alerting.util import com.amazon.opendistroforelasticsearch.alerting.parser -import org.elasticsearch.cluster.metadata.IndexMetaData +import org.elasticsearch.cluster.metadata.IndexMetadata import org.elasticsearch.test.ESTestCase import java.lang.NumberFormatException import kotlin.test.assertFailsWith @@ -66,7 +66,7 @@ class IndexUtilsTests : ESTestCase() { "\"version\":{\"created\":\"6040399\"},\"provided_name\":\"data_test\"}},\"mapping_version\":123," + "\"settings_version\":123,\"mappings\":{\"_doc\":{\"properties\":{\"name\":{\"type\":\"keyword\"}}}}}}" val newMapping = "{\"_meta\":{\"schema_version\":10},\"properties\":{\"name\":{\"type\":\"keyword\"}}}" - val index: IndexMetaData = IndexMetaData.fromXContent(parser(indexContent)) + val index: IndexMetadata = IndexMetadata.fromXContent(parser(indexContent)) val shouldUpdateIndex = IndexUtils.shouldUpdateIndex(index, newMapping) assertTrue(shouldUpdateIndex) @@ -79,7 +79,7 @@ class IndexUtilsTests : ESTestCase() { "\"settings_version\":123,\"mappings\":{\"_doc\":{\"_meta\":{\"schema_version\":1},\"properties\":" + "{\"name\":{\"type\":\"keyword\"}}}}}}" val newMapping = "{\"_meta\":{\"schema_version\":10},\"properties\":{\"name\":{\"type\":\"keyword\"}}}" - val index: IndexMetaData = IndexMetaData.fromXContent(parser(indexContent)) + val index: IndexMetadata = IndexMetadata.fromXContent(parser(indexContent)) val shouldUpdateIndex = IndexUtils.shouldUpdateIndex(index, newMapping) assertTrue(shouldUpdateIndex) @@ -91,7 +91,7 @@ class IndexUtilsTests : ESTestCase() { "\"version\":{\"created\":\"6040399\"},\"provided_name\":\"data_test\"}},\"mappings\":" + "{\"_doc\":{\"_meta\":{\"schema_version\":1},\"properties\":{\"name\":{\"type\":\"keyword\"}}}}}}" val newMapping = "{\"_meta\":{\"schema_version\":1},\"properties\":{\"name\":{\"type\":\"keyword\"}}}" - val index: IndexMetaData = IndexMetaData.fromXContent(parser(indexContent)) + val index: IndexMetadata = IndexMetadata.fromXContent(parser(indexContent)) val shouldUpdateIndex = IndexUtils.shouldUpdateIndex(index, newMapping) assertFalse(shouldUpdateIndex) diff --git a/build-tools/esplugin-coverage.gradle b/build-tools/esplugin-coverage.gradle index 7415f02d..8bfae297 100644 --- a/build-tools/esplugin-coverage.gradle +++ b/build-tools/esplugin-coverage.gradle @@ -56,7 +56,8 @@ integTest.runner { } testClusters.integTest { - jvmArgs " ${dummyIntegTest.jacoco.getAsJvmArg()}" + //Hack: to fix jacocoagent path with gradle 6.5, add the missing "/" at the start of the jacocoagent path. + jvmArgs " ${dummyIntegTest.jacoco.getAsJvmArg()}".replace('javaagent:','javaagent:/') systemProperty 'com.sun.management.jmxremote', "true" systemProperty 'com.sun.management.jmxremote.authenticate', "false" systemProperty 'com.sun.management.jmxremote.port', "7777" diff --git a/build.gradle b/build.gradle index 69c2aaf4..4df1bb68 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply from: 'build-tools/repositories.gradle' ext { - es_version = '7.7.0' + es_version = '7.8.0' kotlin_version = '1.3.21' } @@ -42,7 +42,7 @@ apply plugin: 'jacoco' apply from: 'build-tools/merged-coverage.gradle' ext { - opendistroVersion = '1.8.0' + opendistroVersion = '1.9.0' isSnapshot = "true" == System.getProperty("build.snapshot", "true") } diff --git a/core/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/core/ScheduledJobIndices.kt b/core/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/core/ScheduledJobIndices.kt index 79436f29..53bd151d 100644 --- a/core/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/core/ScheduledJobIndices.kt +++ b/core/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/core/ScheduledJobIndices.kt @@ -67,7 +67,7 @@ class ScheduledJobIndices(private val client: AdminClient, private val clusterSe if (scheduledJobIndexExists()) { val indexRoutingTable = clusterService.state().routingTable.index(ScheduledJob.SCHEDULED_JOBS_INDEX) - val indexMetaData = clusterService.state().metaData().index(ScheduledJob.SCHEDULED_JOBS_INDEX) + val indexMetaData = clusterService.state().metadata().index(ScheduledJob.SCHEDULED_JOBS_INDEX) indexHealth = ClusterIndexHealth(indexMetaData, indexRoutingTable) } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4c5803d1..622ab64a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/notification/build.gradle b/notification/build.gradle index 80fd8c9d..e37dc530 100644 --- a/notification/build.gradle +++ b/notification/build.gradle @@ -85,7 +85,7 @@ publishing { repositories { maven { name = "sonatype-staging" - url "https://oss.sonatype.org/service/local/staging/deploy/maven2" + url "https://aws.oss.sonatype.org/service/local/staging/deploy/maven2" credentials { username project.hasProperty('ossrhUsername') ? project.property('ossrhUsername') : '' password project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : '' diff --git a/release-notes/opendistro-for-elasticsearch.alerting.release-notes-1.9.0.0.md b/release-notes/opendistro-for-elasticsearch.alerting.release-notes-1.9.0.0.md new file mode 100644 index 00000000..631cd3ae --- /dev/null +++ b/release-notes/opendistro-for-elasticsearch.alerting.release-notes-1.9.0.0.md @@ -0,0 +1,4 @@ +## 2020-06-24, Version 1.9.0.0 + +### New Features + * Adds support for Elasticsearch 7.8.0 - [PR #219](https://github.com/opendistro-for-elasticsearch/alerting/pull/219)