Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using {{.USER_WORKING_DIR}} causes failure "no such file or directory" #1293

Closed
gberenice opened this issue Aug 2, 2023 · 0 comments · Fixed by #1309
Closed

Using {{.USER_WORKING_DIR}} causes failure "no such file or directory" #1293

gberenice opened this issue Aug 2, 2023 · 0 comments · Fixed by #1309
Labels
area: variables Changes related to variables. type: bug Something not working as intended.

Comments

@gberenice
Copy link

Hey!
We're working on reusable tasks to be able to run the same tasks from different Terraform configuration directories.

The content of my root Taskfile is:

version: "3"

includes:
  terraform:
    taskfile: ./taskfiles/terraform
    aliases: [tf]

My terraform taskfile looks like:

  init:
    silent: true
    # dir: "{{.USER_WORKING_DIR}}"
    vars:
      ENV:
        sh: echo "{{.CLI_ARGS}}" | cut -d ' ' -f1 | xargs
      TF_ARGS:
        sh: echo "{{.CLI_ARGS}}" | cut -s -d ' ' -f2- | xargs
      BACKEND_CONFIG_FILE:
        sh: echo "./backend-configurations/{{.ENV}}.backend.tf"
    preconditions:
      - sh: test -f {{.BACKEND_CONFIG_FILE}}
        msg: "Backend configuration file does not exist: {{.BACKEND_CONFIG_FILE}}"
    cmds:
      - terraform init -backend-config {{.BACKEND_CONFIG_FILE}} {{.TF_ARGS}}

When uncommenting and enabling dir: "{{.USER_WORKING_DIR}}", task run fails with a weird error:

task: Command "echo "automation" | cut -d ' ' -f1 | xargs" failed: chdir /Users/gberenice/work/mp/infra/Users/gberenice/work/mp/infra/components/network: no such file or directory

I run this task from /Users/gberenice/work/mp/infra/components/network, while /Users/gberenice/work/mp/infra/ is a directory where my root Taskfile.yaml is located.

If I set dir equal to a specific directory, everything works as expected. Please advise.

  • Task version: 3.28.0
  • Operating system: macOS 13.4
  • Experiments enabled: no
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Aug 2, 2023
andreynering added a commit that referenced this issue Aug 18, 2023
andreynering added a commit that referenced this issue Aug 18, 2023
Closes #1046
Closes #1205
Closes #1250
Closes #1293
Closes #1274
Closes #1309

Co-authored-by: Marcus Spading <ms@fragmentum.net>
@andreynering andreynering added type: bug Something not working as intended. area: variables Changes related to variables. and removed state: needs triage Waiting to be triaged by a maintainer. labels Aug 18, 2023
andreynering added a commit that referenced this issue Aug 26, 2023
Closes #1046
Closes #1205
Closes #1250
Closes #1293
Closes #1274
Closes #1309
Closes #1312

Co-authored-by: Marcus Spading <ms@fragmentum.net>
andreynering added a commit that referenced this issue Aug 26, 2023
Closes #1046
Closes #1205
Closes #1250
Closes #1293
Closes #1274
Closes #1309
Closes #1312

Co-authored-by: Marcus Spading <ms@fragmentum.net>
andreynering added a commit that referenced this issue Aug 26, 2023
Closes #1046
Closes #1205
Closes #1250
Closes #1293
Closes #1274
Closes #1309
Closes #1312

Co-authored-by: Marcus Spading <ms@fragmentum.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: variables Changes related to variables. type: bug Something not working as intended.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants