Skip to content

Commit

Permalink
Workaround for changed default value in cobra command
Browse files Browse the repository at this point in the history
Somehow, the differing default value for --force (compared to the run/deploy
commands) is not picked up. This workaround forces the state to true.

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
  • Loading branch information
Cornelius Weig committed Feb 7, 2019
1 parent af673bc commit e32fa72
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions cmd/skaffold/app/cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ func NewCmdDev(out io.Writer) *cobra.Command {
cmd.Flags().BoolVar(&opts.PortForward, "port-forward", true, "Port-forward exposed container ports within pods")
cmd.Flags().StringArrayVarP(&opts.CustomLabels, "label", "l", nil, "Add custom labels to deployed objects. Set multiple times for multiple labels")
cmd.Flags().BoolVar(&opts.ExperimentalGUI, "experimental-gui", false, "Experimental Graphical User Interface")
cmd.Flags().BoolVar(&opts.ForceDeploy, "force", true, "Recreate resources if necessary")
_ = cmd.Flags().MarkHidden("force")

return cmd
}
Expand Down
1 change: 0 additions & 1 deletion docs/content/en/docs/references/cli/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ Env vars:
* `SKAFFOLD_DEFAULT_REPO` (same as --default-repo)
* `SKAFFOLD_EXPERIMENTAL_GUI` (same as --experimental-gui)
* `SKAFFOLD_FILENAME` (same as --filename)
* `SKAFFOLD_FORCE` (same as --force)
* `SKAFFOLD_LABEL` (same as --label)
* `SKAFFOLD_NAMESPACE` (same as --namespace)
* `SKAFFOLD_PORT_FORWARD` (same as --port-forward)
Expand Down
3 changes: 2 additions & 1 deletion pkg/skaffold/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ func NewForConfig(opts *config.SkaffoldOptions, cfg *latest.SkaffoldPipeline) (*
return nil, errors.Wrap(err, "parsing test config")
}

deployer, err := getDeployer(&cfg.Deploy, kubeContext, opts.Namespace, opts.ForceDeploy, defaultRepo)
forceDeploy := opts.Command == "dev" || opts.ForceDeploy
deployer, err := getDeployer(&cfg.Deploy, kubeContext, opts.Namespace, forceDeploy, defaultRepo)
if err != nil {
return nil, errors.Wrap(err, "parsing deploy config")
}
Expand Down

0 comments on commit e32fa72

Please sign in to comment.