Skip to content

Allow to use vars in matrix #2065

@DjinNO

Description

@DjinNO

Description

It is not possible to use variables in a matrix task now

version: '3'

vars:
  OS_VAR: ["windows", "linux", "darwin"]
  ARCH_VAR: ["amd64", "arm64"]

tasks:
  default:
    silent: true
    cmds:
      - for:
          matrix:
            OS: {{.OS_VAR}}
            ARCH: {{.ARCH_VAR}}
        cmd: echo "{{.ITEM.OS}}/{{.ITEM.ARCH}}"
err:  invalid keys in command
file: /Users/djinn/GIT/gitlab/gitops/installations/generator/Taskfile.yml:12:9
  10 |     silent: true
  11 |     cmds:
> 12 |       - for:
     |         ^
  13 |           matrix:
  14 |             OS: {{.OS_VAR}}

Correct me if I'm wrong

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: loopsChanges related to looping over tasks/commands.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions