Skip to content

Commit

Permalink
also deprecate crane optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
imjasonh committed Apr 19, 2023
1 parent e03a4de commit bd0efb7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cmd/crane/cmd/optimize.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ import (
)

// NewCmdOptimize creates a new cobra.Command for the optimize subcommand.
//
// Deprecated: This command is deprecated and will be removed in a future release.
func NewCmdOptimize(options *[]crane.Option) *cobra.Command {
var files []string

cmd := &cobra.Command{
Use: "optimize SRC DST",
Hidden: true,
Aliases: []string{"opt"},
Short: "Optimize a remote container image from src to dst",
Short: "[DEPRECATED] Optimize a remote container image from src to dst",
Args: cobra.ExactArgs(2),
RunE: func(_ *cobra.Command, args []string) error {
src, dst := args[0], args[1]
Expand Down
6 changes: 4 additions & 2 deletions pkg/crane/optimize.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (

// Optimize optimizes a remote image or index from src to dst.
// THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE WITHOUT WARNING.
//
// Deprecated: Optimize is deprecated, and will be removed in a future release.
func Optimize(src, dst string, prioritize []string, opt ...Option) error {
pset := newStringSet(prioritize)
o := makeOptions(opt...)
Expand Down Expand Up @@ -119,8 +121,8 @@ func optimizeImage(img v1.Image, prioritize stringSet) (stringSet, v1.Image, err
for _, layer := range layers {
missingFromLayer := []string{}
olayer, err := tarball.LayerFromOpener(layer.Uncompressed,
tarball.WithEstargz,
tarball.WithEstargzOptions(
tarball.WithEstargz, // nolint:staticcheck
tarball.WithEstargzOptions( // nolint:staticcheck
estargz.WithPrioritizedFiles(prioritize.List()),
estargz.WithAllowPrioritizeNotFound(&missingFromLayer),
))
Expand Down

0 comments on commit bd0efb7

Please sign in to comment.