Skip to content

Commit be8b6eb

Browse files
committed
maven repo migration
Signed-off-by: Kai Huang <ahkcs@amazon.com>
1 parent 42232d9 commit be8b6eb

File tree

6 files changed

+38
-20
lines changed

6 files changed

+38
-20
lines changed

.claude/settings.local.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"WebFetch(domain:github.com)"
5+
],
6+
"deny": [],
7+
"ask": [],
8+
"defaultMode": "acceptEdits"
9+
}
10+
}

.github/publish-utils.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ process_project_metadata() {
9797
METADATA_FILE="${TEMP_DIR}/maven-metadata.xml"
9898

9999
# Download the current metadata from the repository
100-
META_URL="https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/${project}/${current_version}/maven-metadata.xml"
100+
META_URL="https://central.sonatype.com/repository/maven-snapshots/org/opensearch/${project}/${current_version}/maven-metadata.xml"
101101
echo "Downloading metadata from ${META_URL}"
102102

103103
# Wait a bit to ensure the metadata file is available after publishing
@@ -226,12 +226,14 @@ publish_snapshots_and_update_metadata() {
226226
local current_version="$1"
227227
local commit_id="$2"
228228

229-
# Get credentials to upload files directly
230-
export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text)
231-
export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text)
229+
# Credentials are loaded from 1Password via environment variables
230+
if [ -z "$SONATYPE_USERNAME" ] || [ -z "$SONATYPE_PASSWORD" ]; then
231+
echo "Error: SONATYPE_USERNAME or SONATYPE_PASSWORD not set"
232+
exit 1
233+
fi
232234
echo "::add-mask::$SONATYPE_USERNAME"
233235
echo "::add-mask::$SONATYPE_PASSWORD"
234-
export SNAPSHOT_REPO_URL="https://aws.oss.sonatype.org/content/repositories/snapshots/"
236+
export SNAPSHOT_REPO_URL="https://central.sonatype.com/repository/maven-snapshots/"
235237

236238
# Make a temp directory for publish-snapshot.sh
237239
mkdir -p build/resources/publish/

.github/workflows/snapshot-publish.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ jobs:
2424
contents: write
2525

2626
steps:
27-
- uses: actions/checkout@v3
28-
id: checkout
27+
- uses: actions/checkout@v4
2928

3029
# Extract version from build.sbt file
3130
- name: Extract version from build.sbt
@@ -45,7 +44,7 @@ jobs:
4544
echo "Using commit ID: ${COMMIT_ID}"
4645
4746
- name: Set up JDK 11
48-
uses: actions/setup-java@v3
47+
uses: actions/setup-java@v4
4948
with:
5049
distribution: 'temurin'
5150
java-version: 11
@@ -64,16 +63,20 @@ jobs:
6463
echo "Checking published artifacts:"
6564
find $HOME/.m2/repository/org/opensearch/ -name "*${{ steps.extract_version.outputs.version }}*" || echo "No artifacts found with the expected version"
6665
67-
- uses: actions/checkout@v3
66+
- name: Load secret
67+
uses: 1password/load-secrets-action@v2
6868
with:
69-
repository: 'opensearch-project/opensearch-build'
70-
path: 'build'
69+
# Export loaded secrets as environment variables
70+
export-env: true
71+
env:
72+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
73+
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username
74+
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password
7175

72-
- name: Configure AWS credentials
73-
uses: aws-actions/configure-aws-credentials@v1.7.0
76+
- uses: actions/checkout@v4
7477
with:
75-
role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }}
76-
aws-region: us-east-1
78+
repository: 'opensearch-project/opensearch-build'
79+
path: 'build'
7780

7881
- name: Generate SHA and MD5 checksums
7982
run: |

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ logs/
2121
*.zip
2222

2323
gen/
24+
25+
# Claude Code
26+
./claude

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ For now, only single or conjunct conditions (conditions connected by AND) in WHE
714714
Flint use [DefaultAWSCredentialsProviderChain](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/DefaultAWSCredentialsProviderChain.html). When running in EMR Spark, Flint use executionRole credentials
715715
```
716716
--conf spark.jars.packages=org.opensearch:opensearch-spark-standalone_2.12:1.0.0-SNAPSHOT \
717-
--conf spark.jars.repositories=https://aws.oss.sonatype.org/content/repositories/snapshots \
717+
--conf spark.jars.repositories=https://central.sonatype.com/repository/maven-snapshots \
718718
--conf spark.emr-serverless.driverEnv.JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto.x86_64 \
719719
--conf spark.executorEnv.JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto.x86_64 \
720720
--conf spark.datasource.flint.host=opensearch-domain.us-west-2.es.amazonaws.com \
@@ -756,7 +756,7 @@ Flint use [DefaultAWSCredentialsProviderChain](https://docs.aws.amazon.com/AWSJa
756756
3. Set the spark.datasource.flint.customAWSCredentialsProvider property with value as com.amazonaws.emr.AssumeRoleAWSCredentialsProvider. Set the environment variable ASSUME_ROLE_CREDENTIALS_ROLE_ARN with the ARN value of CrossAccountRoleB.
757757
```
758758
--conf spark.jars.packages=org.opensearch:opensearch-spark-standalone_2.12:1.0.0-SNAPSHOT \
759-
--conf spark.jars.repositories=https://aws.oss.sonatype.org/content/repositories/snapshots \
759+
--conf spark.jars.repositories=https://central.sonatype.com/repository/maven-snapshots \
760760
--conf spark.emr-serverless.driverEnv.JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto.x86_64 \
761761
--conf spark.executorEnv.JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto.x86_64 \
762762
--conf spark.datasource.flint.host=opensearch-domain.us-west-2.es.amazonaws.com \

project/GrammarDownload.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ object GrammarDownload {
1818

1919
// Add resolver for grammar downloads
2020
val grammarResolvers: Seq[MavenRepository] = Seq(
21-
"AWS OSS Sonatype Snapshots" at "https://aws.oss.sonatype.org/content/repositories/snapshots"
21+
"Sonatype Central Snapshots" at "https://central.sonatype.com/repository/maven-snapshots"
2222
)
2323

2424
// Helper to find latest snapshot version and construct proper URL
2525
def findLatestSnapshotArtifactInfo(artifactId: String, version: String): (String, String) = {
26-
val metadataUrl = s"https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/$artifactId/$version/maven-metadata.xml"
26+
val metadataUrl = s"https://central.sonatype.com/repository/maven-snapshots/org/opensearch/$artifactId/$version/maven-metadata.xml"
2727

2828
try {
2929
val metadata = XML.load(new URL(metadataUrl))
@@ -115,7 +115,7 @@ object GrammarDownload {
115115
log.info(s"Found latest snapshot version: $snapshotVersion")
116116

117117
// Download zip file
118-
val zipUrl = s"https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/$artifactId/$version/$artifactId-$snapshotVersion.zip"
118+
val zipUrl = s"https://central.sonatype.com/repository/maven-snapshots/org/opensearch/$artifactId/$version/$artifactId-$snapshotVersion.zip"
119119
val zipFile = tempDir / s"$artifactId-$snapshotVersion.zip"
120120
log.info(s"Downloading grammar from $zipUrl")
121121
downloadFile(zipUrl, zipFile)

0 commit comments

Comments
 (0)