Skip to content

Commit d95c3be

Browse files
authored
Merge pull request #445 from depot/wito/dep-3772-investigate-failling-e2e-test-with-registry
fix: fix depot pull auth
2 parents 52115dd + 230286b commit d95c3be

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

pkg/cmd/push/manifests.go

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"sync"
1212

1313
"connectrpc.com/connect"
14-
"github.com/containerd/containerd/errdefs"
1514
"github.com/containerd/containerd/images"
1615
"github.com/containerd/containerd/reference"
1716
"github.com/containerd/containerd/remotes"
@@ -83,7 +82,11 @@ func GetImageDescriptors(ctx context.Context, token, buildID, target string, log
8382
ref = ref + "-" + target
8483
}
8584

86-
authorizer := &Authorizer{Username: username, Password: password}
85+
authorizer := docker.NewDockerAuthorizer(
86+
docker.WithAuthCreds(func(host string) (string, string, error) {
87+
return username, password, nil
88+
}),
89+
)
8790
hosts := docker.ConfigureDefaultRegistries(docker.WithAuthorizer(authorizer))
8891

8992
headers := http.Header{}
@@ -191,17 +194,3 @@ func fetch(ctx context.Context, fetcher remotes.Fetcher, desc ocispecs.Descripto
191194
defer func() { _ = r.Close() }()
192195
return io.ReadAll(r)
193196
}
194-
195-
// Authorizer is a static authorizer used to authenticate with the Depot registry.
196-
type Authorizer struct {
197-
Username string
198-
Password string
199-
}
200-
201-
func (a *Authorizer) Authorize(ctx context.Context, req *http.Request) error {
202-
req.SetBasicAuth(a.Username, a.Password)
203-
return nil
204-
}
205-
func (a *Authorizer) AddResponses(ctx context.Context, responses []*http.Response) error {
206-
return errdefs.ErrNotImplemented
207-
}

0 commit comments

Comments
 (0)