sshivprasad commented on code in PR #26951:
URL: https://github.com/apache/airflow/pull/26951#discussion_r993444896
##########
airflow/providers/docker/operators/docker.py:
##########
@@ -304,10 +311,13 @@ def _run_image_with_mounts(self, target_mounts,
add_tmp_variable: bool) -> list[
docker_log_config['max-size'] = self.log_opts_max_size
if self.log_opts_max_file is not None:
docker_log_config['max-file'] = self.log_opts_max_file
+ env_file_vars = {}
+ if self.env_file is not None:
+ env_file_vars = self.unpack_environment_variables(self.env_file)
self.container = self.cli.create_container(
command=self.format_command(self.command),
name=self.container_name,
- environment={**self.environment, **self._private_environment},
+ environment={**self.environment, **self._private_environment,
**env_file_vars},
Review Comment:
Okay :-)
I tried checking the precedence by running `docker run -it --env MYVAR2=bar
--env-file .\config\sample.env ubuntu bash` where MYVAR2 is set to foo inside
`sample.env` and on printing `MYVAR2` it gives `bar`, apparently giving
precedence to `env` over `env-file`. So I believe, can go with
`environment={**env_file_vars, **self.environment, **self._private_environment}`
On the other hand, I wonder if having `env-file` override `environment` is
useful when having different environments (test, dev, prod). But will go with
`environment` overriding `env-file`.
Yes, will make sure to include the behaviour bit in the docstring
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]