working commit

This commit is contained in:
2026-02-11 12:53:31 +02:00
parent 517c518df2
commit 6fe7f7c15e
12 changed files with 392 additions and 186 deletions
+10 -7
View File
@@ -31,8 +31,11 @@ func (cli *Client) ImageInfo(ctx context.Context, imagepath string, timeout time
var err error
res := &ImageDescr{}
imagepath, username, password, err := repackReference(imagepath)
if err != nil {
return res, err
}
ctx, _ = context.WithTimeout(ctx, timeout)
options := make([]crane.Option, 0)
options = append(options, crane.WithContext(ctx))
@@ -45,7 +48,7 @@ func (cli *Client) ImageInfo(ctx context.Context, imagepath string, timeout time
return res, err
}
if cli.username != "" && cli.password != "" {
if username != "" && password != "" {
defaultTransport := &roundTripper{}
scopes := []string{repo.Scope(transport.PullScope)}
@@ -55,8 +58,8 @@ func (cli *Client) ImageInfo(ctx context.Context, imagepath string, timeout time
return res, err
}
basicAuth := &authn.Basic{
Username: cli.username,
Password: cli.password,
Username: username,
Password: password,
}
authTransport, err := transport.NewWithContext(ctx, reg, basicAuth, defaultTransport, scopes)
if err != nil {
@@ -90,7 +93,7 @@ func (cli *Client) ImageInfo(ctx context.Context, imagepath string, timeout time
remoteOptions := make([]remote.Option, 0)
remoteOptions = append(remoteOptions, remote.WithContext(ctx))
if cli.username != "" && cli.password != "" {
if username != "" && password != "" {
defaultTransport := &roundTripper{}
scopes := []string{repo.Scope(transport.PullScope)}
@@ -100,8 +103,8 @@ func (cli *Client) ImageInfo(ctx context.Context, imagepath string, timeout time
return res, err
}
basicAuth := &authn.Basic{
Username: cli.username,
Password: cli.password,
Username: username,
Password: password,
}
authTransport, err := transport.NewWithContext(ctx, reg, basicAuth, defaultTransport, scopes)
if err != nil {