-
-
Notifications
You must be signed in to change notification settings - Fork 763
Closed as not planned
Labels
state: invalidThis doesn't seem right.This doesn't seem right.
Description
Description
Consider the following Taskfile:
version: '3'
dev_ws: &dev_ws
- dev-user-1
- dev-user-2
tasks:
foo:
cmds:
- for:
matrix:
ENV:
- dev
- prod
WS: *dev_ws
silent: true
cmd: |
echo +++ {{.ITEM.ENV}} {{.ITEM.WS}}If I run it, I get:
$ task -t foo.yml foo
err: matrix values must be an array or a reference
file: foo.yml:14:13
12 | - for:
13 | matrix:
> 14 | ENV:
| ^
15 | - dev
16 | - prod
On the other hand, the input file is correct YAML. If I ask yq (https://github.com/mikefarah/yq) to expand the YAML anchor, I get:
$ yq 'explode(.)' < foo.yml
version: '3'
dev_ws:
- dev-user-1
- dev-user-2
tasks:
foo:
cmds:
- for:
matrix:
ENV:
- dev
- prod
WS:
- dev-user-1
- dev-user-2
silent: true
cmd: |
echo +++ {{.ITEM.ENV}} {{.ITEM.WS}}
and the irony, if I pass the output of yq to the stdin of Task, I get what I expected:
$ yq 'explode(.)' < foo.yml | task -t - foo
+++ dev dev-user-1
+++ dev dev-user-2
+++ prod dev-user-1
+++ prod dev-user-2
Version
3.43.2
Operating system
macOS, Linux
Experiments Enabled
None.
Example Taskfile
version: '3'
dev_ws: &dev_ws
- dev-user-1
- dev-user-2
tasks:
foo:
cmds:
- for:
matrix:
ENV:
- dev
- prod
WS: *dev_ws
silent: true
cmd: |
echo +++ {{.ITEM.ENV}} {{.ITEM.WS}}Thank you for Task! :-)
iAmoric, aliculPix4D and SpectreVert
Metadata
Metadata
Assignees
Labels
state: invalidThis doesn't seem right.This doesn't seem right.