Skip to content

Allow values inside collection-type variables to reference one another #1544

Description

@pd93

Relates to:

The issues above were fixed in #1526. However, this still left the issue described in #1415 (comment) unresolved. This issue is to track the functionality described there.


It is possible to use variables inside other collection-type variables. However, you are not currently able to refer to a key within the same collection-type variable in another key. For example:

version: '3'

vars:
  foo: "foo"
  bar:
    works: "{{.foo}}" # Refers to a value in a different variable
  baz:
    qux: "qux"
    works: "{{.bar.works}}" # Refers to a nested value in a different variable
    fails: "{{.baz.qux}}" # Refers to a nested value in THE SAME variable

tasks:
  works:
    cmds:
      - echo {{.bar.works}}
      - echo {{.baz.works}}
  fails:
    cmds:
      - echo {{.baz.fails}}
❯ TASK_X_ANY_VARIABLES=1 taskd --dir ./tmp/foo works
task: [works] echo foo
foo
task: [works] echo foo
foo
❯ TASK_X_ANY_VARIABLES=1 taskd --dir ./tmp/foo fails
task: [fails] echo 
# Prints nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    No fields configured for feature.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions