Skip to content

Task-level variables are not available from pipeline #95

@karldreher

Description

@karldreher

Encountered issue on Windows 10 using taskctl version 1.4.2.

When running the following taskctl.yaml an error is encountered:

pipelines:
  pipeline1:
    - task: task1

tasks:
  task1:
    description: "Example task 1"
    command: "echo hello {{ .message }}"
    variables: 
      message: "world"
taskctl run pipeline1
time="2022-01-12 21:16:11" level=info msg="Running task task1..."
time="2022-01-12 21:16:11" level=info msg="task1 finished. Duration 0s"
time="2022-01-12 21:16:11" level=fatal msg="pipeline pipeline1 failed: template: interpolate:1:14: executing \"interpolate\" at <.message>: map has no entry for key \"message\""

Setting the variables at a task level within pipeline map will be correctly be passed to the task level:

pipelines:
  pipeline1:
    - task: task1
      variables: 
        message: "world"

tasks:
  task1:
    description: "Example task 1"
    command: "echo hello {{ .message }}"
taskctl run pipeline1
time="2022-01-12 21:21:58" level=info msg="Running task task1..."
task1: hello
task1:
task1: world
time="2022-01-12 21:21:58" level=info msg="task1 finished. Duration 527.7µs"

Summary:
- Stage task1 was completed in 1.58ms
Total duration: 50.0753ms

I suppose after clarifying the issue it technically works, but the variables must be put into the pipeline rather than the task level. I find this slightly non-intuitive, but if it is working as designed feel free to cancel this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions