AWS CodeBuild Buildspec: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 32: Line 32:
   files:
   files:
     - overrides.json
     - overrides.json
</syntaxhighlight>
</syntaxhighlight>
</syntaxhighlight>



Revision as of 06:48, 15 March 2019

External

Build Specification Reference for CodeBuild

Internal

Overview

Example

version: 0.2

env:
  variables:
    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 "..." > ./overrides.json
artifacts:
  files:
    - overrides.json

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

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