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

ENV.SCRIPT_DIR variable changes depending on how a script is called #190

Open
johnaohara opened this issue Mar 29, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@johnaohara
Copy link
Member

Given the following yaml;

name: test script env
scripts:

  direct-env:
    - sh: echo ${{ENV.SCRIPT_DIR}}

  script-env:
    - script: echo-env

  script-env-async:
    - script:
        name: echo-env
        async: true

hosts:
  local-host : LOCAL
roles:
  test-cgroups:
    hosts:
      - local-host
    run-scripts:
      - direct-env
      - script-env
      - script-env-async

with the echo-env script in another yaml, i.e. core-scripts/env-script.yaml;

name: echo env
scripts:

  echo-env:
    - sh: echo ${{ENV.SCRIPT_DIR}}

${{ENV.SCRIPT_DIR}} resolution is different depending on how the echo-env script is called

12:17:42.793 [qdup-command-8] INFO  qdup._tmp_20230329_121741 - script-env:49@LOCAL:echo-env
12:17:43.200 [qdup-scheduled-1] INFO  qdup._tmp_20230329_121741 - direct-env:51@LOCAL:echo /tmp/qdup-env-scripts/.
/tmp/qdup-env-scripts/.
12:17:43.203 [qdup-scheduled-2] INFO  qdup._tmp_20230329_121741 - script-env:49@LOCAL:echo /tmp/qdup-env-scripts/core-script
/tmp/qdup-env-scripts/core-script
12:17:43.882 [qdup-command-11] INFO  qdup._tmp_20230329_121741 - script-env-async:47@LOCAL:script-cmd: echo-env
12:17:43.883 [qdup-command-4] INFO  qdup._tmp_20230329_121741 - echo-env:65@LOCAL:echo-env
12:17:44.292 [qdup-scheduled-9] INFO  qdup._tmp_20230329_121741 - echo-env:65@LOCAL:echo /tmp/qdup-env-scripts/.
/tmp/qdup-env-scripts/.

This behaviour can break scripts in sub-dirs depending on if the calling script runs the script with async: true

@johnaohara johnaohara added the bug Something isn't working label Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant