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

Environment variables do not work when using cmd in tasks #1154

Closed
2 tasks done
nicornk opened this issue Apr 10, 2024 · 2 comments
Closed
2 tasks done

Environment variables do not work when using cmd in tasks #1154

nicornk opened this issue Apr 10, 2024 · 2 comments
Labels
🐞 bug Something isn't working

Comments

@nicornk
Copy link
Contributor

nicornk commented Apr 10, 2024

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

Task:

just-test = { cmd = [    
    "export STACK_NAME=fargate-batch-job",
    "&&",
    "echo $STACK_NAME"

] }
pixi run just-test
✨ Pixi task (ci): "export STACK_NAME=fargate-batch-job" && "echo $STACK_NAME"
export STACK_NAME=fargate-batch-job: command not found

Available tasks:
        build-wheel
        deploy
        download_database
        just-test
        just-test-2
        postinstall-production
        start
        test
(grayskull) (base) ➜  oligo 

Task:

just-test-2 = "export STACK_NAME=fargate-batch-job && echo $STACK_NAME"
✨ Pixi task (ci): export STACK_NAME=fargate-batch-job && echo $STACK_NAME
fargate-batch-job
(grayskull) (base) ➜  oligo 

Issue description

It seems that export / referencing environment variables in the "cmd" way to define tasks is not working as expected.

Expected behavior

Both examples should work the same way.

@nicornk nicornk added the 🐞 bug Something isn't working label Apr 10, 2024
@ruben-arts
Copy link
Contributor

This is actually because of this issue: #837

So will close it, in favor of that.

For now, either use the multi-line toml notation or separate per word in an array.

just-test = { cmd = """
    export STACK_NAME=fargate-batch-job
    &&
    echo $STACK_NAME
"""}
just-test2 = { cmd = [    
    "export",  "STACK_NAME=fargate-batch-job",
    "&&",
    "echo", "$STACK_NAME"
] }

@nicornk
Copy link
Contributor Author

nicornk commented Apr 10, 2024

ty for the quick reply!

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

2 participants