Skip to content

chore: update mainline-1.x with new release process #385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ target/
.classpath
/bin/
.idea/
*.iml
*.iml

##semantic-release
package-lock.json
package.json
node_modules/
pom.xml.versionsBackup

64 changes: 64 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
## Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0
{
"branches": ["master", "mainline-1.x"],
"plugins": [
["@semantic-release/commit-analyzer", {
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
},
"presetConfig": {
"types": [
{"type": "feat", "section": "Features"},
{"type": "fix", "section": "Fixes"},
{"type": "chore", "section": "Maintenance"},
{"type": "docs", "section": "Maintenance"},
{"type": "revert", "section": "Fixes"},
{"type": "style", "hidden": true},
{"type": "refactor", "hidden": true},
{"type": "perf", "hidden": true},
{"type": "test", "hidden": true}
]
},
"releaseRules": [
{"type": "docs", "release": "patch"},
{"type": "revert", "release": "patch"},
{"type": "chore", "release": "patch"}
]
}],
["@semantic-release/release-notes-generator", {
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
},
"presetConfig": {
"types": [
{"type": "feat", "section": "Features"},
{"type": "fix", "section": "Fixes"},
{"type": "chore", "section": "Maintenance"},
{"type": "docs", "section": "Maintenance"},
{"type": "revert", "section": "Fixes"},
{"type": "style", "hidden": true},
{"type": "refactor", "hidden": true},
{"type": "perf", "hidden": true},
{"type": "test", "hidden": true}
]
}
}],
["@semantic-release/changelog", {
"changelogFile": "./CHANGELOG.md",
"changelogTitle": "# Changelog"
}],
["@semantic-release/exec", {
"prepareCmd": "mvn versions:set -DnewVersion=${nextRelease.version} \
-DautoVersionSubmodules=true && find README.md -type f \
-exec sed -i '' 's/<version>.*<\\/version>/<version>${nextRelease.version}<\\/version>/g' {} \\;"
}],
["@semantic-release/git", {
"assets": ["./CHANGELOG.md", "./pom.xml", "./README.md"],
"message": "AWS Encryption SDK ${nextRelease.version} Release \n\n${nextRelease.notes}"
}],
],
"repositoryUrl": "https://github.com/aws/aws-encryption-sdk-java",
}
91 changes: 91 additions & 0 deletions codebuild/ci/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
## Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0
version: 0.2

# TODO: Replace/Augment build-graph with build-matrix
# Note: It's possible that 9 builds will be running concurrently with the current arrangement

batch:
fast-fail: false
build-graph:
#- identifier: static_analysis
# buildspec: codebuild/ci/static-analysis.yml
# env:
# compute-type: BUILD_GENERAL1_MEDIUM
# image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
######### Start Vector tests #########
- identifier: vectors_ci_openjdk8
buildspec: codebuild/ci/vectors-ci.yml
env:
compute-type: BUILD_GENERAL1_LARGE
variables:
JAVA_ENV_VERSION: openjdk8
image: aws/codebuild/standard:3.0
- identifier: vectors_ci_openjdk11
buildspec: codebuild/ci/vectors-ci.yml
env:
compute-type: BUILD_GENERAL1_LARGE
variables:
JAVA_ENV_VERSION: openjdk11
image: aws/codebuild/standard:3.0
- identifier: vectors_ci_corretto8
buildspec: codebuild/ci/vectors-ci.yml
env:
compute-type: BUILD_GENERAL1_LARGE
variables:
JAVA_ENV_VERSION: corretto8
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
- identifier: vectors_ci_corretto11
buildspec: codebuild/ci/vectors-ci.yml
env:
compute-type: BUILD_GENERAL1_LARGE
variables:
JAVA_ENV_VERSION: corretto11
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
######### End Vector tests #########
- identifier: release_ci
buildspec: codebuild/ci/release-ci.yml
env:
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:3.0
######### Start JAR Smoke tests #########
- identifier: validate_ci_openjdk8
depend-on:
- release_ci
buildspec: codebuild/ci/validate-ci.yml
env:
variables:
JAVA_ENV_VERSION: openjdk8
JAVA_NUMERIC_VERSION: 8
image: aws/codebuild/standard:3.0
- identifier: validate_ci_openjdk11
depend-on:
- release_ci
buildspec: codebuild/ci/validate-ci.yml
env:
compute-type: BUILD_GENERAL1_MEDIUM
variables:
JAVA_ENV_VERSION: openjdk11
JAVA_NUMERIC_VERSION: 11
image: aws/codebuild/standard:3.0
- identifier: validate_ci_corretto8
depend-on:
- release_ci
buildspec: codebuild/ci/validate-ci.yml
env:
compute-type: BUILD_GENERAL1_MEDIUM
variables:
JAVA_ENV_VERSION: corretto8
JAVA_NUMERIC_VERSION: 8
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
- identifier: validate_ci_corretto11
depend-on:
- release_ci
buildspec: codebuild/ci/validate-ci.yml
env:
compute-type: BUILD_GENERAL1_MEDIUM
variables:
JAVA_ENV_VERSION: corretto11
JAVA_NUMERIC_VERSION: 11
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
######### End JAR Smoke tests #########
64 changes: 64 additions & 0 deletions codebuild/ci/release-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
## Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0
version: 0.2

env:
variables:
REGION: us-east-1
DOMAIN: crypto-tools-internal
REPOSITORY: java-esdk-ci
NAMESPACE: com.amazonaws
PACKAGE: aws-encryption-sdk-java
parameter-store:
ACCOUNT: /CodeBuild/AccountIdentity
secrets-manager:
GPG_KEY: Maven-GPG-Keys-Credentials:Keyname
GPG_PASS: Maven-GPG-Keys-Credentials:Passphrase

phases:
install:
runtime-versions:
java: openjdk11
pre_build:
commands:
- export SETTINGS_FILE=$(pwd)/codebuild/release/settings.xml
- export CODEARTIFACT_TOKEN=$(aws codeartifact get-authorization-token --domain $DOMAIN --domain-owner $ACCOUNT --query authorizationToken --output text --region ${REGION})
- export CODEARTIFACT_REPO_URL=https://${DOMAIN}-${ACCOUNT}.d.codeartifact.${REGION}.amazonaws.com/maven/${REPOSITORY}
- aws secretsmanager get-secret-value --region us-west-2 --secret-id Maven-GPG-Keys --query SecretBinary --output text | base64 -d > ~/mvn_gpg.tgz
- tar -xvf ~/mvn_gpg.tgz -C ~
build:
commands:
- VERSION_HASH="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)-$CODEBUILD_RESOLVED_SOURCE_VERSION"
# See https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
- echo "Setting version in POM to $VERSION_HASH"
- mvn versions:set -DnewVersion="$VERSION_HASH" --no-transfer-progress
- echo "Version is now $(grep version pom.xml | head -n 1 | sed -n 's/[ \t]*<version>\(.*\)<\/version>/\1/p')"
- |
mvn deploy \
-PpublishingCodeArtifact \
-Dmaven.test.skip=true \
-DperformRelease \
-Dgpg.homedir="$HOME/mvn_gpg" \
-DautoReleaseAfterClose=true \
-Dgpg.keyname="$GPG_KEY" \
-Dgpg.passphrase="$GPG_PASS" \
-Dcodeartifact.token=$CODEARTIFACT_TOKEN \
-DaltDeploymentRepository=codeartifact::default::$CODEARTIFACT_REPO_URL \
--no-transfer-progress \
-T 8 \
-s $SETTINGS_FILE
finally:
- |
if expr ${CODEBUILD_BUILD_SUCCEEDING} != 1; then
echo "An error occured while building and uploading $REPOSITORY."
echo "Did a previous build already upload $VERSION_HASH to $REPOSITORY?"
echo "Try deleting $VERSION_HASH from $REPOSITORY and restart"
echo "Delete Package Version Command \n
aws codeartifact delete-package-versions --domain $DOMAIN \
--repository $REPOSITORY \
--format maven \
--namespace $NAMESPACE \
--package $PACKAGE \
--versions $VERSION_HASH \
--region $REGION";
fi
25 changes: 25 additions & 0 deletions codebuild/ci/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>codeartifact</id>
<username>aws</username>
<password>${codeartifact.token}</password>
</server>
</servers>

<profiles>
<profile>
<id>codeartifact</id>
<repositories>
<repository>
<id>codeartifact</id>
<name>codeartifact</name>
<url>${codeartifact.url}</url> <!-- passed via command line to avoid hardcoding it here -->
</repository>
</repositories>
</profile>
</profiles>
</settings>
13 changes: 13 additions & 0 deletions codebuild/ci/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0
version: 0.2

phases:
install:
runtime-versions:
nodejs: 12
java: corretto11
build:
commands:
- mvn -T 4 -ntp com.coveo:fmt-maven-plugin:check
- ./util/test-conditions.sh
40 changes: 40 additions & 0 deletions codebuild/ci/validate-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0
version: 0.2

env:
variables:
REGION: us-east-1
DOMAIN: crypto-tools-internal
REPOSITORY: java-esdk-ci
parameter-store:
ACCOUNT: /CodeBuild/AccountId

phases:
install:
commands:
- pip install awscli
runtime-versions:
java: $JAVA_ENV_VERSION
pre_build:
commands:
- VERSION_HASH="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)-$CODEBUILD_RESOLVED_SOURCE_VERSION"
- export SETTINGS_FILE=$(pwd)/codebuild/ci/settings.xml
- git clone https://github.com/aws-samples/busy-engineers-document-bucket.git
- cd busy-engineers-document-bucket/exercises/java/encryption-context-complete
- export CODEARTIFACT_TOKEN=$(aws codeartifact get-authorization-token --domain $DOMAIN --domain-owner $ACCOUNT --query authorizationToken --output text --region ${REGION})
- export CODEARTIFACT_REPO_URL=https://${DOMAIN}-${ACCOUNT}.d.codeartifact.${REGION}.amazonaws.com/maven/${REPOSITORY}
build:
commands:
- |
mvn verify \
-Pcodeartifact \
-Dcheckstyle.skip \
-Desdk.version=$VERSION_HASH \
-Dmaven.compiler.target=$JAVA_NUMERIC_VERSION \
-Dmaven.compiler.source=$JAVA_NUMERIC_VERSION \
-Dcodeartifact.token=$CODEARTIFACT_TOKEN \
-Dcodeartifact.url=$CODEARTIFACT_REPO_URL \
--no-transfer-progress \
-T 4 \
-s $SETTINGS_FILE
11 changes: 11 additions & 0 deletions codebuild/ci/vectors-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0
version: 0.2

phases:
install:
runtime-versions:
java: $JAVA_ENV_VERSION
build:
commands:
- 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"
9 changes: 0 additions & 9 deletions codebuild/corretto11.yml

This file was deleted.

9 changes: 0 additions & 9 deletions codebuild/corretto8.yml

This file was deleted.

9 changes: 0 additions & 9 deletions codebuild/openjdk11.yml

This file was deleted.

9 changes: 0 additions & 9 deletions codebuild/openjdk8.yml

This file was deleted.

Loading