Skip to content

Commit 1f9712b

Browse files
[Backport 2.19] Onboarding new maven snapshots publishing to s3 (IM) (#1514)
1 parent 8d09c28 commit 1f9712b

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

.github/workflows/maven-publish.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@ 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

build.gradle

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ buildscript {
7272
mavenLocal()
7373
mavenCentral()
7474
maven { url "https://plugins.gradle.org/m2/" }
75-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
76-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
75+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
7776
}
7877

7978
dependencies {
@@ -237,8 +236,7 @@ dependencies {
237236

238237
repositories {
239238
mavenLocal()
240-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
241-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
239+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
242240
}
243241

244242
publishing {
@@ -266,10 +264,11 @@ publishing {
266264
repositories {
267265
maven {
268266
name = "Snapshots"
269-
url = "https://central.sonatype.com/repository/maven-snapshots/"
270-
credentials {
271-
username "$System.env.SONATYPE_USERNAME"
272-
password "$System.env.SONATYPE_PASSWORD"
267+
url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO")
268+
credentials(AwsCredentials) {
269+
accessKey = System.getenv("AWS_ACCESS_KEY_ID")
270+
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
271+
sessionToken = System.getenv("AWS_SESSION_TOKEN")
273272
}
274273
}
275274
}
@@ -951,4 +950,4 @@ task updateVersion {
951950
// String tokenization to support -SNAPSHOT
952951
ant.replaceregexp(file: 'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags: 'g', byline: true)
953952
}
954-
}
953+
}

spi/build.gradle

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

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

0 commit comments

Comments
 (0)