Add extra information of your AWS CodeBuild build via environment variables.
Add the following commands to the install
or pre_build
phase of your buildspec, as below:
version: 0.2
phases:
install:
commands:
- curl -fsSL -o /tmp/install https://raw.githubusercontent.com/alessandrobologna/aws-codebuild-extras/master/install
- . /tmp/install
build:
commands:
- env
NAME | VALUE |
---|---|
CI | true |
CODEBUILD | true |
CODEBUILD_GIT_AUTHOR | Committer Name |
CODEBUILD_GIT_AUTHOR_EMAIL | user@example.com |
CODEBUILD_GIT_BRANCH | branch name |
CODEBUILD_GIT_COMMIT | commit hash |
CODEBUILD_GIT_SHORT_HASH | commit short hash |
CODEBUILD_GIT_MESSAGE | commit message |
CODEBUILD_GIT_TAG | git tag |
CODEBUILD_PROJECT | project |
CODEBUILD_PULL_REQUEST | Pull request number |