youngoli commented on a change in pull request #14397:
URL: https://github.com/apache/beam/pull/14397#discussion_r606614546
##########
File path: sdks/go/pkg/beam/core/runtime/pipelinex/replace.go
##########
@@ -243,3 +245,33 @@ func findFreeName(seen map[string]bool, name string)
string {
}
}
}
+
+// ApplySdkImageOverrides takes a pipeline and a map of patterns to overrides,
+// and proceeds to replace matching ContainerImages in any Environments
+// present in the pipeline.
+func ApplySdkImageOverrides(p *pipepb.Pipeline, patterns map[string]string)
error {
+ if len(patterns) == 0 {
+ return nil
+ }
+
+ for _, env := range p.GetComponents().GetEnvironments() {
+ var payload pipepb.DockerPayload
+ if err := proto.Unmarshal(env.GetPayload(), &payload); err !=
nil {
+ return err
+ }
+ oldImg := payload.GetContainerImage()
+ for pattern, replacement := range patterns {
+ re, err := regexp.Compile(pattern)
Review comment:
Good point. I went ahead and fixed it anyway, and yeah I'll keep that in
mind.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]