From a6df6823544415bd34d55d50da620100fb94122f Mon Sep 17 00:00:00 2001 From: Ankit Kala Date: Fri, 3 Feb 2023 16:46:17 +0530 Subject: [PATCH 1/2] Build Fix: Update Strings.toString to pass the JSON XContentType (#699) Signed-off-by: Ankit Kala (cherry picked from commit a8a31d2d9c7089465ad3f06b9491d5e53eb7185f) --- .../replication/task/index/IndexReplicationParams.kt | 3 ++- .../replication/task/shard/ShardReplicationParams.kt | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationParams.kt b/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationParams.kt index 0452bc24..0c4f4a53 100644 --- a/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationParams.kt +++ b/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationParams.kt @@ -20,6 +20,7 @@ import org.opensearch.common.xcontent.ObjectParser import org.opensearch.common.xcontent.ToXContent import org.opensearch.common.xcontent.XContentBuilder import org.opensearch.common.xcontent.XContentParser +import org.opensearch.common.xcontent.XContentType import org.opensearch.index.Index import org.opensearch.persistent.PersistentTaskParams import java.io.IOException @@ -80,6 +81,6 @@ class IndexReplicationParams : PersistentTaskParams { } override fun toString(): String { - return Strings.toString(this) + return Strings.toString(XContentType.JSON, this) } } diff --git a/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationParams.kt b/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationParams.kt index 12432eae..eb5c23b1 100644 --- a/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationParams.kt +++ b/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationParams.kt @@ -20,6 +20,7 @@ import org.opensearch.common.xcontent.ObjectParser import org.opensearch.common.xcontent.ToXContent import org.opensearch.common.xcontent.XContentBuilder import org.opensearch.common.xcontent.XContentParser +import org.opensearch.common.xcontent.XContentType import org.opensearch.index.shard.ShardId import org.opensearch.persistent.PersistentTaskParams import java.io.IOException @@ -84,7 +85,7 @@ class ShardReplicationParams : PersistentTaskParams { } override fun toString(): String { - return Strings.toString(this) + return Strings.toString(XContentType.JSON, this) } class Builder { @@ -122,4 +123,4 @@ class ShardReplicationParams : PersistentTaskParams { followerShardIdObj.id)) } } -} \ No newline at end of file +} From 150a5e785b830ecf298c0d37fdb3a7d455df9524 Mon Sep 17 00:00:00 2001 From: Ankit Kala Date: Tue, 21 Feb 2023 10:27:31 +0530 Subject: [PATCH 2/2] Add github action to publish snapshots to maven Signed-off-by: Ankit Kala --- .github/workflows/maven-publish.yml | 34 +++++++++++++++++++++++++++++ build.gradle | 10 +++++++++ 2 files changed, 44 insertions(+) create mode 100644 .github/workflows/maven-publish.yml diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 00000000..ba482727 --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,34 @@ +name: Publish snapshots to maven + +on: + workflow_dispatch: + push: + branches: [ + main + 1.* + 2.* + ] + +jobs: + build-and-publish-snapshots: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: write + steps: + - uses: actions/setup-java@v3 + with: + distribution: temurin # Temurin is a distribution of adoptium + java-version: 17 + - uses: actions/checkout@v3 + - uses: aws-actions/configure-aws-credentials@v1 + with: + role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }} + aws-region: us-east-1 + - name: publish snapshots to maven + run: | + export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text) + export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text) + echo "::add-mask::$SONATYPE_USERNAME" + echo "::add-mask::$SONATYPE_PASSWORD" + ./gradlew publishPluginZipPublicationToSnapshotsRepository \ No newline at end of file diff --git a/build.gradle b/build.gradle index 1ec6f1a9..b0695df3 100644 --- a/build.gradle +++ b/build.gradle @@ -914,6 +914,16 @@ publishing { } } } + repositories { + maven { + name = "Snapshots" + url = "https://aws.oss.sonatype.org/content/repositories/snapshots" + credentials { + username "$System.env.SONATYPE_USERNAME" + password "$System.env.SONATYPE_PASSWORD" + } + } + } } // updateVersion: Task to auto increment to the next development iteration