Skip to content

Requires returns inconsistent results for dynamic variables depending upon whether or not enum is specified #2032

@mmiddletonatua

Description

@mmiddletonatua

Description

Running the task as defined in the example results in the error:

task: Task "init_env" cancelled because it is missing required variables:
  - ENVIRONMENT has an invalid value : '' (allowed values : [dev stage prod])

Changing the requires section to:

    requires:
      vars: [ENVIRONMENT]

results in the expected behavior:
task: [init_env] echo ENVIRONMENT is dev
ENVIRONMENT is dev

This appears to be a regression as things previously behaved as expected.

Version

3.41.0

Operating system

Ubuntu 22.04.1

Experiments Enabled

No response

Example Taskfile

version: '3'

vars:
  ENVIRONMENT:
    sh: basename a/directory/named/dev

tasks:
  init_env:
    cmds:
      - echo ENVIRONMENT is {{.ENVIRONMENT}}

    requires:
      vars:
      - name: ENVIRONMENT
        enum: [dev, stage, prod]

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions