|
| 1 | +version: 0.2 |
| 2 | +# 'release-staging' is an AWS::CodeBuild::BuildSpec that Stages a release on CodeArtifact and validates the staging using 'validate-staging' |
| 3 | +# Command to trigger this codebuild from an authorized command line. |
| 4 | +# aws codebuild start-build-batch \ |
| 5 | +# --region us-west-2 \ |
| 6 | +# --project-name java-ddb-ec-test-release \ |
| 7 | +# --environment-variables-override name=VERSION,value=<INSERT_VERSION>,type=PLAINTEXT name=COMMIT_ID,value=<INSERT_COMMIT_ID>,type=PLAINTEXT |
| 8 | + |
| 9 | +env: |
| 10 | + variables: |
| 11 | + REGION: us-east-1 |
| 12 | + DOMAIN: crypto-tools-internal |
| 13 | + REPOSITORY: java-ddbec-staging |
| 14 | + parameter-store: |
| 15 | + ACCOUNT: /CodeBuild/AccountId |
| 16 | + secrets-manager: |
| 17 | + GPG_KEY: Maven-GPG-Keys-Credentials:Keyname |
| 18 | + GPG_PASS: Maven-GPG-Keys-Credentials:Passphrase |
| 19 | + |
| 20 | +phases: |
| 21 | + install: |
| 22 | + runtime-versions: |
| 23 | + java: openjdk8 |
| 24 | + pre_build: |
| 25 | + commands: |
| 26 | + - git checkout $COMMIT_ID |
| 27 | + - FOUND_VERSION=$(grep version sdk1/pom.xml | head -n 2 | sed -n 's/[ \t]*<version>\(.*\)<\/version>/\1/p') |
| 28 | + - | |
| 29 | + if expr ${FOUND_VERSION} != ${VERSION}; then |
| 30 | + echo "pom.xml version (${FOUND_VERSION}) does not match expected version (${VERSION}), stopping" |
| 31 | + exit 1; |
| 32 | + fi |
| 33 | + - export SETTINGS_FILE=$(pwd)/codebuild/release/settings.xml |
| 34 | + - export CODEARTIFACT_TOKEN=$(aws codeartifact get-authorization-token --domain $DOMAIN --domain-owner $ACCOUNT --query authorizationToken --output text --region ${REGION}) |
| 35 | + - export CODEARTIFACT_REPO_URL=https://${DOMAIN}-${ACCOUNT}.d.codeartifact.${REGION}.amazonaws.com/maven/${REPOSITORY} |
| 36 | + - aws secretsmanager get-secret-value --region us-west-2 --secret-id Maven-GPG-Keys --query SecretBinary --output text | base64 -d > ~/mvn_gpg.tgz |
| 37 | + - tar -xvf ~/mvn_gpg.tgz -C ~ |
| 38 | + build: |
| 39 | + commands: |
| 40 | + - | |
| 41 | + mvn deploy \ |
| 42 | + -PpublishingCodeArtifact \ |
| 43 | + -DperformRelease \ |
| 44 | + -Dgpg.homedir="$HOME/mvn_gpg" \ |
| 45 | + -DautoReleaseAfterClose=true \ |
| 46 | + -Dgpg.keyname="$GPG_KEY" \ |
| 47 | + -Dgpg.passphrase="$GPG_PASS" \ |
| 48 | + -Dcodeartifact.token=$CODEARTIFACT_TOKEN \ |
| 49 | + -DaltDeploymentRepository=codeartifact::default::$CODEARTIFACT_REPO_URL \ |
| 50 | + -s $SETTINGS_FILE |
| 51 | +
|
| 52 | +batch: |
| 53 | + fast-fail: false |
| 54 | + build-graph: |
| 55 | + - identifier: release_to_staging |
| 56 | + - identifier: validate_staging_release_openjdk8 |
| 57 | + depend-on: |
| 58 | + - release_to_staging |
| 59 | + buildspec: codebuild/release/validate-staging.yml |
| 60 | + env: |
| 61 | + variables: |
| 62 | + JAVA_ENV_VERSION: openjdk8 |
| 63 | + JAVA_NUMERIC_VERSION: 8 |
| 64 | + image: aws/codebuild/standard:3.0 |
| 65 | + - identifier: validate_staging_release_openjdk11 |
| 66 | + depend-on: |
| 67 | + - release_to_staging |
| 68 | + buildspec: codebuild/release/validate-staging.yml |
| 69 | + env: |
| 70 | + variables: |
| 71 | + JAVA_ENV_VERSION: openjdk11 |
| 72 | + JAVA_NUMERIC_VERSION: 11 |
| 73 | + image: aws/codebuild/standard:3.0 |
| 74 | + - identifier: validate_staging_release_corretto8 |
| 75 | + depend-on: |
| 76 | + - release_to_staging |
| 77 | + buildspec: codebuild/release/validate-staging.yml |
| 78 | + env: |
| 79 | + variables: |
| 80 | + JAVA_ENV_VERSION: corretto8 |
| 81 | + JAVA_NUMERIC_VERSION: 8 |
| 82 | + image: aws/codebuild/amazonlinux2-x86_64-standard:3.0 |
| 83 | + - identifier: validate_staging_release_corretto11 |
| 84 | + depend-on: |
| 85 | + - release_to_staging |
| 86 | + buildspec: codebuild/release/validate-staging.yml |
| 87 | + env: |
| 88 | + variables: |
| 89 | + JAVA_ENV_VERSION: corretto11 |
| 90 | + JAVA_NUMERIC_VERSION: 11 |
| 91 | + image: aws/codebuild/amazonlinux2-x86_64-standard:3.0 |
0 commit comments