Skip to content

Commit 7c0f24f

Browse files
authored
Change Sonatype names to Maven Central (#9079)
* Change sonatype naming to maven central * Update credential names for pre-release-checks
1 parent 0054831 commit 7c0f24f

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

.gitlab-ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ pre-release-checks:
200200
allow_failure: false
201201
script:
202202
- |
203-
SONATYPE_USERNAME=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_username --with-decryption --query "Parameter.Value" --out text)
204-
SONATYPE_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_password --with-decryption --query "Parameter.Value" --out text)
203+
MAVEN_CENTRAL_USERNAME=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_username --with-decryption --query "Parameter.Value" --out text)
204+
MAVEN_CENTRAL_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_password --with-decryption --query "Parameter.Value" --out text)
205205
# See https://central.sonatype.org/publish/publish-portal-api/
206206
# 15e0cbbb-deff-421e-9e02-296a24d0cada is deployment, any deployment id listed in central work, the idea is to check whether the token can authenticate
207-
curl --request POST --include --fail https://central.sonatype.com/api/v1/publisher/status?id=15e0cbbb-deff-421e-9e02-296a24d0cada --header "Authorization: Bearer $(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64)"
207+
curl --request POST --include --fail https://central.sonatype.com/api/v1/publisher/status?id=15e0cbbb-deff-421e-9e02-296a24d0cada --header "Authorization: Bearer $(printf "$MAVEN_CENTRAL_USERNAME:$MAVEN_CENTRAL_PASSWORD" | base64)"
208208
if [ $? -ne 0 ]; then
209209
echo "Failed to authenticate against central. Check credentials, see https://datadoghq.atlassian.net/wiki/x/Oog5OgE"
210210
exit 1
@@ -768,8 +768,8 @@ deploy_to_di_backend:manual:
768768
UPSTREAM_COMMIT_AUTHOR: $CI_COMMIT_AUTHOR
769769
UPSTREAM_COMMIT_SHORT_SHA: $CI_COMMIT_SHORT_SHA
770770

771-
# If the deploy_to_sonatype job is re-run, re-trigger the deploy_artifacts_to_github job as well so that the artifacts match.
772-
deploy_to_sonatype:
771+
# If the deploy_to_maven_central job is re-run, re-trigger the deploy_artifacts_to_github job as well so that the artifacts match.
772+
deploy_to_maven_central:
773773
extends: .gradle_build
774774
stage: publish
775775
needs: [ build ]
@@ -786,8 +786,8 @@ deploy_to_sonatype:
786786
- when: manual
787787
allow_failure: true
788788
script:
789-
- export SONATYPE_USERNAME=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_username --with-decryption --query "Parameter.Value" --out text)
790-
- export SONATYPE_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_password --with-decryption --query "Parameter.Value" --out text)
789+
- export MAVEN_CENTRAL_USERNAME=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_username --with-decryption --query "Parameter.Value" --out text)
790+
- export MAVEN_CENTRAL_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.central_password --with-decryption --query "Parameter.Value" --out text)
791791
- export GPG_PRIVATE_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.signing.gpg_private_key --with-decryption --query "Parameter.Value" --out text)
792792
- export GPG_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.signing.gpg_passphrase --with-decryption --query "Parameter.Value" --out text)
793793
- ./gradlew -PbuildInfo.build.number=$CI_JOB_ID publishToSonatype closeSonatypeStagingRepository -PskipTests $GRADLE_ARGS
@@ -805,11 +805,11 @@ deploy_artifacts_to_github:
805805
when: never
806806
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
807807
when: on_success
808-
# Requires the deploy_to_sonatype job to have run first (the UP-TO-DATE gradle check across jobs is broken)
808+
# Requires the deploy_to_maven_central job to have run first (the UP-TO-DATE gradle check across jobs is broken)
809809
# This will deploy the artifacts built from the publishToSonatype task to the GitHub release
810810
needs:
811-
- job: deploy_to_sonatype
812-
# The deploy_to_sonatype job is not run for release candidate versions
811+
- job: deploy_to_maven_central
812+
# The deploy_to_maven_central job is not run for release candidate versions
813813
optional: true
814814
script:
815815
- aws ssm get-parameter --region us-east-1 --name ci.dd-trace-java.gh_release_token --with-decryption --query "Parameter.Value" --out text > github-token.txt

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ nexusPublishing {
110110
sonatype {
111111
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
112112
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
113-
username = System.getenv("SONATYPE_USERNAME")
114-
password = System.getenv("SONATYPE_PASSWORD")
113+
username = System.getenv("MAVEN_CENTRAL_USERNAME")
114+
password = System.getenv("MAVEN_CENTRAL_PASSWORD")
115115
}
116116
}
117117
}

gradle/publish.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ apply plugin: 'signing'
33

44
/**
55
* Proper publishing requires the following environment variables:
6-
* SONATYPE_USERNAME
7-
* SONATYPE_PASSWORD
6+
* MAVEN_CENTRAL_USERNAME
7+
* MAVEN_CENTRAL_PASSWORD
88
* GPG_PRIVATE_KEY
99
* GPG_PASSWORD
1010
*/
@@ -81,8 +81,8 @@ gradle.taskGraph.whenReady { TaskExecutionGraph taskGraph ->
8181
if (taskGraph.hasTask(publish) || taskGraph.hasTask("publishToSonatype")) {
8282
assert project.findProperty("removeJarVersionNumbers") != true
8383
if (taskGraph.hasTask("publishToSonatype")) {
84-
assert System.getenv("SONATYPE_USERNAME") != null
85-
assert System.getenv("SONATYPE_PASSWORD") != null
84+
assert System.getenv("MAVEN_CENTRAL_USERNAME") != null
85+
assert System.getenv("MAVEN_CENTRAL_PASSWORD") != null
8686
if (isCI) {
8787
assert System.getenv("GPG_PRIVATE_KEY") != null
8888
assert System.getenv("GPG_PASSWORD") != null

gradle/repositories.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repositories {
1010
}
1111
}
1212
mavenCentral()
13-
// add sonatype repository for snapshot dependencies
13+
// add maven central repository for snapshot dependencies
1414
maven {
1515
content {
1616
includeGroup "com.datadoghq"

0 commit comments

Comments
 (0)