1
0
mirror of https://github.com/go-task/task.git synced 2025-08-10 22:42:19 +02:00
Files
task/testdata/env/Taskfile.yml
rohm1 24a830e384 fix: forward env to RunCommand when evaluating sh vars (#1869)
* forward env to RunCommand when evaluating sh vars. fixes #1742

* feat: added tests

* fix: test

---------

Co-authored-by: Pete Davison <pd93.uk@outlook.com>
2025-01-02 20:07:25 +00:00

62 lines
1.0 KiB
YAML

version: '3'
vars:
BAZ:
sh: echo baz
env:
FOO: foo
BAR: bar
BAZ: "{{.BAZ}}"
QUX: from_taskfile
tasks:
default:
cmds:
- task: local
- task: global
- task: not-overridden
- task: multiple_type
- task: dynamic
local:
vars:
AMD64: amd64
env:
GOOS: linux
GOARCH: "{{.AMD64}}"
CGO_ENABLED:
sh: echo '0'
cmds:
- echo "GOOS='$GOOS' GOARCH='$GOARCH' CGO_ENABLED='$CGO_ENABLED'" > local.txt
global:
env:
BAR: overridden
cmds:
- echo "FOO='$FOO' BAR='$BAR' BAZ='$BAZ'" > global.txt
multiple_type:
env:
FOO: 1
BAR: true
BAZ: 1.1
cmds:
- echo "FOO='$FOO' BAR='$BAR' BAZ='$BAZ'" > multiple_type.txt
not-overridden:
cmds:
- echo "QUX='$QUX'" > not-overridden.txt
overridden:
cmds:
- echo "QUX='$QUX'" > overridden.txt
dynamic:
silent: true
vars:
DYNAMIC_FOO:
sh: echo $FOO
cmds:
- echo "{{ .DYNAMIC_FOO }}" > dynamic.txt