Skip to content

Commit

Permalink
Don't try to mount at all if we hit an error
Browse files Browse the repository at this point in the history
  • Loading branch information
jonjohnsonjr committed Jun 22, 2023
1 parent d369248 commit c5e2c4f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/v1/remote/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ 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() {
if from != "" {
// https://github.com/google/go-containerregistry/issues/1679
logs.Warn.Printf("retrying without mount: %v", err)
return w.initiateUpload(ctx, "", "", "")
Expand All @@ -220,7 +220,7 @@ func (w *writer) initiateUpload(ctx context.Context, from, mount, origin string)
defer resp.Body.Close()

if err := transport.CheckError(resp, http.StatusCreated, http.StatusAccepted); err != nil {
if origin != "" && origin != w.repo.RegistryStr() {
if from != "" {
// https://github.com/google/go-containerregistry/issues/1404
logs.Warn.Printf("retrying without mount: %v", err)
return w.initiateUpload(ctx, "", "", "")
Expand Down Expand Up @@ -365,6 +365,7 @@ func (w *writer) uploadOne(ctx context.Context, l v1.Layer) error {
origin = ml.Reference.Context().RegistryStr()

// This keeps breaking with DockerHub.
// https://github.com/google/go-containerregistry/issues/1741
if w.repo.RegistryStr() == name.DefaultRegistry && origin != w.repo.RegistryStr() {
from = ""
origin = ""
Expand Down

0 comments on commit c5e2c4f

Please sign in to comment.