Skip to content

Commit

Permalink
Retry without mount if auth fails (#1681)
Browse files Browse the repository at this point in the history
DockerHub fails to auth if you ask for an invalid repository. Docs say
this should not happen, but here we are.
  • Loading branch information
jonjohnsonjr committed May 1, 2023
1 parent 3228a60 commit 43710a9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/v1/remote/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ func (w *writer) initiateUpload(ctx context.Context, from, mount, origin string)
req.Header.Set("Content-Type", "application/json")
resp, err := w.client.Do(req.WithContext(ctx))
if err != nil {
if origin != "" && origin != w.repo.RegistryStr() {
// https://github.com/google/go-containerregistry/issues/1679
logs.Warn.Printf("retrying without mount: %v", err)
return w.initiateUpload(ctx, "", "", "")
}
return "", false, err
}
defer resp.Body.Close()
Expand Down

0 comments on commit 43710a9

Please sign in to comment.