Skip to content

Commit 5cbd2e5

Browse files
authored
Update release-to-maven buildspec. (#2716)
This moves the storage used by the push-to-maven from S3 to secrets manager.
1 parent a459cfe commit 5cbd2e5

File tree

2 files changed

+56
-21
lines changed

2 files changed

+56
-21
lines changed

buildspecs/release-to-maven.yml

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,44 @@ version: 0.2
33
phases:
44
install:
55
commands:
6-
- apt-get update
7-
- apt-get install python3 python3-pip -y
8-
- update-alternatives --install /usr/bin/python python /usr/bin/python3 10
9-
- update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10
10-
- pip install awscli==1.19.34 --upgrade --user
11-
- pip install rsa
12-
- pip install typing
6+
- apt-get update
7+
- apt-get install python3 python3-pip -y
8+
- update-alternatives --install /usr/bin/python python /usr/bin/python3 10
9+
- update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10
10+
- pip install awscli==1.19.34 --upgrade --user
11+
- pip install rsa
12+
- pip install typing
1313

1414
pre_build:
1515
commands:
16-
- ROOT=`pwd`
17-
- CREDENTIALS=$ROOT/credentials
18-
- SETTINGS_XML=$CREDENTIALS/settings.xml
19-
- GPG_HOME=$CREDENTIALS/gpghome
16+
- ROOT=`pwd`
17+
- SETTINGS_XML_TEMPLATE=buildspecs/resources/release-settings.xml
18+
- SETTINGS_XML=release-settings-final.xml
19+
- SDK_SIGNING_GPG_SECRING=secring.gpg
20+
- SDK_SIGNING_GPG_SECRING_ARN="arn:aws:secretsmanager:us-east-1:103431983078:secret:sdk-signing-gpg-secret-ring-9d0YXc"
21+
- SDK_SIGNING_GPG_KEYNAME_ARN="arn:aws:secretsmanager:us-east-1:103431983078:secret:sdk-signing-gpg-keyname-wFsOOg"
22+
- SDK_SIGNING_GPG_PASSPHRASE_ARN="arn:aws:secretsmanager:us-east-1:103431983078:secret:sdk-signing-gpg-passphrase-A0H1Kq"
23+
- SONATYPE_PASSWORD_ARN="arn:aws:secretsmanager:us-east-1:103431983078:secret:sonatype-password-I2V6Y0"
2024

2125
build:
2226
commands:
23-
- RELEASE_VERSION=`mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec`
24-
- SONATYPE_URL="https://aws.oss.sonatype.org/service/local/repositories/releases/content/software/amazon/awssdk/aws-sdk-java/$RELEASE_VERSION/"
25-
- |
26-
if ! curl -f --head $SONATYPE_URL; then
27-
mkdir -p $CREDENTIALS
28-
aws s3 cp s3://aws-java-sdk-release-credentials/ $CREDENTIALS/ --recursive
29-
mvn clean deploy -B -s $SETTINGS_XML -Dgpg.homedir=$GPG_HOME -Ppublishing -DperformRelease -Dspotbugs.skip -DskipTests -Dcheckstyle.skip -Djapicmp.skip -Ddoclint=none -pl !:protocol-tests,!:protocol-tests-core,!:codegen-generated-classes-test,!:sdk-benchmarks,!:module-path-tests,!:tests-coverage-reporting,!:stability-tests,!:sdk-native-image-test,!:auth-sts-testing,!:s3-benchmarks -DautoReleaseAfterClose=true -DstagingProgressTimeoutMinutes=30
30-
else
31-
echo "This version was already released."
32-
fi
27+
- RELEASE_VERSION=`mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec`
28+
- SONATYPE_URL="https://aws.oss.sonatype.org/service/local/repositories/releases/content/software/amazon/awssdk/aws-sdk-java/$RELEASE_VERSION/"
29+
- |
30+
if ! curl -f --head $SONATYPE_URL; then
31+
SONATYPE_PASSWORD=`aws secretsmanager get-secret-value --secret-id $SONATYPE_PASSWORD_ARN --query SecretString --output text`
32+
SDK_SIGNING_GPG_KEYNAME=`aws secretsmanager get-secret-value --secret-id $SDK_SIGNING_GPG_KEYNAME_ARN --query SecretString --output text`
33+
SDK_SIGNING_GPG_PASSPHRASE=`aws secretsmanager get-secret-value --secret-id $SDK_SIGNING_GPG_PASSPHRASE_ARN --query SecretString --output text`
34+
aws secretsmanager get-secret-value --secret-id $SDK_SIGNING_GPG_SECRING_ARN --query SecretBinary --output text | base64 -d > $SDK_SIGNING_GPG_SECRING
35+
gpg --passphrase $SDK_SIGNING_GPG_PASSPHRASE --import $SDK_SIGNING_GPG_SECRING
36+
37+
cat $SETTINGS_XML_TEMPLATE | \
38+
awk 'BEGIN { var=ENVIRON["SONATYPE_PASSWORD"] } { gsub("\\$SONATYPE_PASSWORD", var, $0); print }' | \
39+
awk 'BEGIN { var=ENVIRON["SDK_SIGNING_GPG_PASSPHRASE"] } { gsub("\\$SDK_SIGNING_GPG_PASSPHRASE", var, $0); print }' > \
40+
awk 'BEGIN { var=ENVIRON["SDK_SIGNING_GPG_KEYNAME"] } { gsub("\\$SDK_SIGNING_GPG_KEYNAME", var, $0); print }' > \
41+
$SETTINGS_XML
42+
43+
mvn clean deploy -B -s $SETTINGS_XML -Ppublishing -DperformRelease -Dspotbugs.skip -DskipTests -Dcheckstyle.skip -Djapicmp.skip -Ddoclint=none -pl !:protocol-tests,!:protocol-tests-core,!:codegen-generated-classes-test,!:sdk-benchmarks,!:module-path-tests,!:tests-coverage-reporting,!:stability-tests,!:sdk-native-image-test,!:auth-sts-testing,!:s3-benchmarks -DautoReleaseAfterClose=true -DstagingProgressTimeoutMinutes=30
44+
else
45+
echo "This version was already released."
46+
fi
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<settings>
2+
<servers>
3+
<server>
4+
<id>sonatype-nexus-staging</id>
5+
<username>amazonwebservices</username>
6+
<password>$SONATYPE_PASSWORD</password>
7+
</server>
8+
</servers>
9+
<profiles>
10+
<profile>
11+
<id>publishing</id>
12+
<activation>
13+
<activeByDefault>false</activeByDefault>
14+
</activation>
15+
<properties>
16+
<gpg.keyname>$SDK_SIGNING_GPG_KEYNAME</gpg.keyname>
17+
<gpg.passphrase>$SDK_SIGNING_GPG_PASSPHRASE</gpg.passphrase>
18+
</properties>
19+
</profile>
20+
</profiles>
21+
</settings>

0 commit comments

Comments
 (0)