Skip to content

Commit

Permalink
Use HEAD query to registry first to avoid Dockerhub API rate limits, …
Browse files Browse the repository at this point in the history
…falling back to a GET in case of error

Signed-off-by: antwacky <pagey101@hotmail.co.uk>
  • Loading branch information
antwacky committed Feb 21, 2024
1 parent c190d54 commit d031e56
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/kbld/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ func (i Registry) Generic(ref regname.Reference) (regv1.Descriptor, error) {
return regv1.Descriptor{}, err
}

desc, err := regremote.Get(ref, i.opts...)
desc, err := regremote.Head(ref, i.opts...)
if err != nil {
return regv1.Descriptor{}, err
getDesc, err := regremote.Get(ref, i.opts...)
if err != nil {
return regv1.Descriptor{}, err
}
return getDesc.Descriptor, err
}

return desc.Descriptor, nil
return *desc, nil
}

func (i Registry) Image(ref regname.Reference) (regv1.Image, error) {
Expand Down

0 comments on commit d031e56

Please sign in to comment.