[ 
https://issues.apache.org/jira/browse/BEAM-13090?focusedWorklogId=692285&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-692285
 ]

ASF GitHub Bot logged work on BEAM-13090:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Dec/21 07:53
            Start Date: 08/Dec/21 07:53
    Worklog Time Spent: 10m 
      Work Description: chamikaramj commented on a change in pull request 
#15764:
URL: https://github.com/apache/beam/pull/15764#discussion_r764620633



##########
File path: 
runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowRunner.java
##########
@@ -850,6 +850,47 @@ private Debuggee registerDebuggee(CloudDebugger 
debuggerClient, String uniquifie
     }
   }
 
+  protected RunnerApi.Pipeline applySdkEnvironmentOverrides(
+      RunnerApi.Pipeline pipeline, DataflowPipelineDebugOptions options) {
+    String sdkHarnessContainerImageOverrides = 
options.getSdkHarnessContainerImageOverrides();
+    if (Strings.isNullOrEmpty(sdkHarnessContainerImageOverrides)) {
+      return pipeline;
+    }
+    String[] overrides = sdkHarnessContainerImageOverrides.split(",", -1);
+    if (overrides.length % 2 != 0) {
+      throw new RuntimeException(
+          "invalid syntax for SdkHarnessContainerImageOverrides: "
+              + options.getSdkHarnessContainerImageOverrides());
+    }
+    RunnerApi.Pipeline.Builder pipelineBuilder = pipeline.toBuilder();
+    RunnerApi.Components.Builder componentsBuilder = 
pipelineBuilder.getComponentsBuilder();
+    componentsBuilder.clearEnvironments();
+    for (Map.Entry<String, RunnerApi.Environment> entry :
+        pipeline.getComponents().getEnvironmentsMap().entrySet()) {
+      RunnerApi.Environment.Builder environmentBuilder = 
entry.getValue().toBuilder();
+      if (BeamUrns.getUrn(RunnerApi.StandardEnvironments.Environments.DOCKER)
+          .equals(environmentBuilder.getUrn())) {
+        RunnerApi.DockerPayload dockerPayload;
+        try {
+          dockerPayload = 
RunnerApi.DockerPayload.parseFrom(environmentBuilder.getPayload());
+        } catch (InvalidProtocolBufferException e) {
+          throw new RuntimeException("Error parsing environment docker 
payload.", e);
+        }
+        String containerImage = dockerPayload.getContainerImage();
+        for (int i = 0; i < overrides.length; i += 2) {
+          containerImage = containerImage.replaceAll(overrides[i], overrides[i 
+ 1]);

Review comment:
       Seems like this is replacing parts of container images that match the 
regex ? We should be replacing complete container images instead (when it 
matches the regex).




-- 
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 692285)
    Time Spent: 1h 10m  (was: 1h)

> Adding SDK harness container overrides option to Java SDK
> ---------------------------------------------------------
>
>                 Key: BEAM-13090
>                 URL: https://issues.apache.org/jira/browse/BEAM-13090
>             Project: Beam
>          Issue Type: Sub-task
>          Components: cross-language
>            Reporter: Heejong Lee
>            Assignee: Heejong Lee
>            Priority: P2
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Adding SDK harness container overrides option to Java SDK



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to