Skip to content

Commit

Permalink
Download runtime from Artifact Registry for all languages runtimes
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 585693356
Change-Id: I8d70dd253ed0f8cffcfe0426fe72a5cfc6df4cdd
  • Loading branch information
paul-feng-github authored and copybara-github committed Nov 27, 2023
1 parent 8613991 commit af544e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/runtime/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func InstallTarballIfNotCached(ctx *gcp.Context, runtime InstallableRuntime, ver
stripComponents = 1
}
region, present := os.LookupEnv(env.RuntimeImageRegion)
if present && (runtime == Python || runtime == Nodejs) {
if present {
url := runtimeImageURL(runtime, osName, version, region)
fallbackURL := runtimeImageURL(runtime, osName, version, fallbackRegion)
if err := fetch.ARImage(url, fallbackURL, layer.Path, stripComponents, ctx); err != nil {
Expand Down Expand Up @@ -294,7 +294,7 @@ func ResolveVersion(runtime InstallableRuntime, verConstraint, osName string) (s
var versions []string
var err error
region, present := os.LookupEnv(env.RuntimeImageRegion)
if present && (runtime == Python || runtime == Nodejs) {
if present {
versions, err = crane.ListTags(fmt.Sprintf(runtimeImageARRepoURL, region, osName, runtime))
} else {
err = fetch.JSON(url, &versions)
Expand Down
10 changes: 9 additions & 1 deletion pkg/runtime/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,15 @@ func TestInstallSource(t *testing.T) {
wantError: false,
wantAR: true,
},

{
name: "install from artifact registry",
runtime: OpenJDK,
version: "17.1.0",
responseFile: "testdata/dummy-ruby-runtime.tar.gz",
runtimeImageRegion: "us-central1",
wantError: false,
wantAR: true,
},
{
name: "missing runtimeImageRegion",
runtime: Nodejs,
Expand Down

0 comments on commit af544e8

Please sign in to comment.