Skip to content

ci: compile with openjdk11, validate against other JDKs #293

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 22 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
507483a
ci: compile with openjdk11, validate against other JDKs
texastony Jul 23, 2021
bb6f9a6
ci: address too many builds in Q error
texastony Jul 24, 2021
97f56ec
ci: correct build images
texastony Jul 24, 2021
e15a32b
ci: try abstracting the secrets
texastony Jul 24, 2021
b53bd83
ci(mvn): do not log transfers
texastony Jul 25, 2021
133640c
ci: after busy engineer test, run all ESDK tests
texastony Jul 25, 2021
6599ec2
ci: correct typo
texastony Jul 26, 2021
217ea70
ci: suppress transfer progress
texastony Jul 26, 2021
426dfd1
ci: suppress info logs from javadoc
texastony Jul 26, 2021
7d5eda1
ci: correct typo
texastony Jul 26, 2021
859124d
ci: correct typo
texastony Jul 26, 2021
5495e7d
refactor(pom): group dependencies by scope
texastony Jul 26, 2021
b9d4a49
ci: copy and run the ESDK tests through the busy-bucket
texastony Jul 26, 2021
6731450
Update codebuild/ci/validate-ci.yml
texastony Jul 26, 2021
b95a553
revert: "Update codebuild/ci/validate-ci.yml"
texastony Jul 26, 2021
3d2dcab
revert: "ci: copy and run the ESDK tests through the busy-bucket"
texastony Jul 26, 2021
fb10165
revert: "refactor(pom): group dependencies by scope"
texastony Jul 26, 2021
0f881f3
ci: move vector tests to it's own buildspec
texastony Jul 26, 2021
d9db99f
ci: spacing typo in buildspec
texastony Jul 26, 2021
60a6982
ci: spacing typo in buildspec
texastony Jul 26, 2021
16070bf
ci: optimize build times via parallel
texastony Jul 26, 2021
1980282
ci: run unit/integ/example/vector tests against all JDKs
texastony Jul 27, 2021
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
106 changes: 106 additions & 0 deletions codebuild/ci/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
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/AccountId
secrets-manager:
GPG_KEY: Maven-GPG-Keys-Credentials:Keyname
GPG_PASS: Maven-GPG-Keys-Credentials:Passphrase
exported-variables:
VERSION_HASH
# This can *probably* only be used with CodePipelines

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"
- echo "Version is now $(grep version pom.xml | head -n 1 | sed -n 's/[ \t]*<version>\(.*\)<\/version>/\1/p')"
- |
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
post_build:
commands:
- |
if expr ${CODEBUILD_BUILD_SUCCEEDING} != 1; then
echo "An error occured while building and uploading $REPOSITORY."
echo "Did a previous build batch already upload $VERSION_HASH to $REPOSITORY?"
echo "Try deleting $VERSION_HASH from $REPOSITORY and restart batch"
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
batch:
fast-fail: false
build-graph:
- identifier: static_analysis
buildspec: codebuild/ci/static-analysis.yml
- identifier: ci_build
- identifier: validate_ci_openjdk8
depend-on:
- ci_build
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:
- ci_build
buildspec: codebuild/ci/validate-ci.yml
env:
variables:
JAVA_ENV_VERSION: openjdk11
JAVA_NUMERIC_VERSION: 11
image: aws/codebuild/standard:3.0
- identifier: validate_ci_corretto8
depend-on:
- ci_build
buildspec: codebuild/ci/validate-ci.yml
env:
variables:
JAVA_ENV_VERSION: corretto8
JAVA_NUMERIC_VERSION: 8
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
- identifier: validate_ci_corretto11
depend-on:
- ci_build
buildspec: codebuild/ci/validate-ci.yml
env:
variables:
JAVA_ENV_VERSION: corretto11
JAVA_NUMERIC_VERSION: 11
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
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>
11 changes: 11 additions & 0 deletions codebuild/ci/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 0.2

phases:
install:
runtime-versions:
nodejs: 12
java: corretto11
build:
commands:
- mvn com.coveo:fmt-maven-plugin:check
- ./util/test-conditions.sh
37 changes: 37 additions & 0 deletions codebuild/ci/validate-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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 \
-s $SETTINGS_FILE