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 -4
View File
@@ -14,6 +14,7 @@ import (
"os"
"time"
"mstore/pkg/auxtool"
"mstore/pkg/auxutar"
"github.com/google/go-containerregistry/pkg/authn"
@@ -26,10 +27,15 @@ func (cli *Client) PullImage(ctx context.Context, filepath, imagepath string, ti
var err error
ctx, _ = context.WithTimeout(ctx, timeout)
imagepath, username, password, err := repackReference(imagepath)
if err != nil {
return err
}
options := make([]crane.Option, 0)
options = append(options, crane.WithContext(ctx))
if cli.username != "" && cli.password != "" {
if username != "" && password != "" {
ref, err := name.ParseReference(imagepath)
if err != nil {
return err
@@ -48,8 +54,8 @@ func (cli *Client) PullImage(ctx context.Context, filepath, imagepath string, ti
return 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 {
@@ -65,7 +71,7 @@ func (cli *Client) PullImage(ctx context.Context, filepath, imagepath string, ti
if err != nil {
return err
}
dstdir := makeTmpFileName(filepath)
dstdir := auxtool.MakeTmpFilename(filepath)
err = os.MkdirAll(dstdir, 0750)
if err != nil {
return err