Skip to content

Commit c9e2c7f

Browse files
Onboarding new maven snapshots publishing to s3 (IM) (#1513)
Signed-off-by: Peter Zhu <[email protected]>
1 parent 3cf62f0 commit c9e2c7f

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

.github/workflows/maven-publish.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,14 @@ jobs:
2929
export-env: true
3030
env:
3131
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
32-
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username
33-
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password
32+
MAVEN_SNAPSHOTS_S3_REPO: op://opensearch-infra-secrets/maven-snapshots-s3/repo
33+
MAVEN_SNAPSHOTS_S3_ROLE: op://opensearch-infra-secrets/maven-snapshots-s3/role
34+
- name: Configure AWS credentials
35+
uses: aws-actions/configure-aws-credentials@v5
36+
with:
37+
role-to-assume: ${{ env.MAVEN_SNAPSHOTS_S3_ROLE }}
38+
aws-region: us-east-1
3439
- name: publish snapshots to maven
3540
run: |
3641
./gradlew publishPluginZipPublicationToSnapshotsRepository
37-
./gradlew publishShadowPublicationToSnapshotsRepository
42+
./gradlew publishShadowPublicationToSnapshotsRepository

build.gradle

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ buildscript {
7474
mavenLocal()
7575
mavenCentral()
7676
maven { url "https://plugins.gradle.org/m2/" }
77-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
78-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
77+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
7978
}
8079

8180
dependencies {
@@ -263,8 +262,7 @@ dependencies {
263262

264263
repositories {
265264
mavenLocal()
266-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
267-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
265+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
268266
}
269267

270268
publishing {
@@ -292,10 +290,11 @@ publishing {
292290
repositories {
293291
maven {
294292
name = "Snapshots"
295-
url = "https://central.sonatype.com/repository/maven-snapshots/"
296-
credentials {
297-
username System.getenv("SONATYPE_USERNAME")
298-
password System.getenv("SONATYPE_PASSWORD")
293+
url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO")
294+
credentials(AwsCredentials) {
295+
accessKey = System.getenv("AWS_ACCESS_KEY_ID")
296+
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
297+
sessionToken = System.getenv("AWS_SESSION_TOKEN")
299298
}
300299
}
301300
}

spi/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ repositories {
4949
mavenLocal()
5050
mavenCentral()
5151
maven { url "https://plugins.gradle.org/m2/" }
52-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
53-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
52+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
5453
}
5554

5655
configurations.configureEach {
@@ -118,10 +117,11 @@ publishing {
118117
}
119118
maven {
120119
name = "Snapshots"
121-
url = "https://central.sonatype.com/repository/maven-snapshots/"
122-
credentials {
123-
username System.getenv("SONATYPE_USERNAME")
124-
password System.getenv("SONATYPE_PASSWORD")
120+
url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO")
121+
credentials(AwsCredentials) {
122+
accessKey = System.getenv("AWS_ACCESS_KEY_ID")
123+
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
124+
sessionToken = System.getenv("AWS_SESSION_TOKEN")
125125
}
126126
}
127127
}

0 commit comments

Comments
 (0)