2015-07-08 07:06:19 +00:00
# Variables
2015-07-08 01:08:43 +00:00
2015-09-08 00:45:21 +00:00
Drone injects the following namespaced environment variables into every build:
2015-07-08 01:08:43 +00:00
* `DRONE=true`
* `DRONE_REPO` - repository name for the current build
* `DRONE_BRANCH` - branch name for the current build
* `DRONE_COMMIT` - git sha for the current build
* `DRONE_DIR` - working directory for the current build
2015-09-08 00:45:21 +00:00
* `DRONE_BUILD_NUMBER` - build number for the current build
* `DRONE_PULL_REQUEST` - pull request number fo the current build
* `DRONE_JOB_NUMBER` - job number for the current build
2015-10-27 20:21:01 +00:00
* `DRONE_TAG` - tag name for the current build
2015-07-08 01:08:43 +00:00
2015-09-08 00:45:21 +00:00
Drone also injects `CI_` prefixed variables for compatibility with other systems:
2015-07-08 01:08:43 +00:00
2015-09-08 00:45:21 +00:00
* `CI=true`
* `CI_NAME=drone`
* `CI_REPO` - repository name of the current build
* `CI_BRANCH` - branch name for the current build
* `CI_COMMIT` - git sha for the current build
* `CI_BUILD_NUMBER` - build number for the current build
* `CI_PULL_REQUEST` - pull request number fo the current build
* `CI_JOB_NUMBER` - job number for the current build
* `CI_BUILD_DIR` - working directory for the current build
* `CI_BUILD_URL` - url for the current build
2015-10-27 20:21:01 +00:00
* `CI_TAG` - tag name for the current build
2015-07-08 01:08:43 +00:00
2015-08-20 19:42:13 +00:00
2015-09-08 00:45:21 +00:00
## Injecting
2015-07-08 01:08:43 +00:00
2015-09-08 00:45:21 +00:00
A subset of variables may be injected directly into the Yaml at runtime using the `$$` notation:
2015-07-08 01:08:43 +00:00
2015-10-28 22:39:19 +00:00
* `$$COMMIT_SHORT` git sha for the current build, `--short` format
* `$$COMMIT` git sha for the current build, long format
2015-09-08 00:45:21 +00:00
* `$$BRANCH` git branch for the current build
* `$$REPO` repository full name (in `owner/name` format)
2015-10-27 20:21:01 +00:00
* `$$TAG` tag name
2015-07-08 01:08:43 +00:00
2015-09-08 00:45:21 +00:00
This is useful when you need to dynamically configure your plugin based on the current build. For example, we can alter an artifact name to include the branch:
2015-08-20 19:42:13 +00:00
2015-09-08 00:45:21 +00:00
```
publish:
s3:
source: ./foo.tar.gz
target: ./foo-$$BRANCH.tar.gz
2015-07-08 01:08:43 +00:00
```