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

Adding mutate --workdir option to set the working directory #1615

Merged
merged 3 commits into from
Mar 28, 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
7 changes: 7 additions & 0 deletions cmd/crane/cmd/mutate.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func NewCmdMutate(options *[]crane.Option) *cobra.Command {
var newRef string
var newRepo string
var user string
var workdir string

mutateCmd := &cobra.Command{
Use: "mutate",
Expand Down Expand Up @@ -114,6 +115,11 @@ func NewCmdMutate(options *[]crane.Option) *cobra.Command {
cfg.Config.User = user
}

// Set workdir.
if len(workdir) > 0 {
cfg.Config.WorkingDir = workdir
}

// Mutate and write image.
img, err = mutate.Config(img, cfg.Config)
if err != nil {
Expand Down Expand Up @@ -165,6 +171,7 @@ func NewCmdMutate(options *[]crane.Option) *cobra.Command {
mutateCmd.Flags().StringVarP(&outFile, "output", "o", "", "Path to new tarball of resulting image")
mutateCmd.Flags().StringSliceVar(&newLayers, "append", []string{}, "Path to tarball to append to image")
mutateCmd.Flags().StringVarP(&user, "user", "u", "", "New user to set")
mutateCmd.Flags().StringVarP(&workdir, "workdir", "w", "", "New working dir to set")
return mutateCmd
}

Expand Down
1 change: 1 addition & 0 deletions cmd/crane/doc/crane_mutate.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.