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

TASK_X_ENV_PRECEDENCE is broken #1829

Closed
lukejoshuapark opened this issue Sep 21, 2024 · 2 comments
Closed

TASK_X_ENV_PRECEDENCE is broken #1829

lukejoshuapark opened this issue Sep 21, 2024 · 2 comments

Comments

@lukejoshuapark
Copy link

  • Task version: 3.39.2
  • Operating system: Linux (inside container)
  • Experiments enabled: TASK_X_ENV_PRECEDENCE

Please see this reproduction of the issue: https://github.com/lukejoshuapark/task-env-issue-reproduce

When executing ./run.sh, I would have expected to see

task: [dir1:run] echo $FOO $BAR
Hello World
task: [dir2:run] echo $FOO $BAR
Hello World
task: [dir1:run] echo $FOO $BAR
Hello World                                        # Note this correctly says "Hello World"
task: [dir2:run] echo $FOO $BAR
World World

But instead, I am seeing

task: [dir1:run] echo $FOO $BAR
Hello World
task: [dir2:run] echo $FOO $BAR
Hello World
task: [dir1:run] echo $FOO $BAR
World World                                      # Why has $FOO been modified in the scope of dir1???
task: [dir2:run] echo $FOO $BAR
World World

This may not be the simplest form of the reproduction but it mimics the scenario under which I experienced it.

@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Sep 21, 2024
@mgbowman
Copy link
Contributor

I think what you're seeing is expected behavior as global / file-level variables are not scoped.

If you move the env declaration to dir2:run task level, it should work as expected.

@lukejoshuapark
Copy link
Author

@mgbowman thanks for that, I thought they were scoped to the file they were defined in.

@task-bot task-bot removed the state: needs triage Waiting to be triaged by a maintainer. label Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants