-
Notifications
You must be signed in to change notification settings - Fork 71
ci: create release builds that validate on multiple JDKs #148
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
Changes from 7 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
11981c4
ci(CodeBuild): Create release builds that validate on all support JDKs
texastony 2bf366d
fix: drop TODO
texastony 12f587b
fix: typo
texastony a00e837
fix: typo
texastony ced1740
ci(examples): enable specifying Java version and DDBEC version
texastony cc7605e
ci(codebuild): correct version grep
texastony c289b0c
ci(codebuild): pass ddbec version and validate against examples inste…
texastony 5e89c83
fix: members of codebuild/ are buildSpecs, not projects
texastony 03f929f
ci(pom): eliminate redundant/conflicting compiler source & target var…
texastony 7f3f51e
ci(CodeBuild): remove missing test target
texastony 606d70c
infra: correct yaml spacing error
texastony a0ae62c
ci: correct install phase
texastony 05ce952
Merge branch 'master' into improve_ci
texastony File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
version: 0.2 | ||
# 'release-prod' is an AWS::CodeBuild::Project that Releases to Sonatype and then validates the release with 'validate-prod' | ||
# Command to trigger this codebuild from an authorized command line. | ||
# aws codebuild start-build-batch \ | ||
# --region us-west-2 \ | ||
# --project-name java-ddb-ec-release \ | ||
# --environment-variables-override name=VERSION,value=<INSERT_VERSION>,type=PLAINTEXT name=COMMIT_ID,value=<INSERT_COMMIT_ID>,type=PLAINTEXT" | ||
|
||
env: | ||
secrets-manager: | ||
GPG_KEY: Maven-GPG-Keys-Credentials:Keyname | ||
GPG_PASS: Maven-GPG-Keys-Credentials:Passphrase | ||
SONA_USERNAME: Sonatype-Team-Account:Username | ||
SONA_PASSWORD: Sonatype-Team-Account:Password | ||
|
||
phases: | ||
install: | ||
runtime-versions: | ||
java: openjdk8 | ||
pre_build: | ||
commands: | ||
- git checkout $COMMIT_ID | ||
- FOUND_VERSION=$(grep version sdk1/pom.xml | head -n 2 | sed -n 's/[ \t]*<version>\(.*\)<\/version>/\1/p') | ||
- | | ||
if expr ${FOUND_VERSION} != ${VERSION}; then | ||
echo "pom.xml version (${FOUND_VERSION}) does not match expected version (${VERSION}), stopping" | ||
exit 1; | ||
fi | ||
- export SETTINGS_FILE=$(pwd)/codebuild/release/settings.xml | ||
- 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: | ||
- | | ||
mvn deploy \ | ||
-Ppublishing \ | ||
-Pfast-tests-only \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be removed. This is a profile that exists in the ESDK that only runs unit tests. DDBEC doesn't have the equivalent profile, so it will just run through all it's unit/integration tests. |
||
-DperformRelease \ | ||
-Dgpg.homedir="$HOME/mvn_gpg" \ | ||
-DautoReleaseAfterClose=true \ | ||
-Dgpg.keyname="$GPG_KEY" \ | ||
-Dgpg.passphrase="$GPG_PASS" \ | ||
-Dsonatype.username="$SONA_USERNAME" \ | ||
-Dsonatype.password="$SONA_PASSWORD" \ | ||
-s $SETTINGS_FILE | ||
|
||
|
||
batch: | ||
fast-fail: false | ||
build-graph: | ||
- identifier: release_to_prod | ||
- identifier: validate_prod_release_openjdk8 | ||
depend-on: | ||
- release_to_prod | ||
buildspec: codebuild/release/validate-prod.yml | ||
env: | ||
variables: | ||
JAVA_ENV_VERSION: openjdk8 | ||
JAVA_NUMERIC_VERSION: 8 | ||
image: aws/codebuild/standard:3.0 | ||
- identifier: validate_prod_release_openjdk11 | ||
depend-on: | ||
- release_to_prod | ||
buildspec: codebuild/release/validate-prod.yml | ||
env: | ||
variables: | ||
JAVA_ENV_VERSION: openjdk11 | ||
JAVA_NUMERIC_VERSION: 11 | ||
image: aws/codebuild/standard:3.0 | ||
- identifier: validate_prod_release_corretto8 | ||
depend-on: | ||
- release_to_prod | ||
buildspec: codebuild/release/validate-prod.yml | ||
env: | ||
variables: | ||
JAVA_ENV_VERSION: corretto8 | ||
JAVA_NUMERIC_VERSION: 8 | ||
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0 | ||
- identifier: validate_prod_release_corretto11 | ||
depend-on: | ||
- release_to_prod | ||
buildspec: codebuild/release/validate-prod.yml | ||
env: | ||
variables: | ||
JAVA_ENV_VERSION: corretto11 | ||
JAVA_NUMERIC_VERSION: 11 | ||
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
version: 0.2 | ||
# 'release-staging' is an AWS::CodeBuild::Project that Stages a release on CodeArtifact and validates the staging using 'validate-staging' | ||
texastony marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Command to trigger this codebuild from an authorized command line. | ||
# aws codebuild start-build-batch \ | ||
# --region us-west-2 \ | ||
# --project-name java-ddb-ec-test-release \ | ||
# --environment-variables-override name=VERSION,value=<INSERT_VERSION>,type=PLAINTEXT name=COMMIT_ID,value=<INSERT_COMMIT_ID>,type=PLAINTEXT | ||
|
||
env: | ||
variables: | ||
REGION: us-east-1 | ||
DOMAIN: crypto-tools-internal | ||
REPOSITORY: java-ddbec-staging | ||
parameter-store: | ||
ACCOUNT: /CodeBuild/AccountId | ||
secrets-manager: | ||
GPG_KEY: Maven-GPG-Keys-Credentials:Keyname | ||
GPG_PASS: Maven-GPG-Keys-Credentials:Passphrase | ||
|
||
phases: | ||
install: | ||
runtime-versions: | ||
java: openjdk8 | ||
pre_build: | ||
commands: | ||
- git checkout $COMMIT_ID | ||
- FOUND_VERSION=$(grep version sdk1/pom.xml | head -n 2 | sed -n 's/[ \t]*<version>\(.*\)<\/version>/\1/p') | ||
- | | ||
if expr ${FOUND_VERSION} != ${VERSION}; then | ||
echo "pom.xml version (${FOUND_VERSION}) does not match expected version (${VERSION}), stopping" | ||
exit 1; | ||
fi | ||
- 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: | ||
- | | ||
mvn deploy \ | ||
-PpublishingCodeArtifact \ | ||
-Pfast-tests-only \ | ||
-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 \ | ||
-s $SETTINGS_FILE | ||
|
||
batch: | ||
fast-fail: false | ||
build-graph: | ||
- identifier: release_to_staging | ||
- identifier: validate_staging_release_openjdk8 | ||
depend-on: | ||
- release_to_staging | ||
buildspec: codebuild/release/validate-staging.yml | ||
env: | ||
variables: | ||
JAVA_ENV_VERSION: openjdk8 | ||
JAVA_NUMERIC_VERSION: 8 | ||
image: aws/codebuild/standard:3.0 | ||
- identifier: validate_staging_release_openjdk11 | ||
depend-on: | ||
- release_to_staging | ||
buildspec: codebuild/release/validate-staging.yml | ||
env: | ||
variables: | ||
JAVA_ENV_VERSION: openjdk11 | ||
JAVA_NUMERIC_VERSION: 11 | ||
image: aws/codebuild/standard:3.0 | ||
- identifier: validate_staging_release_corretto8 | ||
depend-on: | ||
- release_to_staging | ||
buildspec: codebuild/release/validate-staging.yml | ||
env: | ||
variables: | ||
JAVA_ENV_VERSION: corretto8 | ||
JAVA_NUMERIC_VERSION: 8 | ||
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0 | ||
- identifier: validate_staging_release_corretto11 | ||
depend-on: | ||
- release_to_staging | ||
buildspec: codebuild/release/validate-staging.yml | ||
env: | ||
variables: | ||
JAVA_ENV_VERSION: corretto11 | ||
JAVA_NUMERIC_VERSION: 11 | ||
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<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> | ||
<server> | ||
<id>sonatype-nexus-staging</id> | ||
<username>${sonatype.username}</username> | ||
<password>${sonatype.password}</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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: 0.2 | ||
# 'validate-prod' is an AWS::CodeBuild::Project that validates a Sonatype release against the examples | ||
texastony marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
phases: | ||
install: | ||
runtime-versions: | ||
java: $JAVA_ENV_VERSION | ||
texastony marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pre_build: | ||
commands: | ||
- cd examples | ||
build: | ||
commands: | ||
- | | ||
mvn verify \ | ||
-Dcheckstyle.skip \ | ||
-Dddbec.version=$VERSION \ | ||
-Dmaven.compiler.target=$JAVA_NUMERIC_VERSION \ | ||
-Dmaven.compiler.source=$JAVA_NUMERIC_VERSION |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
version: 0.2 | ||
# 'validate-staging' is an AWS::CodeBuild::Project that validates artifacts from CodeArtifact against the examples | ||
texastony marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
env: | ||
variables: | ||
REGION: us-east-1 | ||
DOMAIN: crypto-tools-internal | ||
REPOSITORY: java-ddbec-staging | ||
parameter-store: | ||
ACCOUNT: /CodeBuild/AccountId | ||
|
||
phases: | ||
runtime-versions: | ||
java: $JAVA_ENV_VERSION | ||
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} | ||
texastony marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- cd examples | ||
build: | ||
commands: | ||
- | | ||
mvn verify \ | ||
-Pcodeartifact \ | ||
-Dcheckstyle.skip \ | ||
-Dddbec.version=$VERSION \ | ||
-Dmaven.compiler.target=$JAVA_NUMERIC_VERSION \ | ||
-Dmaven.compiler.source=$JAVA_NUMERIC_VERSION \ | ||
texastony marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-Dcodeartifact.token=$CODEARTIFACT_TOKEN \ | ||
-Dcodeartifact.url=$CODEARTIFACT_REPO_URL \ | ||
-s $SETTINGS_FILE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.