Skip to content

Commit 238c6f0

Browse files
opensearch-trigger-bot[bot]github-actions[bot]reta
authored
Onboarding new maven snapshots publishing to s3 (opensearch-java) (#1768) (#1774)
* Onboarding new maven snapshots publishing to s3 (opensearch-java) * Update credentials * Set a default value for MAVEN_SNAPSHOTS_S3_REPO * Update from 3.0.0-beta1 to 3.0.0 dependencies * Fix MAVEN_SNAPSHOTS_S3_REPO enviroment variable usage --------- (cherry picked from commit c064975) Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Signed-off-by: Andriy Redko <drreta@gmail.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Andriy Redko <drreta@gmail.com>
1 parent 50fc567 commit 238c6f0

5 files changed

Lines changed: 20 additions & 17 deletions

File tree

.github/workflows/publish-snapshots.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@ jobs:
2727
export-env: true
2828
env:
2929
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
30-
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username
31-
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password
30+
MAVEN_SNAPSHOTS_S3_REPO: op://opensearch-infra-secrets/maven-snapshots-s3/repo
31+
MAVEN_SNAPSHOTS_S3_ROLE: op://opensearch-infra-secrets/maven-snapshots-s3/role
32+
- name: Configure AWS credentials
33+
uses: aws-actions/configure-aws-credentials@v5
34+
with:
35+
role-to-assume: ${{ env.MAVEN_SNAPSHOTS_S3_ROLE }}
36+
aws-region: us-east-1
3237
- name: publish snapshots to maven
3338
run: |
34-
./gradlew --no-daemon publishPublishMavenPublicationToSnapshotsRepository
39+
./gradlew --no-daemon publishPublishMavenPublicationToSnapshotsRepository

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ This project has adopted the [Amazon Open Source Code of Conduct](CODE_OF_CONDUC
5353
See [User Guide](USER_GUIDE.md).
5454

5555
## Snapshot Builds
56-
The [snapshots builds](https://central.sonatype.com/repository/maven-snapshots/org/opensearch/client/opensearch-java/maven-metadata.xml) are published to sonatype using [publish-snapshots.yml](./.github/workflows/publish-snapshots.yml) workflow. Each `push` event to the main branch triggers this workflow.
56+
The [snapshots builds](https://ci.opensearch.org/ci/dbc/snapshots/maven/org/opensearch/client/opensearch-java/maven-metadata.xml) are published to sonatype using [publish-snapshots.yml](./.github/workflows/publish-snapshots.yml) workflow. Each `push` event to the main branch triggers this workflow.
5757

5858
## Compatibility with OpenSearch
5959

build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ allprojects {
3838

3939
repositories {
4040
mavenLocal()
41-
maven(url = "https://central.sonatype.com/repository/maven-snapshots/")
42-
maven(url = "https://aws.oss.sonatype.org/content/repositories/snapshots")
41+
maven(url = "https://ci.opensearch.org/ci/dbc/snapshots/maven/")
4342
mavenCentral()
4443
gradlePluginPortal()
4544
}

java-client/build.gradle.kts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ import java.io.FileWriter
3838
buildscript {
3939
repositories {
4040
mavenLocal()
41-
maven(url = "https://central.sonatype.com/repository/maven-snapshots/")
42-
maven(url = "https://aws.oss.sonatype.org/content/repositories/snapshots")
41+
maven(url = "https://ci.opensearch.org/ci/dbc/snapshots/maven/")
4342
mavenCentral()
4443
gradlePluginPortal()
4544
}
@@ -177,7 +176,7 @@ val integrationTest = task<Test>("integrationTest") {
177176
System.getProperty("tests.awsSdk2support.domainRegion", "us-east-1"))
178177
}
179178

180-
val opensearchVersion = "3.0.0-beta1-SNAPSHOT"
179+
val opensearchVersion = "3.0.0-SNAPSHOT"
181180

182181
dependencies {
183182
val jacksonVersion = "2.18.3"
@@ -318,11 +317,12 @@ tasks.withType<Jar> {
318317
publishing {
319318
repositories{
320319
if (version.toString().endsWith("SNAPSHOT")) {
321-
maven("https://central.sonatype.com/repository/maven-snapshots/") {
320+
maven(providers.environmentVariable("MAVEN_SNAPSHOTS_S3_REPO")) {
322321
name = "Snapshots"
323-
credentials {
324-
username = System.getenv("SONATYPE_USERNAME")
325-
password = System.getenv("SONATYPE_PASSWORD")
322+
credentials(AwsCredentials::class) {
323+
accessKey = System.getenv("AWS_ACCESS_KEY_ID")
324+
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
325+
sessionToken = System.getenv("AWS_SESSION_TOKEN")
326326
}
327327
}
328328
}
@@ -405,4 +405,4 @@ if (runtimeJavaVersion >= JavaVersion.VERSION_21) {
405405
testImplementation("org.bouncycastle", "bcprov-lts8on", "2.73.6")
406406
testImplementation("org.bouncycastle", "bcpkix-lts8on", "2.73.6")
407407
}
408-
}
408+
}

java-codegen/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ import java.io.FileWriter
1919
buildscript {
2020
repositories {
2121
mavenLocal()
22-
maven(url = "https://central.sonatype.com/repository/maven-snapshots/")
23-
maven(url = "https://aws.oss.sonatype.org/content/repositories/snapshots")
22+
maven(url = "https://ci.opensearch.org/ci/dbc/snapshots/maven/")
2423
mavenCentral()
2524
gradlePluginPortal()
2625
}
@@ -266,4 +265,4 @@ tasks.withType<Jar> {
266265

267266
spotlessConventions {
268267
eclipseFormatterConfigFile = rootProject.file("buildSrc/formatterConfig-generated.xml")
269-
}
268+
}

0 commit comments

Comments
 (0)