Skip to content

Commit

Permalink
Change docker-image to image and reduce http to a single type
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max committed Aug 16, 2021
1 parent 8e250bd commit 6c85966
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions exporter/containerimage/exptypes/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ type BuildInfo struct {
type BuildInfoType string

const (
BuildInfoTypeImage BuildInfoType = "docker-image"
BuildInfoTypeImage BuildInfoType = "image"
BuildInfoTypeGit BuildInfoType = "git"
BuildInfoTypeHTTP BuildInfoType = "http"
BuildInfoTypeHTTPS BuildInfoType = "https"
)
12 changes: 4 additions & 8 deletions solver/llbsolver/solver.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func mergeBuildInfo(ctx context.Context, res solver.ResultProxy, dtic []byte) ([
return nil, errors.Wrapf(err, "failed to parse %s", bi.Ref)
}
mbis[bi.Alias] = exptypes.BuildInfo{
Type: source.DockerImageScheme,
Type: exptypes.BuildInfoTypeImage,
Ref: reference.TagNameOnly(parsed).String(),
Pin: di,
}
Expand All @@ -325,7 +325,7 @@ func mergeBuildInfo(ctx context.Context, res solver.ResultProxy, dtic []byte) ([
}
if _, ok := mbis[sid.Reference.String()]; !ok {
mbis[sid.Reference.String()] = exptypes.BuildInfo{
Type: source.DockerImageScheme,
Type: exptypes.BuildInfoTypeImage,
Ref: sid.Reference.String(),
Pin: di,
}
Expand All @@ -340,19 +340,15 @@ func mergeBuildInfo(ctx context.Context, res solver.ResultProxy, dtic []byte) ([
}
if _, ok := mbis[sref]; !ok {
mbis[sref] = exptypes.BuildInfo{
Type: source.GitScheme,
Type: exptypes.BuildInfoTypeGit,
Ref: sref,
Pin: di,
}
}
case *source.HTTPIdentifier:
stype := source.HTTPScheme
if sid.TLS {
stype = source.HTTPSScheme
}
if _, ok := mbis[sid.URL]; !ok {
mbis[sid.URL] = exptypes.BuildInfo{
Type: exptypes.BuildInfoType(stype),
Type: exptypes.BuildInfoTypeHTTP,
Ref: sid.URL,
Pin: di,
}
Expand Down

0 comments on commit 6c85966

Please sign in to comment.