-
Notifications
You must be signed in to change notification settings - Fork 355
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
Add new setup_envs
method for the Executor
trait
#2820
Conversation
Signed-off-by: Kotaro Inoue <[email protected]>
Signed-off-by: Kotaro Inoue <[email protected]>
cc: @Mossaka |
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.
LGTM
Thanks @musaprg for working on this!
Now we just needs to get a green CI run :-)
Signed-off-by: Kotaro Inoue <[email protected]>
Signed-off-by: Kotaro Inoue <[email protected]>
Signed-off-by: Kotaro Inoue <[email protected]>
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.
LGMT, one question to clarify
/// Set environment variables for the container process to be executed. | ||
fn set_envs(&self, envs: HashMap<String, String>) -> Result<(), ExecutorSetEnvsError> { |
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 don't think set
is a proper word for this method because we need to delete and add the envs. How about update
or setup
?
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.
setup_envs
sounds good to me. Let me rename the method and related type names.
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've renamed in 9fbeef5
@@ -60,6 +71,16 @@ pub trait Executor: CloneBoxExecutor { | |||
/// namespace and cgroups, and pivot_root into the rootfs. But this step | |||
/// runs before waiting for the container start signal. | |||
fn validate(&self, spec: &Spec) -> Result<(), ExecutorValidationError>; | |||
|
|||
/// Set environment variables for the container process to be executed. |
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.
It'd be better to explain the situation this method is called. For example, this method is called the init process and hasn't cleared the host's envs yet.
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've added a detailed description for the setup_envs
in b20b8fa.
Signed-off-by: Kotaro Inoue <[email protected]>
Signed-off-by: Kotaro Inoue <[email protected]>
set_envs
method for the Executor
traitsetup_envs
method for the Executor
trait
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.
lgtm!
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.
LGTM!
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.
LGTM
@musaprg Congrats! 🎉 Thanks for your contribution. |
fixes #2815
This PR introduces a new
setup_envs
method for theExecutor
trait. It allows any implementors of theExecutor
trait to control how environment variables specified in the OCI spec are handled. The default implementation mirrors the behavior of the one implemented in thecontainer_init_process
, which involves removing existing environment variables and setting the ones specified in the OCI spec.TODO
ExecutorError