Skip to content

Commit

Permalink
[image-builder] Support whitelisted registries in GP layer build
Browse files Browse the repository at this point in the history
  • Loading branch information
csweichel committed Jul 29, 2021
1 parent 479abb7 commit 0eecc83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions components/image-builder-mk3/pkg/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ func (a AllowedAuthFor) Elevate(ref string) AllowedAuthFor {
return AllowedAuthFor{a.All, append(a.Explicit, reference.Domain(pref))}
}

// ExplicitlyAll produces an AllowedAuthFor that allows authentication for all
// registries, yet carries the original Explicit list which affects GetAuthForImageBuild
func (a AllowedAuthFor) ExplicitlyAll() AllowedAuthFor {
return AllowedAuthFor{
All: true,
Explicit: a.Explicit,
}
}

// Resolver resolves an auth request determining which authentication is actually allowed
type Resolver struct {
BaseImageRepository string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func (o *Orchestrator) Build(req *protocol.BuildRequest, resp protocol.ImageBuil
if err != nil {
return
}
gplayerAuth, err := o.getAuthFor(auth.AllowedAuthForAll, wsrefstr, baseref)
gplayerAuth, err := o.getAuthFor(reqauth.ExplicitlyAll(), wsrefstr, baseref)
if err != nil {
return
}
Expand Down

0 comments on commit 0eecc83

Please sign in to comment.