Skip to content

Commit c55c2d2

Browse files
authored
chore: update mainline-1.x with new release process (#385)
1 parent 468625d commit c55c2d2

23 files changed

+604
-152
lines changed

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,11 @@ target/
55
.classpath
66
/bin/
77
.idea/
8-
*.iml
8+
*.iml
9+
10+
##semantic-release
11+
package-lock.json
12+
package.json
13+
node_modules/
14+
pom.xml.versionsBackup
15+

.releaserc

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
## SPDX-License-Identifier: Apache-2.0
3+
{
4+
"branches": ["master", "mainline-1.x"],
5+
"plugins": [
6+
["@semantic-release/commit-analyzer", {
7+
"preset": "conventionalcommits",
8+
"parserOpts": {
9+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
10+
},
11+
"presetConfig": {
12+
"types": [
13+
{"type": "feat", "section": "Features"},
14+
{"type": "fix", "section": "Fixes"},
15+
{"type": "chore", "section": "Maintenance"},
16+
{"type": "docs", "section": "Maintenance"},
17+
{"type": "revert", "section": "Fixes"},
18+
{"type": "style", "hidden": true},
19+
{"type": "refactor", "hidden": true},
20+
{"type": "perf", "hidden": true},
21+
{"type": "test", "hidden": true}
22+
]
23+
},
24+
"releaseRules": [
25+
{"type": "docs", "release": "patch"},
26+
{"type": "revert", "release": "patch"},
27+
{"type": "chore", "release": "patch"}
28+
]
29+
}],
30+
["@semantic-release/release-notes-generator", {
31+
"preset": "conventionalcommits",
32+
"parserOpts": {
33+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
34+
},
35+
"presetConfig": {
36+
"types": [
37+
{"type": "feat", "section": "Features"},
38+
{"type": "fix", "section": "Fixes"},
39+
{"type": "chore", "section": "Maintenance"},
40+
{"type": "docs", "section": "Maintenance"},
41+
{"type": "revert", "section": "Fixes"},
42+
{"type": "style", "hidden": true},
43+
{"type": "refactor", "hidden": true},
44+
{"type": "perf", "hidden": true},
45+
{"type": "test", "hidden": true}
46+
]
47+
}
48+
}],
49+
["@semantic-release/changelog", {
50+
"changelogFile": "./CHANGELOG.md",
51+
"changelogTitle": "# Changelog"
52+
}],
53+
["@semantic-release/exec", {
54+
"prepareCmd": "mvn versions:set -DnewVersion=${nextRelease.version} \
55+
-DautoVersionSubmodules=true && find README.md -type f \
56+
-exec sed -i '' 's/<version>.*<\\/version>/<version>${nextRelease.version}<\\/version>/g' {} \\;"
57+
}],
58+
["@semantic-release/git", {
59+
"assets": ["./CHANGELOG.md", "./pom.xml", "./README.md"],
60+
"message": "AWS Encryption SDK ${nextRelease.version} Release \n\n${nextRelease.notes}"
61+
}],
62+
],
63+
"repositoryUrl": "https://github.com/aws/aws-encryption-sdk-java",
64+
}

codebuild/ci/ci.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
## Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
## SPDX-License-Identifier: Apache-2.0
3+
version: 0.2
4+
5+
# TODO: Replace/Augment build-graph with build-matrix
6+
# Note: It's possible that 9 builds will be running concurrently with the current arrangement
7+
8+
batch:
9+
fast-fail: false
10+
build-graph:
11+
#- identifier: static_analysis
12+
# buildspec: codebuild/ci/static-analysis.yml
13+
# env:
14+
# compute-type: BUILD_GENERAL1_MEDIUM
15+
# image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
16+
######### Start Vector tests #########
17+
- identifier: vectors_ci_openjdk8
18+
buildspec: codebuild/ci/vectors-ci.yml
19+
env:
20+
compute-type: BUILD_GENERAL1_LARGE
21+
variables:
22+
JAVA_ENV_VERSION: openjdk8
23+
image: aws/codebuild/standard:3.0
24+
- identifier: vectors_ci_openjdk11
25+
buildspec: codebuild/ci/vectors-ci.yml
26+
env:
27+
compute-type: BUILD_GENERAL1_LARGE
28+
variables:
29+
JAVA_ENV_VERSION: openjdk11
30+
image: aws/codebuild/standard:3.0
31+
- identifier: vectors_ci_corretto8
32+
buildspec: codebuild/ci/vectors-ci.yml
33+
env:
34+
compute-type: BUILD_GENERAL1_LARGE
35+
variables:
36+
JAVA_ENV_VERSION: corretto8
37+
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
38+
- identifier: vectors_ci_corretto11
39+
buildspec: codebuild/ci/vectors-ci.yml
40+
env:
41+
compute-type: BUILD_GENERAL1_LARGE
42+
variables:
43+
JAVA_ENV_VERSION: corretto11
44+
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
45+
######### End Vector tests #########
46+
- identifier: release_ci
47+
buildspec: codebuild/ci/release-ci.yml
48+
env:
49+
compute-type: BUILD_GENERAL1_LARGE
50+
image: aws/codebuild/standard:3.0
51+
######### Start JAR Smoke tests #########
52+
- identifier: validate_ci_openjdk8
53+
depend-on:
54+
- release_ci
55+
buildspec: codebuild/ci/validate-ci.yml
56+
env:
57+
variables:
58+
JAVA_ENV_VERSION: openjdk8
59+
JAVA_NUMERIC_VERSION: 8
60+
image: aws/codebuild/standard:3.0
61+
- identifier: validate_ci_openjdk11
62+
depend-on:
63+
- release_ci
64+
buildspec: codebuild/ci/validate-ci.yml
65+
env:
66+
compute-type: BUILD_GENERAL1_MEDIUM
67+
variables:
68+
JAVA_ENV_VERSION: openjdk11
69+
JAVA_NUMERIC_VERSION: 11
70+
image: aws/codebuild/standard:3.0
71+
- identifier: validate_ci_corretto8
72+
depend-on:
73+
- release_ci
74+
buildspec: codebuild/ci/validate-ci.yml
75+
env:
76+
compute-type: BUILD_GENERAL1_MEDIUM
77+
variables:
78+
JAVA_ENV_VERSION: corretto8
79+
JAVA_NUMERIC_VERSION: 8
80+
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
81+
- identifier: validate_ci_corretto11
82+
depend-on:
83+
- release_ci
84+
buildspec: codebuild/ci/validate-ci.yml
85+
env:
86+
compute-type: BUILD_GENERAL1_MEDIUM
87+
variables:
88+
JAVA_ENV_VERSION: corretto11
89+
JAVA_NUMERIC_VERSION: 11
90+
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
91+
######### End JAR Smoke tests #########

codebuild/ci/release-ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
## SPDX-License-Identifier: Apache-2.0
3+
version: 0.2
4+
5+
env:
6+
variables:
7+
REGION: us-east-1
8+
DOMAIN: crypto-tools-internal
9+
REPOSITORY: java-esdk-ci
10+
NAMESPACE: com.amazonaws
11+
PACKAGE: aws-encryption-sdk-java
12+
parameter-store:
13+
ACCOUNT: /CodeBuild/AccountIdentity
14+
secrets-manager:
15+
GPG_KEY: Maven-GPG-Keys-Credentials:Keyname
16+
GPG_PASS: Maven-GPG-Keys-Credentials:Passphrase
17+
18+
phases:
19+
install:
20+
runtime-versions:
21+
java: openjdk11
22+
pre_build:
23+
commands:
24+
- export SETTINGS_FILE=$(pwd)/codebuild/release/settings.xml
25+
- export CODEARTIFACT_TOKEN=$(aws codeartifact get-authorization-token --domain $DOMAIN --domain-owner $ACCOUNT --query authorizationToken --output text --region ${REGION})
26+
- export CODEARTIFACT_REPO_URL=https://${DOMAIN}-${ACCOUNT}.d.codeartifact.${REGION}.amazonaws.com/maven/${REPOSITORY}
27+
- aws secretsmanager get-secret-value --region us-west-2 --secret-id Maven-GPG-Keys --query SecretBinary --output text | base64 -d > ~/mvn_gpg.tgz
28+
- tar -xvf ~/mvn_gpg.tgz -C ~
29+
build:
30+
commands:
31+
- VERSION_HASH="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)-$CODEBUILD_RESOLVED_SOURCE_VERSION"
32+
# See https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
33+
- echo "Setting version in POM to $VERSION_HASH"
34+
- mvn versions:set -DnewVersion="$VERSION_HASH" --no-transfer-progress
35+
- echo "Version is now $(grep version pom.xml | head -n 1 | sed -n 's/[ \t]*<version>\(.*\)<\/version>/\1/p')"
36+
- |
37+
mvn deploy \
38+
-PpublishingCodeArtifact \
39+
-Dmaven.test.skip=true \
40+
-DperformRelease \
41+
-Dgpg.homedir="$HOME/mvn_gpg" \
42+
-DautoReleaseAfterClose=true \
43+
-Dgpg.keyname="$GPG_KEY" \
44+
-Dgpg.passphrase="$GPG_PASS" \
45+
-Dcodeartifact.token=$CODEARTIFACT_TOKEN \
46+
-DaltDeploymentRepository=codeartifact::default::$CODEARTIFACT_REPO_URL \
47+
--no-transfer-progress \
48+
-T 8 \
49+
-s $SETTINGS_FILE
50+
finally:
51+
- |
52+
if expr ${CODEBUILD_BUILD_SUCCEEDING} != 1; then
53+
echo "An error occured while building and uploading $REPOSITORY."
54+
echo "Did a previous build already upload $VERSION_HASH to $REPOSITORY?"
55+
echo "Try deleting $VERSION_HASH from $REPOSITORY and restart"
56+
echo "Delete Package Version Command \n
57+
aws codeartifact delete-package-versions --domain $DOMAIN \
58+
--repository $REPOSITORY \
59+
--format maven \
60+
--namespace $NAMESPACE \
61+
--package $PACKAGE \
62+
--versions $VERSION_HASH \
63+
--region $REGION";
64+
fi

codebuild/ci/settings.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
4+
http://maven.apache.org/xsd/settings-1.0.0.xsd">
5+
<servers>
6+
<server>
7+
<id>codeartifact</id>
8+
<username>aws</username>
9+
<password>${codeartifact.token}</password>
10+
</server>
11+
</servers>
12+
13+
<profiles>
14+
<profile>
15+
<id>codeartifact</id>
16+
<repositories>
17+
<repository>
18+
<id>codeartifact</id>
19+
<name>codeartifact</name>
20+
<url>${codeartifact.url}</url> <!-- passed via command line to avoid hardcoding it here -->
21+
</repository>
22+
</repositories>
23+
</profile>
24+
</profiles>
25+
</settings>

codebuild/ci/static-analysis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
## SPDX-License-Identifier: Apache-2.0
3+
version: 0.2
4+
5+
phases:
6+
install:
7+
runtime-versions:
8+
nodejs: 12
9+
java: corretto11
10+
build:
11+
commands:
12+
- mvn -T 4 -ntp com.coveo:fmt-maven-plugin:check
13+
- ./util/test-conditions.sh

codebuild/ci/validate-ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
## SPDX-License-Identifier: Apache-2.0
3+
version: 0.2
4+
5+
env:
6+
variables:
7+
REGION: us-east-1
8+
DOMAIN: crypto-tools-internal
9+
REPOSITORY: java-esdk-ci
10+
parameter-store:
11+
ACCOUNT: /CodeBuild/AccountId
12+
13+
phases:
14+
install:
15+
commands:
16+
- pip install awscli
17+
runtime-versions:
18+
java: $JAVA_ENV_VERSION
19+
pre_build:
20+
commands:
21+
- VERSION_HASH="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)-$CODEBUILD_RESOLVED_SOURCE_VERSION"
22+
- export SETTINGS_FILE=$(pwd)/codebuild/ci/settings.xml
23+
- git clone https://github.com/aws-samples/busy-engineers-document-bucket.git
24+
- cd busy-engineers-document-bucket/exercises/java/encryption-context-complete
25+
- export CODEARTIFACT_TOKEN=$(aws codeartifact get-authorization-token --domain $DOMAIN --domain-owner $ACCOUNT --query authorizationToken --output text --region ${REGION})
26+
- export CODEARTIFACT_REPO_URL=https://${DOMAIN}-${ACCOUNT}.d.codeartifact.${REGION}.amazonaws.com/maven/${REPOSITORY}
27+
build:
28+
commands:
29+
- |
30+
mvn verify \
31+
-Pcodeartifact \
32+
-Dcheckstyle.skip \
33+
-Desdk.version=$VERSION_HASH \
34+
-Dmaven.compiler.target=$JAVA_NUMERIC_VERSION \
35+
-Dmaven.compiler.source=$JAVA_NUMERIC_VERSION \
36+
-Dcodeartifact.token=$CODEARTIFACT_TOKEN \
37+
-Dcodeartifact.url=$CODEARTIFACT_REPO_URL \
38+
--no-transfer-progress \
39+
-T 4 \
40+
-s $SETTINGS_FILE

codebuild/ci/vectors-ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
## SPDX-License-Identifier: Apache-2.0
3+
version: 0.2
4+
5+
phases:
6+
install:
7+
runtime-versions:
8+
java: $JAVA_ENV_VERSION
9+
build:
10+
commands:
11+
- mvn install -T 8 -Dgpg.skip=true -ntp "-DtestVectorZip=file://$CODEBUILD_SRC_DIR/src/test/resources/aws-encryption-sdk-test-vectors/vectors/awses-decrypt/python-2.2.0.zip"

codebuild/corretto11.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

codebuild/corretto8.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

codebuild/openjdk11.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

codebuild/openjdk8.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)