AWS CodeBuild Buildspec: Difference between revisions
Jump to navigation
Jump to search
Line 71: | Line 71: | ||
==artifacts== | ==artifacts== | ||
If this build [[AWS_CodePipeline_Concepts#Build|is driven by CodePipeline]], the artifacts declared here are placed into the CodePipeline Output Artifact folder. | If this build [[AWS_CodePipeline_Concepts#Build|is driven by CodePipeline]], the artifacts declared here are placed, as S3 objects, into the CodePipeline Build action's Output Artifact, which is an S3 "folder". For more details about CodePipeline output artifacts, see: {{Internal|AWS_CodePipeline_Concepts#Artifacts|CodePipeline Artifacts}} | ||
===files=== | ===files=== |
Revision as of 22:11, 17 March 2019
External
Internal
Overview
Example
version: 0.2
env:
variables:
CLOUDFORMATION_DEPLOYMENT_CONFIG_FILE: "cloudformation-deployment-configuration.json"
SOME_VARIABLE: "some value"
phases:
install:
commands:
- echo "'install' phase started on $(date)"
build:
commands:
- echo "'build' phase started on $(date)"
post_build:
commands:
- echo "'post_build' phase started on $(date)"
- echo "{\"Parameters\":{\"MyConfigurationParameterA\":\"blue\", \"MyConfigurationParameterB\":\"red\"}}" > ./${CLOUDFORMATION_DEPLOYMENT_CONFIG_FILE}
artifacts:
files:
- ${CLOUDFORMATION_DEPLOYMENT_CONFIG_FILE}
Structure
version
env
variables
This section sets environment variables that will propagate to the container that performs the build:
env:
variables:
MY_VARIABLE: 'some value'
phases
install
commands
build
commands
post_build
commands
artifacts
If this build is driven by CodePipeline, the artifacts declared here are placed, as S3 objects, into the CodePipeline Build action's Output Artifact, which is an S3 "folder". For more details about CodePipeline output artifacts, see:
files
Examples
Verifying that an Environment Variable is Set
... phases: install: commands: - if [ -z "${AWS_REGION}" ]; then echo "AWS_REGION variable not set" 1>&2; exit 1; fi