lambuild
gets configuration files from a source repository and generates buildspecs.
We call these files as lambuild.yaml
, but we can rename freely.
The format of lambuild configuration file is based on buildspec.
Please see lambuild.yaml for Batch Build
---
version: 0.2
env:
git-credential-helper: yes
lambuild:
build-status-context: "foo"
image: aws/codebuild/standard:1.0
environment-type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_SMALL
privileged-mode: true
debug-session: true
git-clone-depth: 10
report-build-status: true
items:
- FOO: foo
env:
variables:
FOO: "{{.item.Foo}}"
phases:
build:
commands:
- echo "foo"
- command: echo "main"
if: |
ref == "refs/heads/main" # main branch
path | type | example | description |
---|---|---|---|
.lambuild.env.variables | map[string](string expression) |
build's environment variables. The environment variables of .lambuild.env.variables are passed by the override option |
|
.lambuild.image | string | alpine:3.13.0 |
|
.lambuild.git-clone-depth | int | 0 |
|
.lambuild.compute-type | string | ||
.lambuild.environment-type | string | ||
.lambuild.debug-session | bool | ||
.lambuild.privileged-mode | bool | ||
.lambuild.report-build-status | bool | ||
.lambuild.items | []Item | ||
.phases.install.commands | []Command | ||
.phases.pre_build.commands | []Command | ||
.phases.build.commands | []Command | ||
.phases.post_build.commands | []Command |
type: bool expression
is a string whose evaluated result is a booleantype: string expression
is a string whose evaluated result is a stringtype: ExprList
is a list whose element is eitherstring
orExprElem
path | type | example | description |
---|---|---|---|
.value | string | ||
.if | bool expression |
path | type | example | description |
---|---|---|---|
.if | bool expression | ||
.env | map[string](string expression) |
build's environment variables | |
.build-status-context | template string | "foo ({{.event.Headers.Event}})" |
|
.image | string | aws/codebuild/standard:5.0 |
|
.compute-type | string | BUILD_GENERAL1_SMALL |
|
.environment-type | string | LINUX_CONTAINER |
|
.param | map[string]interface{} |
a parameter item of template and expression |
string or following struct
path | type | example | description |
---|---|---|---|
.command | string | echo "hello" |
|
.if | bool expression |
Command is ignored when the evaluated result of .if
is false
.
e.g.
phases:
build:
commands:
- echo "run always"
- command: bash release.sh
if: |
ref == "refs/heads/main" # main branch
e.g.
version: 0.2
env:
git-credential-helper: yes
lambuild:
build-status-context: "{{.item.name}} ({{.event.Headers.Event}})"
items:
- param:
name: foo
- param:
name: bar
env:
variables:
NAME: "{{.item.name}}"
phases:
build:
commands:
- echo "NAME: $NAME"
When .lambuild.items
is specified, a build is run per the element of .lambuild.items
.
In case of the above example, two builds (foo
and bar
) are run.
And param
field is passed to the expression and template as the variable item
.
Please see Custom Environment Variables.