@relative-ci/agent build information

Build information

The RelativeCI webpack-plugin and CLI use 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 details are automatically collected:

  • slug (required) the repository slug
  • service the CI service name
  • branch (required) the commit's corresponding branch
  • pr pull request number
  • build CI build number
  • buildUrl CI build URL
  • commit (required) commit SHA
  • commitMessage commit 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 corresponding branch name. By default, the value is read from git:

RELATIVE_CI_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
RELATIVE_CI_COMMIT - required

The git commit SHA. By default, the value is read from git:

RELATIVE_CI_COMMIT="$(git rev-parse --short HEAD)"
RELATIVE_CI_SERVICE

The CI service name (e.g.: github-docker).

RELATIVE_CI_PR

The corresponding pull request number.

RELATIVE_CI_BUILD

The CI build number

RELATIVE_CI_BUILD_URL

The CI build URL

RELATIVE_CI_COMMIT_MESSAGE

The git commit message. When includeCommitMessage is set to true, the value is read from git:

RELATIVE_CI_COMMIT_MESSAGE="$(git log -1 --pretty=%B)"

Docker example

from node:latest
## RelativeCI agent environment variables
ARG CI=true
ARG RELATIVE_CI_SERVICE="CI-SERVICE-container"
ARG RELATIVE_CI_SLUG
ARG RELATIVE_CI_KEY
ARG RELATIVE_CI_BRANCH
ARG RELATIVE_CI_PR
ARG RELATIVE_CI_BUILD
ARG RELATIVE_CI_BUILD_URL
ARG RELATIVE_CI_COMMIT
ARG RELATIVE_CI_COMMIT_MESSAGE
ARG DEBUG
COPY . /app
WORKDIR /app
RUN npm install
RUN npm run build