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

[feature] Allow env var substition to work with tokens #985

Closed
philippeauriach opened this issue Jul 28, 2023 · 8 comments
Closed

[feature] Allow env var substition to work with tokens #985

philippeauriach opened this issue Jul 28, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@philippeauriach
Copy link

Is your feature request related to a problem? Please describe.

I want to derive env variable from the current project name. For example, in every project, I have a SENTRY_PROJECT env variable, derived from the moon project's name.

Describe the solution you'd like

I would like to be able to write:

  build:
    platform: system
    command: echo $SENTRY_PROJECT # this prints `myproject-${project}` without interpreting
    env:
      SENTRY_PROJECT: "myproject-${project}"

Describe alternatives you've considered

For now I'm getting out of it using :

  build:
    platform: system
    command: export SENTRY_PROJECT=myproject-$project && mycommandtobuild

Additional context

Env doc talks about substition and tells us "only variables in the current process can be referenced" => I guess that "tokens" are not considered variables in the current process, or maybe am I missing something ?

@philippeauriach philippeauriach added the enhancement New feature or request label Jul 28, 2023
@milesj
Copy link
Collaborator

milesj commented Jul 28, 2023

Good news, this is already implemented and will be released in the next version.

@philippeauriach
Copy link
Author

Excellent news, thanks !

@milesj
Copy link
Collaborator

milesj commented Jul 31, 2023

@milesj milesj closed this as completed Jul 31, 2023
@philippeauriach
Copy link
Author

Hello @milesj, I just checked with 1.11 and it does not seem to work with variable replacements in ENV variables :

  test-replacement:
    platform: system
    command: echo $TEST_REPLACEMENT
    env:
      TEST_REPLACEMENT: test-${project}

This will output test-${project}

Regarding the release notes "unlocked features", it seems to only mention variable substition in tasks commands, not in env variables.

@milesj milesj reopened this Aug 8, 2023
@milesj
Copy link
Collaborator

milesj commented Aug 8, 2023

Yeah you're right, I misread this post and got it confused with another. Let me look into this again.

@milesj
Copy link
Collaborator

milesj commented Aug 15, 2023

Tokens will be supported in the next release: #997

@milesj
Copy link
Collaborator

milesj commented Aug 19, 2023

Ok, now in 1.12

@philippeauriach
Copy link
Author

Working great, thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants