buildkite / feedback

Got feedback? Please let us know!
https://buildkite.com
25 stars 24 forks source link

pipeline.yml environment variable precedence unintuitive #344

Closed carldjohnston closed 5 years ago

carldjohnston commented 6 years ago

Hi Buildkiters,

Just hit some unintuitive behaviour with environment variable precedence in a pipeline.yml file.

I was expecting that I could define default environment variables in the env: block at the root of the pipeline.yml fine, and override these within each step.

Your docs are correct, and define the actual behaviour, whereby you define a top level env: block, and this is applied to the entire pipeline, ignoring any step specific env: definitions; this feels opposite to what should happen.

Defining an environment variable at the top of your yaml file will set that variable on each of the command steps in the pipeline, and is equivalent to setting the env attribute on every step. This will override what is set in the env attribute of an individual step.

I understand that it would be hard to change this in a minor release, but it might make sense to be able to define a default_env: at the root of the pipeline.yml file, and then be able to override these settings in each step, or fix the behaviour and introduce a breaking change.

Cheers,

Carl

lox commented 6 years ago

I understand that it would be hard to change this in a minor release

Yup, that has largely been our concern. General consensus is that it's confusing enough that we'll figure out a way to make the change.

Apologies, and thanks for the well articulated issue.

keithpitt commented 5 years ago

@carldjohnston 👋 sorry for the super long delay on following up on this! Just wanted to give you a heads up that our new YAML defined steps in the Buildkite UI gear fixes the precedence: https://forum.buildkite.community/t/defining-pipeline-build-steps-with-yaml/79

It now works as you expected it did :)