working commit
This commit is contained in:
+10
-7
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user