Skip to content

Commit

Permalink
builder-next/wrapper: use new exptypes constants
Browse files Browse the repository at this point in the history
Introduced in moby/buildkit@4fc2d7b

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
  • Loading branch information
neersighted committed Jul 20, 2023
1 parent 8243b70 commit 21288ba
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions builder/builder-next/exporter/overrides/wrapper.go
Expand Up @@ -5,14 +5,7 @@ import (
"strings"

"github.com/moby/buildkit/exporter"
)

// TODO(vvoland): Use buildkit consts once they're public
// https://github.com/moby/buildkit/pull/3694
const (
keyImageName = "name"
keyUnpack = "unpack"
keyDanglingPrefix = "dangling-name-prefix"
"github.com/moby/buildkit/exporter/containerimage/exptypes"
)

// Wraps the containerimage exporter's Resolve method to apply moby-specific
Expand All @@ -30,14 +23,14 @@ func (e *imageExporterMobyWrapper) Resolve(ctx context.Context, exporterAttrs ma
if exporterAttrs == nil {
exporterAttrs = make(map[string]string)
}
reposAndTags, err := SanitizeRepoAndTags(strings.Split(exporterAttrs[keyImageName], ","))
reposAndTags, err := SanitizeRepoAndTags(strings.Split(exporterAttrs[string(exptypes.OptKeyName)], ","))
if err != nil {
return nil, err
}
exporterAttrs[keyImageName] = strings.Join(reposAndTags, ",")
exporterAttrs[keyUnpack] = "true"
if _, has := exporterAttrs[keyDanglingPrefix]; !has {
exporterAttrs[keyDanglingPrefix] = "moby-dangling"
exporterAttrs[string(exptypes.OptKeyName)] = strings.Join(reposAndTags, ",")
exporterAttrs[string(exptypes.OptKeyUnpack)] = "true"
if _, has := exporterAttrs[string(exptypes.OptKeyDanglingPrefix)]; !has {
exporterAttrs[string(exptypes.OptKeyDanglingPrefix)] = "moby-dangling"
}

return e.exp.Resolve(ctx, exporterAttrs)
Expand Down

0 comments on commit 21288ba

Please sign in to comment.