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

Fix #4676 #6030

Merged
merged 14 commits into from
Nov 15, 2023
Merged

Fix #4676 #6030

merged 14 commits into from
Nov 15, 2023

Conversation

rebrowning
Copy link
Contributor

@rebrowning rebrowning commented Oct 8, 2023

execute populating the inherited environment variables whenever the parameter is set. Currently the doesn't work for shell commands either, it relies on those commands having default parameters that would then populate the 'parameters' variable to pass that check

Closes #4676

Replicating with the steps in the issue above. It looks like if args.parameters is not set (an empty list as well) then the empty result is returned, however this happens even if args.inherit_env is set. Moved args.inherit_env before the check so that even when we're running a job with no parameters, we'll still populate the environment variables.

Let me know if this makes sense, or any edge cases we'd want to test here. This was working for the shell runners because they all have a "cmd" parameter, which was then passing the args.parameters check.

This seems straight forward but I haven't been in the code base long enough to see if the original implementation is the expected approach.

@pull-request-size pull-request-size bot added the size/XS PR that changes 0-9 lines. Quick fix/merge. label Oct 8, 2023
@rebrowning rebrowning force-pushed the fix/4676_inherit_env branch from 1601c9f to 87f1a6e Compare October 8, 2023 05:54
@guzzijones
Copy link
Contributor

add to change log please. Also can you add a unit test to cover this edge case?

@pull-request-size pull-request-size bot added size/M PR that changes 30-99 lines. Good size to review. and removed size/XS PR that changes 0-9 lines. Quick fix/merge. labels Oct 15, 2023
@rebrowning rebrowning force-pushed the fix/4676_inherit_env branch from 9b940c5 to f68d8a0 Compare October 15, 2023 22:42
…arameter is set. Currently the doesn't work for shell commands either, it relies on those commands having default parameters that would then populate the 'parameters' variable to pass that check
…we try to inherit env without any parameters
@rebrowning rebrowning force-pushed the fix/4676_inherit_env branch from f68d8a0 to 285b908 Compare October 24, 2023 03:34
Copy link
Contributor

@m4dcoder m4dcoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rebrowning Can you add new or point to an existing unit test where the action parameters are set and inherit environment is true?

… for some of the different parameters are not negatively impacted with the change
@pull-request-size pull-request-size bot added size/L PR that changes 100-499 lines. Requires some effort to review. and removed size/M PR that changes 30-99 lines. Good size to review. labels Nov 1, 2023
@pull-request-size pull-request-size bot added size/M PR that changes 30-99 lines. Good size to review. and removed size/L PR that changes 100-499 lines. Requires some effort to review. labels Nov 1, 2023
@pull-request-size pull-request-size bot added size/L PR that changes 100-499 lines. Requires some effort to review. and removed size/M PR that changes 30-99 lines. Good size to review. labels Nov 1, 2023
@rebrowning
Copy link
Contributor Author

@guzzijones Any additional requests for this PR?

Copy link
Member

@cognifloyd cognifloyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: st2 does not have anything called a "job".

Otherwise, looks like a clean fix.

st2client/tests/unit/test_command_actionrun.py Outdated Show resolved Hide resolved
st2client/tests/unit/test_command_actionrun.py Outdated Show resolved Hide resolved
@cognifloyd cognifloyd merged commit 8c77acb into StackStorm:master Nov 15, 2023
35 checks passed
@arm4b arm4b added this to the 3.8.1 milestone Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L PR that changes 100-499 lines. Requires some effort to review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

st2 run --inherit-env does not work for actions run with python-script runner
5 participants