When a task starts as part of your pipeline Sail CI mounts a set of default environment variables for every task:
Set to "true" so that tools and tasks can behave differently in the context of continuous integration.
Absolute path of the repository cloned.
Full git ref for the cloned repository, you can read more at https://git-scm.com/book/en/v2/Git-Internals-Git-References.
Branch for the commit cloned taken from the GIT_REF, for example, a git ref of "refs/heads/master" sets SAIL_COMMIT_BRANCH as "master".
Organisation or username for a repository, for example, https://github.com/sailci/demo sets SAIL_REPO_OWNER to "sailci".
Name for a repository, for example, https://github.com/sailci/demo sets SAIL_REPO_NAME to "demo".
Full SHA of the commit cloned an example would look similar to "70460b4b4aece5915caf5c68d12f560a9fe3e4".
Short SHA of the commit cloned consisting of the first seven characters, in the example above SAIL_COMMIT_SHORT_SHA is set to "70460b4".
Number of pull request being built.
Pull request repositories owner, for example, https://github.com/sailci/demo sets SAIL_PULL_REQUEST_REPO_OWNER to "sailci".
Title for the pull request being built.
Full url that links to the pull request being built.
Helps determine a context for the environment a task runs. Useful for tasks requiring different behaviour based on the CI running it. Always set to "true".
To add environment variables you need to use the Sail CI web application at https://app.sail.ci/
To use environment variables within any part of your task properties such as "image", "command", "args" and "env" wrap the environment variable you wish to use with $(), for example, $(GIT_SHA).
Sail CI provides incredible flexibility to map and use environment variables for a pipeline task. We have broken down how you can use them:
Hardcoded Environment Variables Values
For any given task you can map using a key and hardcoded value. Sail CI mounts these as specified into the task.
- CUSTOM_ENV_VAR: "Hardcoded Value"
Custom Environment Variables
For any created environment variable (see "Adding New Environment Variables") you can specify keys and provide no value, Sail CI mounts them into the task automatically.
Re-Mapping Environment Variables
You can map custom environment variables to a different name using the interpolation syntax (see Use Environment Variables in Task Properties). Set the value of the env variable using $(CUSTOM_VAR) syntax.
- CUSTOM_ENV_VAR: $(OTHER_CUSTOM_VAR)
- CUSTOM_GIT_SHA_VAR: $(GIT_SHA)
Builds for forked repositories that raise pull requests will not allow any custom environment variables to be attached to a task. Hardcoded values and re-mapping of Sail CI default environment variables are still available.