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
[BEAM-8613] Add environment variable support to Docker environment #10064
Conversation
@@ -138,20 +145,33 @@ def __hash__(self): | |||
return hash((self.__class__, self.container_image)) | |||
|
|||
def __repr__(self): | |||
return 'DockerEnvironment(container_image=%s)' % self.container_image | |||
return 'DockerEnvironment(container_image=%s,env=%s)' % ( |
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.
space after the comma, I think
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 was matching the prevailing style of ProcessEnvironment
and ExternalEnvironment
.
@@ -203,7 +223,7 @@ def from_runner_api_parameter(payload, context): | |||
def from_options(cls, options): | |||
config = json.loads(options.environment_config) | |||
return cls(config.get('command'), os=config.get('os', ''), | |||
arch=config.get('arch', ''), env=config.get('env', '')) | |||
arch=config.get('arch', ''), env=config.get('env')) |
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.
yeah, I have a fix for this in my typing branch. fine to fix it here as long as the reviewers agree.
5ca5701
to
b3d5021
Compare
c1a438c
to
760e038
Compare
This allows the environment config to be specific as a JSON string, in which case an optional map of environment variables can be included, and will be passed along to the container runtime via `--env=` flags.
760e038
to
f363caf
Compare
Rebased to current master. |
This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions. |
This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
This extends the Docker environment to support passing a JSON configuration string, similar to the Process and External environments, in order to facilitate the passing of environment variables to the docker runtime. As part of this change, the
DockerPayload
grows a newenv
map field.If a JSON configuration string is used to construct a Docker environment, it must include a
docker_image
key, and can optionally include anenv
sub-object representing an environment variable map. These variables will be forwarded to thedocker
command via--env
flags.Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username
).[BEAM-XXX] Fixes bug in ApproximateQuantiles
, where you replaceBEAM-XXX
with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.See the Contributor Guide for more tips on how to make review process smoother.
Post-Commit Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.