Skip to content

Commit dbecb1d

Browse files
authored
Do not reuse pushers for pullers (#1701)
This causes issues with broken registry implementations that 403 if you have requested push scopes even for pull operations.
1 parent a927d7c commit dbecb1d

File tree

2 files changed

+0
-23
lines changed

2 files changed

+0
-23
lines changed

pkg/v1/remote/fetcher.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ import (
3232
"github.com/google/go-containerregistry/pkg/v1/types"
3333
)
3434

35-
func fetcherFromWriter(w *writer) *fetcher {
36-
return &fetcher{
37-
target: w.repo,
38-
client: w.client,
39-
}
40-
}
41-
4235
// fetcher implements methods for reading from a registry.
4336
type fetcher struct {
4437
target resource

pkg/v1/remote/puller.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"context"
1919
"sync"
2020

21-
"github.com/google/go-containerregistry/pkg/logs"
2221
"github.com/google/go-containerregistry/pkg/name"
2322
v1 "github.com/google/go-containerregistry/pkg/v1"
2423
"github.com/google/go-containerregistry/pkg/v1/partial"
@@ -72,21 +71,6 @@ func (r *reader) init(ctx context.Context) error {
7271
}
7372

7473
func (p *Puller) fetcher(ctx context.Context, target resource) (*fetcher, error) {
75-
// If we are Reuse()ing a Pusher, we want to use that for token handshakes and scopes,
76-
// but we want to do read requests via a fetcher{}.
77-
//
78-
// TODO(jonjohnsonjr): Unify fetcher, writer, and repoWriter.
79-
if p.o.pusher != nil {
80-
if repo, ok := target.(name.Repository); ok {
81-
w, err := p.o.pusher.writer(ctx, repo, p.o)
82-
if err == nil {
83-
return fetcherFromWriter(w.w), nil
84-
}
85-
logs.Debug.Printf("reusing Pusher failed: %v", err)
86-
}
87-
}
88-
89-
// Normal path for NewPuller.
9074
v, _ := p.readers.LoadOrStore(target, &reader{
9175
target: target,
9276
o: p.o,

0 commit comments

Comments
 (0)