Drone provides the ability to define environment variables scoped to individual build steps. Example pipeline step with custom environment variables:
pipeline:
build:
image: golang
+ environment:
+ - CGO=0
+ - GOOS=linux
+ - GOARCH=amd64
commands:
- go build
- go test
Please note that the environment section is not able to expand environment variables. If you need to expand variables they should be exported in the commands section.
pipeline:
build:
image: golang
- environment:
- - PATH=$PATH:/go
commands:
+ - export PATH=$PATH:/go
- go build
- go test
Please be warned that ${variable}
expressions are subject to pre-processing. If you do not want the pre-processor to evaluate your expression it must be escaped:
pipeline:
build:
image: golang
commands:
- - export PATH=${PATH}:/go
+ - export PATH=$${PATH}:/go
- go build
- go test
Questions?
We are always happy to help with questions you might have. Search our documentation or check out answers to common questions. You can also post questions or comments to our community forum.
Is there a mistake on this page? Please let us know or edit this page.