-
Notifications
You must be signed in to change notification settings - Fork 213
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
enable steps to define environment variables #1918
Conversation
575f4d0
to
120cf77
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Just a couple things need to be addressed first:
- main is for our stable release, v0.38, and we are only merging high priority patches into that branch. Pull requests with new features should target release/v1.
- This adds support for allowing mixins to set environment variables but at this point a user couldn't actually try out the feature yet. What we normally do is have the exec mixin implement new features added to the builder package, demonstrating how it works and vetting the implementation.
- We also need documentation showing how it works, this is usually what the mixin authors will copy when they look at the exec mixin and incorporate the changes necessary to support a new feature (like setting env vars). Here's the exec mixin page that should be updated to include how to set an env var in its supported syntax section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
_, err := ExecuteStep(c.Context, step) | ||
require.NoError(t, err, "Execute Step failed") | ||
containsEnv := strings.Contains(c.GetOutput(), "SOME_VAR_123=foo") | ||
// use assert.True rather than assert.Contains so that the env vars are not all sent to the test output. There might |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hadn't considered that, good call! 👍
Signed-off-by: David Justice <[email protected]>
@@ -72,6 +72,13 @@ | |||
"type": "string" | |||
} | |||
}, | |||
"envs": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A million brownie points for remembering to update the schema that VS Code uses to do autocomplete 💯
You can fix the broken unit test by running |
Yep. Thank you for having the prompt in test failure output. That was super helpful. |
/azp run porter-integration |
Commenter does not have sufficient privileges for PR 1918 in repo getporter/porter |
Signed-off-by: David Justice <[email protected]>
What does this change
This change add the ability for steps to add environment variables to be added to the env when executing the command for a step.
This change is related to getporter/az-mixin#38. With this change, the mixin could add the user-agent env var to the command.
Notes for the reviewer
This is my first contribution here, so please let me know if I missed / misunderstood something.
Checklist
Reviewer Checklist