Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add save flags #2187

Merged
merged 1 commit into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/sealer/cmd/image/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func NewSaveCmd() *cobra.Command {
flags.StringVar(&saveOpts.Format, "format", buildah.OCIArchive, "Save image to oci-archive, oci-dir (directory with oci manifest type), docker-archive, docker-dir (directory with v2s2 manifest type)")
flags.StringVarP(&saveOpts.Output, "output", "o", "", "Write image to a specified file")
flags.BoolVarP(&saveOpts.Quiet, "quiet", "q", false, "Suppress the output")
flags.StringVar(&saveOpts.TmpDir, "tmp-dir", "", "set temporary directory when save image. if not set, use system`s temporary directory")
flags.BoolVar(&saveOpts.Compress, "compress", false, "Compress tarball image layers when saving to a directory using the 'dir' transport. (default is same compression type as source)")
if err := saveCmd.MarkFlagRequired("output"); err != nil {
logrus.Errorf("failed to init flag: %v", err)
Expand Down
1 change: 1 addition & 0 deletions pkg/define/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ type SaveOptions struct {
Output string
Quiet bool
ImageNameOrID string
TmpDir string
}

type LoadOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/imageengine/buildah/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (engine *Engine) Save(opts *options.SaveOptions) error {
}
}()

tempDir, err := os.MkdirTemp("", "sealer-save-tmp")
tempDir, err := os.MkdirTemp(opts.TmpDir, "sealer-save-tmp")
if err != nil {
return fmt.Errorf("failed to create %s, err: %v", tempDir, err)
}
Expand Down