Skip to content

Commit

Permalink
Merge pull request #267 from depot/fix-heroku-detection
Browse files Browse the repository at this point in the history
Fix detection of Heroku registry on `--load`
  • Loading branch information
jacobwgillespie authored Apr 8, 2024
2 parents 5fba100 + f99a24c commit c6e9eca
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pkg/load/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"
}

Expand Down

0 comments on commit c6e9eca

Please sign in to comment.