-
Notifications
You must be signed in to change notification settings - Fork 198
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
Propagate env vars $PATH
and $HOME
for input_type: external
#864
Merged
ramaro
merged 2 commits into
kapicorp:master
from
projectsyn:feat/input-type-external-propagate-path-home
Oct 25, 2022
Merged
Propagate env vars $PATH
and $HOME
for input_type: external
#864
ramaro
merged 2 commits into
kapicorp:master
from
projectsyn:feat/input-type-external-propagate-path-home
Oct 25, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@simu would you please mind to change the docs as well? |
For compile objects with `input_type: external`, the external command is executed with `subprocess.run()` with keyword parameter `env`. By providing this keyword parameter, the command will not inherit Kapitan's `os.environ`, as documented in https://docs.python.org/3/library/subprocess.html: > If env is not None, it must be a mapping that defines the environment > variables for the new process; these are used instead of the default > behavior of inheriting the current process’ environment. It is passed > directly to Popen. This commit ensures that we pass `$PATH` and `$HOME` from Kapitan's `os.environ` to the external command unless those environment variables were explicitly set in the compile object's `env_vars`.
simu
force-pushed
the
feat/input-type-external-propagate-path-home
branch
from
October 25, 2022 07:50
3c56def
to
fd1b073
Compare
Perfect, thank you @simu ! Merging. |
simu
added a commit
to projectsyn/commodore
that referenced
this pull request
Jan 27, 2023
This is necessary to work around a Kapitan bug we introduced in kapicorp/kapitan#864. I've submitted a fix upstream: kapicorp/kapitan#931.
simu
added a commit
to projectsyn/commodore
that referenced
this pull request
Jan 27, 2023
This is necessary to work around a Kapitan bug we introduced in kapicorp/kapitan#864. I've submitted a fix upstream: kapicorp/kapitan#931.
simu
added a commit
to projectsyn/commodore
that referenced
this pull request
Jan 27, 2023
This is necessary to work around a Kapitan bug we introduced in kapicorp/kapitan#864. I've submitted a fix upstream: kapicorp/kapitan#931.
simu
added a commit
to projectsyn/commodore
that referenced
this pull request
Jan 27, 2023
This is necessary to work around a Kapitan bug we introduced in kapicorp/kapitan#864. I've submitted a fix upstream: kapicorp/kapitan#931.
simu
added a commit
to projectsyn/commodore
that referenced
this pull request
Mar 1, 2023
This is necessary to work around a Kapitan bug we introduced in kapicorp/kapitan#864. I've submitted a fix upstream: kapicorp/kapitan#931.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
For compile objects with
input_type: external
, the external command is executed withsubprocess.run()
with keyword parameterenv
. By providing this keyword parameter, the command will not inherit Kapitan'sos.environ
, as documented inhttps://docs.python.org/3/library/subprocess.html:
This commit ensures that we pass
$PATH
and$HOME
from Kapitan'sos.environ
to the external command unless those environment variables were explicitly set in the compile object'senv_vars
.Proposed Changes
$PATH
and$HOME
to external command forinput_type: external
unless explicitly set in the compile object'senv_vars