woodpecker/doc/build/env.md

38 lines
1.2 KiB
Markdown
Raw Normal View History

2015-07-08 07:06:19 +00:00
# Variables
2015-07-08 01:08:43 +00:00
The build environment has access to the following environment variables:
* `CI=true`
* `DRONE=true`
* `DRONE_REPO` - repository name for the current build
* `DRONE_BUILD` - build number 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
## Private Variables
2015-08-20 19:42:13 +00:00
You may also store encrypted, private variables in the `.drone.yml` and inject at runtime. Private variables are encrypted using RSA encryption with OAEP (see [EncryptOAEP](http://golang.org/pkg/crypto/rsa/#EncryptOAEP)). You can generate encrypted strings from your repository settings screen.
Once you have an ecrypted string, you can add the encrypted variable to the `secure` section of the `.drone.yml`. These variables are decrypted and injected into the `.drone.yml` at runtime using the `$$` notation.
2015-07-08 01:08:43 +00:00
An example `.drone.yml` expecting the `HEROKU_TOKEN` private variable:
```yaml
build:
image: golang
commands:
- go get
- go build
- go test
2015-07-10 00:01:03 +00:00
deploy:
2015-07-08 01:08:43 +00:00
heroku:
app: pied_piper
token: $$HEROKU_TOKEN
2015-08-20 19:42:13 +00:00
secure:
HEROKU_TOKEN: <encrypted string>
2015-07-08 01:08:43 +00:00
```