This is an idea for the next major version, and would be a breaking change.
Nowadays both variables and envs are accessed as Go template values, like this:
{{.MY_VARIABLE}}
{{.MY_ENV}}
This have a couple of drawbacks:
- Variables need to be declared in an specific order if you want to include one into another:
FOO: foo
FOOBAR: '{{.FOO}}bar'
FOOBARBAZ: '{{.FOOBAR}}baz'
-
Variables and envs are mixed, and this often generate a bit of confusion to users.
-
Shell variables are always computed, even when they are not being used.
- We also currently cache them, which can be annoying if the user want to calculate it again on every call. On the current implementation removing the cache would not be a good idea, though, because it would calculate these multiple times unnecessarily.
This proposal to have two template functions called var and env to access these values:
MY_VARIABLE: '{{var "MY_VARIABLE"}}'
MY_ENV: '{{env "MY_ENV"}}'
As part of these proposal, environment variables would stop being added to variables, so you need to really call env if you want an env.
This is an idea for the next major version, and would be a breaking change.
Nowadays both variables and envs are accessed as Go template values, like this:
This have a couple of drawbacks:
Variables and envs are mixed, and this often generate a bit of confusion to users.
Shell variables are always computed, even when they are not being used.
This proposal to have two template functions called
varandenvto access these values:As part of these proposal, environment variables would stop being added to variables, so you need to really call
envif you want an env.