Build information
The RelativeCI agent uses env-ci to read the necessary build information from the CI environment variables.
When the agents run on a supported CI service, the following environment information is automatically collected:
slug(required) the repository slugservicethe CI service namebranch(required) the commit's corresponding branchcommit(required) commit SHAbaseBranchthe branch targeted by the the pull request(available in @relative-ci/agent@v5.1.0 and relative-ci/agent@3.1.0)prpull request numberbuildCI build numberbuildUrlCI build URLcommitMessagecommit message
Not supported CI services or non-CI environments
When the agent runs on a not-supported CI service or an environment that does not have access to the CI environment variables or git meta information, you need to provide the following environment variables:
RELATIVE_CI_SLUG - required
The GitHub repository slug
Example
Repository URL:
https://github.com/relative-ci/example-webpack-plugin-github-action
Slug:
relative-ci/example-webpack-plugin-github-action
Other environment variables
RELATIVE_CI_BRANCH
required
The commit corresponding branch name. By default, the value is read from git:
RELATIVE_CI_BRANCH="$(git rev-parse --abbrev-ref HEAD)" For jobs running inside a GitHub action during pull_request, pull_request_target, or
workflow_run, the correct branch name is read from the GitHub action event JSON.
RELATIVE_CI_COMMIT - required
The git commit SHA. By default, the value is read from git:
RELATIVE_CI_COMMIT="$(git rev-parse --short HEAD)"Docker example
from node:latest
## RelativeCI agent environment variablesARG CI=trueARG RELATIVE_CI_SERVICE="CI-SERVICE-container"ARG RELATIVE_CI_SLUGARG RELATIVE_CI_KEYARG RELATIVE_CI_BRANCHARG RELATIVE_CI_PRARG RELATIVE_CI_BASE_BRANCHARG RELATIVE_CI_BUILDARG RELATIVE_CI_BUILD_URLARG RELATIVE_CI_COMMITARG RELATIVE_CI_COMMIT_MESSAGEARG DEBUG
COPY . /appWORKDIR /app
RUN npm installRUN npm run build