From f99a24c84a9697cf19f3d6e75bb775ac8cef0f9a Mon Sep 17 00:00:00 2001 From: Jacob Gillespie Date: Mon, 8 Apr 2024 19:49:20 +0100 Subject: [PATCH] Fix detection of Heroku registry on `--load` --- pkg/load/cli.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pkg/load/cli.go b/pkg/load/cli.go index d68a46a..20347d6 100644 --- a/pkg/load/cli.go +++ b/pkg/load/cli.go @@ -93,6 +93,18 @@ func WithDepotImagePull(buildOpts map[string]build.Options, loadOpts DepotLoadOp } } + useOCI := true + + // Don't use OCI mediatypes if pushing to Heroku's registry. + for _, options := range toPull { + for _, tag := range options.UserTags { + if strings.Contains(tag, "registry.heroku.com") { + useOCI = false + break + } + } + } + // Add oci-mediatypes for any image build regardless of whether we are pulling. // This gives us more flexibility for future options like estargz. for target, buildOpt := range buildOpts { @@ -107,8 +119,7 @@ func WithDepotImagePull(buildOpts map[string]build.Options, loadOpts DepotLoadOp export.Attrs["name"] = defaultImageName(loadOpts, target) } - // Don't use OCI mediatypes if pushing to Heroku's registry. - if !strings.Contains(export.Attrs["name"], "registry.heroku.com") { + if useOCI { export.Attrs["oci-mediatypes"] = "true" }