You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by lo...@apache.org on 2022/12/15 16:12:43 UTC

[beam] branch master updated: Make base_sdk URN versioned on default docker container. (#24668)

This is an automated email from the ASF dual-hosted git repository.

lostluck pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new b2616bc6708 Make base_sdk URN versioned on default docker container. (#24668)
b2616bc6708 is described below

commit b2616bc6708a1f3f8f1b4f07aaafb9f095611eef
Author: Robert Burke <lo...@users.noreply.github.com>
AuthorDate: Thu Dec 15 08:12:35 2022 -0800

    Make base_sdk URN versioned on default docker container. (#24668)
    
    Co-authored-by: lostluck <13...@users.noreply.github.com>
---
 sdks/go/pkg/beam/core/core.go                     |  3 +++
 sdks/go/pkg/beam/core/runtime/graphx/translate.go | 12 ++++++++----
 sdks/go/pkg/beam/options/jobopts/options.go       |  3 +--
 sdks/go/pkg/beam/options/jobopts/options_test.go  |  2 +-
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/sdks/go/pkg/beam/core/core.go b/sdks/go/pkg/beam/core/core.go
index 8dbab406f2c..aa732cdaa88 100644
--- a/sdks/go/pkg/beam/core/core.go
+++ b/sdks/go/pkg/beam/core/core.go
@@ -28,4 +28,7 @@ const (
 	SdkName = "Apache Beam SDK for Go"
 	// SdkVersion is the current version of the SDK.
 	SdkVersion = "2.45.0.dev"
+
+	// DefaultDockerImage represents the associated image for this release.
+	DefaultDockerImage = "apache/beam_go_sdk:" + SdkVersion
 )
diff --git a/sdks/go/pkg/beam/core/runtime/graphx/translate.go b/sdks/go/pkg/beam/core/runtime/graphx/translate.go
index cd5946742fd..68074ac7eb3 100644
--- a/sdks/go/pkg/beam/core/runtime/graphx/translate.go
+++ b/sdks/go/pkg/beam/core/runtime/graphx/translate.go
@@ -21,6 +21,7 @@ import (
 	"sort"
 	"strings"
 
+	"github.com/apache/beam/sdks/v2/go/pkg/beam/core"
 	"github.com/apache/beam/sdks/v2/go/pkg/beam/core/graph"
 	"github.com/apache/beam/sdks/v2/go/pkg/beam/core/graph/coder"
 	"github.com/apache/beam/sdks/v2/go/pkg/beam/core/graph/window"
@@ -83,14 +84,18 @@ const (
 	URNArtifactURLType      = "beam:artifact:type:url:v1"
 	URNArtifactGoWorkerRole = "beam:artifact:role:go_worker_binary:v1"
 
-	// Environment Urns.
+	// Environment URNs.
 	URNEnvProcess  = "beam:env:process:v1"
 	URNEnvExternal = "beam:env:external:v1"
 	URNEnvDocker   = "beam:env:docker:v1"
 
-	// Userstate Urns.
+	// Userstate URNs.
 	URNBagUserState      = "beam:user_state:bag:v1"
 	URNMultiMapUserState = "beam:user_state:multimap:v1"
+
+	// Base version URNs are to allow runners to make distinctions between different releases
+	// in a way that won't change based on actual releases, in particular for FnAPI behaviors.
+	URNBaseVersionGo = "beam:version:sdk_base:go:" + core.DefaultDockerImage
 )
 
 func goCapabilities() []string {
@@ -100,8 +105,7 @@ func goCapabilities() []string {
 		URNTruncate,
 		URNWorkerStatus,
 		URNMonitoringInfoShortID,
-		// TOOD(https://github.com/apache/beam/issues/20287): Make this versioned.
-		"beam:version:sdk_base:go",
+		URNBaseVersionGo,
 	}
 	return append(capabilities, knownStandardCoders()...)
 }
diff --git a/sdks/go/pkg/beam/options/jobopts/options.go b/sdks/go/pkg/beam/options/jobopts/options.go
index 399d0108137..118c3fba2fc 100644
--- a/sdks/go/pkg/beam/options/jobopts/options.go
+++ b/sdks/go/pkg/beam/options/jobopts/options.go
@@ -21,7 +21,6 @@ import (
 	"context"
 	"flag"
 	"fmt"
-	"os"
 	"strings"
 	"time"
 
@@ -154,7 +153,7 @@ func IsLoopback() bool {
 // Convenience function.
 func GetEnvironmentConfig(ctx context.Context) string {
 	if *EnvironmentConfig == "" {
-		*EnvironmentConfig = os.ExpandEnv("apache/beam_go_sdk:" + core.SdkVersion)
+		*EnvironmentConfig = core.DefaultDockerImage
 		log.Infof(ctx, "No environment config specified. Using default config: '%v'", *EnvironmentConfig)
 	}
 	return *EnvironmentConfig
diff --git a/sdks/go/pkg/beam/options/jobopts/options_test.go b/sdks/go/pkg/beam/options/jobopts/options_test.go
index 15fdc7dfbb8..dc23be95415 100644
--- a/sdks/go/pkg/beam/options/jobopts/options_test.go
+++ b/sdks/go/pkg/beam/options/jobopts/options_test.go
@@ -119,7 +119,7 @@ func TestGetEnvironmentConfig(t *testing.T) {
 		},
 		{
 			"",
-			"apache/beam_go_sdk:" + core.SdkVersion,
+			core.DefaultDockerImage,
 		},
 	}
 	for _, test := range tests {