mirror of
https://github.com/go-task/task.git
synced 2025-01-04 03:48:02 +02:00
chore: changelog for #1633
This commit is contained in:
parent
4b6c79aca5
commit
1f2cbfb932
@ -2,6 +2,9 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Added
|
||||
[Env Precedence Experiment](https://taskfile.dev/experiments/env-precedence)
|
||||
(#1038, #1633 by @vmaerten).
|
||||
- Added a CI lint job to ensure that the docs are updated correctly (#1719 by
|
||||
@vmaerten).
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
---
|
||||
draft: false # Hide in production
|
||||
slug: '/experiments/env-precedence'
|
||||
---
|
||||
|
||||
@ -23,13 +22,15 @@ This experiment breaks the following functionality:
|
||||
|
||||
:::info
|
||||
|
||||
To enable this experiment, set the environment variable: `TASK_X_ENV_PRECEDENCE=1`.
|
||||
Check out [our guide to enabling experiments ][enabling-experiments] for more
|
||||
information.
|
||||
To enable this experiment, set the environment variable:
|
||||
`TASK_X_ENV_PRECEDENCE=1`. Check out [our guide to enabling
|
||||
experiments][enabling-experiments] for more information.
|
||||
|
||||
:::
|
||||
|
||||
Before this experiment, the OS variable took precedence over the task environment variable. This experiment changes the precedence to make the task environment variable take precedence over the OS variable.
|
||||
Before this experiment, the OS variable took precedence over the task
|
||||
environment variable. This experiment changes the precedence to make the task
|
||||
environment variable take precedence over the OS variable.
|
||||
|
||||
Consider the following example:
|
||||
|
||||
@ -43,9 +44,11 @@ tasks:
|
||||
cmds:
|
||||
- echo "$KEY"
|
||||
```
|
||||
Running `KEY=some task` before this experiment, the output would be `some`, but after this experiment, the output would be `other`.
|
||||
Running `KEY=some task` before this experiment, the output would be `some`, but
|
||||
after this experiment, the output would be `other`.
|
||||
|
||||
If you still want to get the OS variable, you can use the template function env like follow : `{{env "OS_VAR"}}`.
|
||||
If you still want to get the OS variable, you can use the template function env
|
||||
like follow : `{{env "OS_VAR"}}`.
|
||||
|
||||
```yml
|
||||
version: '3'
|
||||
@ -60,7 +63,8 @@ tasks:
|
||||
```
|
||||
Running `KEY=some task`, the output would be `other` and `some`.
|
||||
|
||||
Like other variables/envs, you can also fall back to a given value using the default template function:
|
||||
Like other variables/envs, you can also fall back to a given value using the
|
||||
default template function:
|
||||
```yml
|
||||
MY_ENV: '{{.MY_ENV | default "fallback"}}'
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user