Docker image
Computer type
Default environment variables
https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
$CODEBUILD_SRC_DIR
Background tasks
Use "nohup" & "disown", see https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-background-tasks.html
Local testing
https://docs.aws.amazon.com/codebuild/latest/userguide/use-codebuild-agent.html
https://hub.docker.com/r/amazon/aws-codebuild-local/
Just download the command line script and run with an image and an output folder. If want to use Amazon curated image, download from link below and build the image locally.
https://github.com/aws/aws-codebuild-docker-images
https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html
version: 0.2run-as: Linux-user-nameenv: variables: key: "value" key: "value" parameter-store: key: "value" key: "value" phases: install: run-as: Linux-user-name commands: - command - command finally: - command - command pre_build: run-as: Linux-user-name commands: - command - command finally: - command - command build: run-as: Linux-user-name commands: - command - command finally: - command - command post_build: run-as: Linux-user-name commands: - command - command finally: - command - commandartifacts: files: - location - location - name discard-paths: yes base-directory: location secondary-artifacts: artifactIdentifier: files: - location - location discard-paths: yes base-directory: location artifactIdentifier: files: - location - location discard-paths: yes base-directory: locationcache: paths: - path - pathversion: "0.2" recommended, version of the spec format
run-as: optional, by default root, linux only, can also be provided in a phrase block
env: optional
variables: required in env, environment variables, not recommended for secrets
parameter-store: Amazon EC2 Systems Manager Parameter Store values, secret ok
phases:
[name]: allowed phases include:
run-as: optional, default root or the build spec global run-as
commands: commands to run
finally: optional, commands to run even (no matter) any command in "commands" fail
artifacts: optional (not required if product is pushed to registry or just running tests)
files: required, paths
discard-paths: optional
base-directory: optional, alternative base-dir
secondary-artifacts: optional, more artifacts to different destinations
name: optional, can be like "myname-$(date +%Y-%m-%d)"
cache: optional
VPC
Jenkins integration
Monitoring
Triggers - timers for build