|
9 | 9 | "fmt" |
10 | 10 | "io" |
11 | 11 | "io/fs" |
12 | | - stdlog "log" |
13 | 12 | "maps" |
14 | 13 | "net" |
15 | 14 | "net/http" |
@@ -44,7 +43,6 @@ import ( |
44 | 43 | dockerconfig "github.com/docker/cli/cli/config" |
45 | 44 | "github.com/docker/cli/cli/config/configfile" |
46 | 45 | "github.com/fatih/color" |
47 | | - "github.com/google/go-containerregistry/pkg/logs" |
48 | 46 | v1 "github.com/google/go-containerregistry/pkg/v1" |
49 | 47 | "github.com/google/go-containerregistry/pkg/v1/remote" |
50 | 48 | "github.com/kballard/go-shellquote" |
@@ -543,7 +541,7 @@ func run(ctx context.Context, opts options.Options, execArgs *execArgsInfo) erro |
543 | 541 | NoPush: !opts.PushImage || len(destinations) == 0, |
544 | 542 | CacheRunLayers: true, |
545 | 543 | CacheCopyLayers: true, |
546 | | - ForceBuildMetadata: false, // Force layers with no changes to be cached, required for cache probing. |
| 544 | + ForceBuildMetadata: opts.PushImage, // Force layers with no changes to be cached, required for cache probing. |
547 | 545 | CompressedCaching: true, |
548 | 546 | Compression: config.ZStd, |
549 | 547 | // Maps to "default" level, ~100-300 MB/sec according to |
@@ -585,19 +583,16 @@ func run(ctx context.Context, opts options.Options, execArgs *execArgsInfo) erro |
585 | 583 | endStage("🏗️ Built image!") |
586 | 584 | if opts.PushImage { |
587 | 585 | endStage = startStage("🏗️ Pushing image...") |
588 | | - kOpts.PushRetry = 3 |
589 | | - // kOpts.PushIgnoreImmutableTagErrors = true |
590 | | - logs.Debug = stdlog.New(os.Stderr, "", 0) |
591 | | - logs.Warn = stdlog.New(os.Stderr, "", 0) |
592 | | - logs.Progress = stdlog.New(os.Stderr, "", 0) |
593 | | - layers, _ := image.Layers() |
594 | | - for _, layer := range layers { |
595 | | - mediaType, _ := layer.MediaType() |
596 | | - diffID, _ := layer.DiffID() |
597 | | - digest, _ := layer.Digest() |
598 | | - size, _ := layer.Size() |
599 | | - opts.Logger(log.LevelDebug, "Layer: %s %s %s %d", mediaType, diffID, digest, size) |
600 | | - } |
| 586 | + |
| 587 | + // To debug registry issues, enable logging: |
| 588 | + // |
| 589 | + // import ( |
| 590 | + // stdlog "log" |
| 591 | + // reglogs "github.com/google/go-containerregistry/pkg/logs" |
| 592 | + // ) |
| 593 | + // reglogs.Debug = stdlog.New(os.Stderr, "", 0) |
| 594 | + // reglogs.Warn = stdlog.New(os.Stderr, "", 0) |
| 595 | + // reglogs.Progress = stdlog.New(os.Stderr, "", 0) |
601 | 596 | if err := executor.DoPush(image, kOpts); err == nil { |
602 | 597 | endStage("🏗️ Pushed image!") |
603 | 598 | } else if !opts.ExitOnPushFailure { |
@@ -1284,7 +1279,7 @@ func RunCacheProbe(ctx context.Context, opts options.Options) (v1.Image, error) |
1284 | 1279 | NoPush: true, |
1285 | 1280 | CacheRunLayers: true, |
1286 | 1281 | CacheCopyLayers: true, |
1287 | | - ForceBuildMetadata: false, // Force layers with no changes to be cached, required for cache probing. |
| 1282 | + ForceBuildMetadata: true, // Force layers with no changes to be cached, required for cache probing. |
1288 | 1283 | CompressedCaching: true, |
1289 | 1284 | Compression: config.ZStd, |
1290 | 1285 | // Maps to "default" level, ~100-300 MB/sec according to |
|
0 commit comments