Skip to content

Commit

Permalink
chore: changelog for #1633
Browse files Browse the repository at this point in the history
  • Loading branch information
pd93 committed Jul 16, 2024
1 parent 4b6c79a commit 1f2cbfb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
20 changes: 12 additions & 8 deletions website/docs/experiments/env_precedence.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
draft: false # Hide in production
slug: '/experiments/env-precedence'
---

Expand All @@ -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:

Expand All @@ -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'
Expand All @@ -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"}}'
```
Expand Down

0 comments on commit 1f2cbfb

Please sign in to comment.