Skip to content

Env var doesn't work at start of string, but does in the middle #642

Closed
@ambis

Description

  • Task version: 3.9.2
  • Operating System: macOS 12.1

When a global vars value starts with a dollar/variable, task fails. I have tried escaping it with $$ and \$ but no help.

Example Taskfile showing the issue (version that works)

version: '3'
vars:
  FOO: "does work ${FOO}"
tasks:
  default:
    cmds:
      - echo {{.FOO}}

When you run the above taskfile:

FOO=yes task -t Taskfile.works.yml
task: [default] echo does work ${FOO}
does work yes

Example Taskfile showing the issue (version that does NOT work)

version: '3'
vars:
  FOO: "${FOO} <- does not work"
tasks:
  default:
    cmds:
      - echo {{.FOO}}

When you run the above taskfile:

FOO=nowork task -t Taskfile.nowork.yml
open /tmp/-: no such file or directory
task: Command "{FOO} <- does not work" failed: exit status 1
exit 1

My usecase which fails:

TAG: "${CI_REGISTRY_IMAGE}:latest"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions