Created
March 14, 2020 06:00
-
-
Save dacci/a7f06ab7eb4882afad21b5248fdfc1c6 to your computer and use it in GitHub Desktop.
AWS CodeBuild build spec for CloudFormation template project.
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
| version: 0.2 | |
| phases: | |
| install: | |
| runtime-versions: | |
| python: 3.8 | |
| commands: | |
| - pip install cfn-lint | |
| - cfn-lint -I -u | |
| pre_build: | |
| commands: | |
| - export PROJECT_NAME=$(echo ${CODEBUILD_BUILD_ID} | cut -d ':' -f 1) | |
| - export VERSION=$(basename ${CODEBUILD_SOURCE_VERSION}) | |
| - export ARTIFACT_PREFIX=${PROJECT_NAME}/${VERSION} | |
| build: | |
| commands: | |
| - cfn-lint -I src/* | |
| post_build: | |
| commands: | |
| - | | |
| aws cloudformation package \ | |
| --template-file src/input.yaml \ | |
| --s3-bucket ${ARTIFACT_BUCKET} \ | |
| --s3-prefix ${ARTIFACT_PREFIX} \ | |
| --output-template-file output.yaml | |
| - | | |
| aws s3 cp \ | |
| output.yaml \ | |
| s3://${ARTIFACT_BUCKET}/${ARTIFACT_PREFIX}/ \ | |
| --cache-control no-cache |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment