Skip to content

Commit

Permalink
switch to using WithAuthFromKeychain
Browse files Browse the repository at this point in the history
  • Loading branch information
cppforlife committed May 13, 2020
1 parent a55ba13 commit 76da1ec
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions pkg/kbld/image/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,10 @@ func (i Registry) WriteImage(ref regname.Reference, img regv1.Image) error {
return err
}

authz, err := regauthn.DefaultKeychain.Resolve(ref.Context().Registry)
if err != nil {
return fmt.Errorf("Getting authz details: %s", err)
}

err = i.retry(func() error {
return regremote.Write(ref, img,
regremote.WithTransport(httpTran),
regremote.WithAuth(authz),
regremote.WithAuthFromKeychain(regauthn.DefaultKeychain),
)
})
if err != nil {
Expand All @@ -90,15 +85,10 @@ func (i Registry) WriteIndex(ref regname.Reference, idx regv1.ImageIndex) error
return err
}

authz, err := regauthn.DefaultKeychain.Resolve(ref.Context().Registry)
if err != nil {
return fmt.Errorf("Getting authz details: %s", err)
}

err = i.retry(func() error {
return regremote.WriteIndex(ref, idx,
regremote.WithTransport(httpTran),
regremote.WithAuth(authz),
regremote.WithAuthFromKeychain(regauthn.DefaultKeychain),
)
})
if err != nil {
Expand Down

0 comments on commit 76da1ec

Please sign in to comment.