@@ -12,17 +12,7 @@ phases:
12
12
commands :
13
13
- sudo add-apt-repository ppa:openjdk-r/ppa
14
14
- sudo apt-get update -y
15
- # Android requires 11 for gradle
16
15
- sudo apt-get install openjdk-11-jdk-headless maven wget unzip -y -f
17
- # install android sdk
18
- - wget --quiet https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip
19
- - export ANDROID_SDK_ROOT=$CODEBUILD_SRC_DIR/android-sdk
20
- - mkdir -p $ANDROID_SDK_ROOT/cmdline-tools
21
- - unzip commandlinetools-linux-7583922_latest.zip -d $ANDROID_SDK_ROOT/cmdline-tools
22
- # This weird path needed for cmd tool to work
23
- - mv $ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools $ANDROID_SDK_ROOT/cmdline-tools/latest
24
- # install android build tools
25
- - echo y | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "build-tools;30.0.3" "platforms;android-30" "ndk;21.4.7075529"
26
16
- echo "\nBuild version data:"
27
17
- echo "\nJava Version:"; java -version
28
18
- echo "\nMaven Version:"; mvn --version
@@ -32,61 +22,41 @@ phases:
32
22
commands :
33
23
- cd $CODEBUILD_SRC_DIR/aws-iot-device-sdk-java-v2
34
24
- export PKG_VERSION=$(cat $CODEBUILD_SRC_DIR/VERSION)
35
-
25
+ - echo $PKG_VERSION
36
26
# install settings.xml to ~/.m2/settings.xml
37
27
- mkdir -p $HOME/.m2
38
28
- export CD_SETTINGS=$(aws secretsmanager get-secret-value --secret-id cd/aws-crt-java-settings/token --query "SecretString" | cut -f2 -d\")
39
29
- echo $CD_SETTINGS > $HOME/.m2/settings.xml
40
30
41
31
# Use the password and username from secret manager to update the settings
42
- - export ST_USERNAME=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id Sonatype/JIRA/token | cut -f2 -d":" | cut -f1 -d"," | sed -e 's/[\\\"\}]//g')
43
- - export ST_PASSWORD=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id Sonatype/JIRA/token | cut -f3 -d":" | sed -e 's/[\\\"\}]//g')
32
+ - export ST_USERNAME=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id Sonatype/JIRA/token --region us-east-1 | cut -f2 -d":" | cut -f1 -d"," | sed -e 's/[\\\"\}]//g')
33
+ - export ST_PASSWORD=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id Sonatype/JIRA/token --region us-east-1 | cut -f3 -d":" | sed -e 's/[\\\"\}]//g')
34
+ # Use the username and password from secret manager to update the settings
44
35
- sed -i 's|token-username|'"$ST_USERNAME"'|g' $HOME/.m2/settings.xml
45
36
- sed -i 's|token-password|'"$ST_PASSWORD"'|g' $HOME/.m2/settings.xml
46
-
47
37
# import gpg key
48
38
- export CD_KEY=$(aws secretsmanager get-secret-value --secret-id cd/aws-crt-java-key --query "SecretString" | cut -f2 -d\")
49
39
- echo $CD_KEY > /tmp/aws-sdk-common-runtime.key.asc
50
-
40
+ # for https://github.com/keybase/keybase-issues/issues/2798
41
+ - export GPG_TTY=$(tty)
51
42
- gpg --batch --import /tmp/aws-sdk-common-runtime.key.asc
52
- - export GPG_PASSPHRASE=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id cd/aws-crt-java-key/password | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
53
-
54
- # Java 17 needs special JDK options apparently. It is a known Sonatype issue.
55
- # Issue link: https://issues.sonatype.org/browse/NEXUS-27902
56
- - export JDK_JAVA_OPTIONS='--add-opens java.base/java.util=ALL-UNNAMED'
57
-
43
+ # refer to https://maven.apache.org/plugins/maven-gpg-plugin/usage.html
44
+ - export MAVEN_GPG_PASSPHRASE=$(aws --query "SecretString" secretsmanager get-secret-value --secret-id cd/aws-crt-java-key/password | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
58
45
build :
59
46
commands :
60
47
- cd $CODEBUILD_SRC_DIR/aws-iot-device-sdk-java-v2/sdk
61
48
# update the CRT dependency to the latest released version
62
49
- mvn -B versions:use-latest-versions -Dincludes=software.amazon.awssdk.crt*
63
50
64
- # update the version to match the git tag, make a snapshot version we can test
65
- - mvn -B versions:set -DnewVersion =${PKG_VERSION}-SNAPSHOT
66
- # do a full build/deploy, but skip tests, since the shared libs were artifacts above
67
- - mvn -B deploy -Prelease -Dmaven.test.skip=true -Dgpg.passphrase=$GPG_PASSPHRASE
51
+ # make a snapshot version we can test
52
+ - export DEPLOY_VERSION =${PKG_VERSION}-SNAPSHOT
53
+ - mvn -B versions:set -DnewVersion=${DEPLOY_VERSION}
54
+ - mvn -B deploy -Prelease -Dmaven.test.skip=true
68
55
69
- # update the version to match the git tag, make a staging release which we will release once snapshot testing passes
70
- - mvn -B versions:set -DnewVersion=${PKG_VERSION}
71
- - mvn -B deploy -Prelease -Dmaven.test.skip=true -Dgpg.passphrase=$GPG_PASSPHRASE | tee /tmp/deploy.log
72
- - cat /tmp/deploy.log | grep "Created staging repository with ID" | cut -d\" -f2 | tee /tmp/repositoryId.txt
73
-
74
- # Store the repository ID in a secret for use later
75
- - aws secretsmanager update-secret --secret-id cd/aws-iot-device-sdk-java-v2/repository-id --secret-string "$(cat /tmp/repositoryId.txt)" --region us-east-1
76
-
77
- # delploy android
78
- - cd $CODEBUILD_SRC_DIR/aws-iot-device-sdk-java-v2
79
- - ./codebuild/cd/deploy-snapshot-android.sh
80
- # Store the repository ID in a secret for use later
81
- - aws secretsmanager update-secret --secret-id cd/aws-iot-device-sdk-java-v2/repository-id-android --secret-string "$(cat /tmp/android_repositoryId.txt)" --region us-east-1
82
-
83
- artifacts :
84
- discard-paths : yes
85
- files :
86
- - $CODEBUILD_SRC_DIR/aws-iot-device-sdk-java-v2/target/aws-crt-*.jar
87
- - $CODEBUILD_SRC_DIR/aws-iot-device-sdk-java-v2/target/aws-crt-*.asc
88
- - /tmp/repositoryId.txt
89
- - /tmp/android_repositoryId.txt
56
+ post_build :
57
+ commands :
58
+ # --- TEST SNAPSHOT ---
59
+ - mvn -B dependency:get -DrepoUrl=https://central.sonatype.com/repository/maven-snapshots/ -Dartifact=software.amazon.awssdk.iotdevicesdk:aws-iot-device-sdk:${DEPLOY_VERSION} -Dtransitive=false
90
60
91
61
cache :
92
62
paths :
0 commit comments