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

oc: deprecate 'deploy --latest' in favor of 'rollout latest --again' #11287

Merged
merged 2 commits into from
Oct 18, 2016
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
4 changes: 2 additions & 2 deletions contrib/completions/bash/oc
Original file line number Diff line number Diff line change
Expand Up @@ -8123,8 +8123,6 @@ _oc_deploy()
local_nonpersistent_flags+=("--enable-triggers")
flags+=("--follow")
local_nonpersistent_flags+=("--follow")
flags+=("--latest")
local_nonpersistent_flags+=("--latest")
flags+=("--retry")
local_nonpersistent_flags+=("--retry")
flags+=("--as=")
Expand Down Expand Up @@ -11504,6 +11502,8 @@ _oc_rollout_latest()
flags_with_completion=()
flags_completion=()

flags+=("--again")
local_nonpersistent_flags+=("--again")
flags+=("--output=")
two_word_flags+=("-o")
local_nonpersistent_flags+=("--output=")
Expand Down
4 changes: 2 additions & 2 deletions contrib/completions/bash/openshift
Original file line number Diff line number Diff line change
Expand Up @@ -12640,8 +12640,6 @@ _openshift_cli_deploy()
local_nonpersistent_flags+=("--enable-triggers")
flags+=("--follow")
local_nonpersistent_flags+=("--follow")
flags+=("--latest")
local_nonpersistent_flags+=("--latest")
flags+=("--retry")
local_nonpersistent_flags+=("--retry")
flags+=("--as=")
Expand Down Expand Up @@ -16065,6 +16063,8 @@ _openshift_cli_rollout_latest()
flags_with_completion=()
flags_completion=()

flags+=("--again")
local_nonpersistent_flags+=("--again")
flags+=("--output=")
two_word_flags+=("-o")
local_nonpersistent_flags+=("--output=")
Expand Down
4 changes: 2 additions & 2 deletions contrib/completions/zsh/oc
Original file line number Diff line number Diff line change
Expand Up @@ -8284,8 +8284,6 @@ _oc_deploy()
local_nonpersistent_flags+=("--enable-triggers")
flags+=("--follow")
local_nonpersistent_flags+=("--follow")
flags+=("--latest")
local_nonpersistent_flags+=("--latest")
flags+=("--retry")
local_nonpersistent_flags+=("--retry")
flags+=("--as=")
Expand Down Expand Up @@ -11665,6 +11663,8 @@ _oc_rollout_latest()
flags_with_completion=()
flags_completion=()

flags+=("--again")
local_nonpersistent_flags+=("--again")
flags+=("--output=")
two_word_flags+=("-o")
local_nonpersistent_flags+=("--output=")
Expand Down
4 changes: 2 additions & 2 deletions contrib/completions/zsh/openshift
Original file line number Diff line number Diff line change
Expand Up @@ -12801,8 +12801,6 @@ _openshift_cli_deploy()
local_nonpersistent_flags+=("--enable-triggers")
flags+=("--follow")
local_nonpersistent_flags+=("--follow")
flags+=("--latest")
local_nonpersistent_flags+=("--latest")
flags+=("--retry")
local_nonpersistent_flags+=("--retry")
flags+=("--as=")
Expand Down Expand Up @@ -16226,6 +16224,8 @@ _openshift_cli_rollout_latest()
flags_with_completion=()
flags_completion=()

flags+=("--again")
local_nonpersistent_flags+=("--again")
flags+=("--output=")
two_word_flags+=("-o")
local_nonpersistent_flags+=("--output=")
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/oc-rollout-latest.1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ your image change triggers.


.SH OPTIONS
.PP
\fB\-\-again\fP=false
Deploy the current pod template without updating state from triggers

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output mode. Use "\-o name" for shorter output (resource/name).
Expand Down
4 changes: 4 additions & 0 deletions docs/man/man1/openshift-cli-rollout-latest.1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ your image change triggers.


.SH OPTIONS
.PP
\fB\-\-again\fP=false
Deploy the current pod template without updating state from triggers

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output mode. Use "\-o name" for shorter output (resource/name).
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/cli/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func NewCmdDeploy(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.C
}

cmd.Flags().BoolVar(&options.deployLatest, "latest", false, "Start a new deployment now.")
cmd.Flags().MarkDeprecated("latest", fmt.Sprintf("use '%s rollout latest' instead", fullName))
cmd.Flags().BoolVar(&options.retryDeploy, "retry", false, "Retry the latest failed deployment.")
cmd.Flags().BoolVar(&options.cancelDeploy, "cancel", false, "Cancel the in-progress deployment.")
cmd.Flags().BoolVar(&options.enableTriggers, "enable-triggers", false, "Enables all image triggers for the deployment config.")
Expand Down
5 changes: 4 additions & 1 deletion pkg/cmd/cli/cmd/rollout/latest.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type RolloutLatestOptions struct {

out io.Writer
shortOutput bool
again bool

oc client.Interface
kc kclient.Interface
Expand Down Expand Up @@ -74,6 +75,7 @@ func NewCmdRolloutLatest(fullName string, f *clientcmd.Factory, out io.Writer) *
}

kcmdutil.AddOutputFlagsForMutation(cmd)
cmd.Flags().Bool("again", false, "Deploy the current pod template without updating state from triggers")

return cmd
}
Expand Down Expand Up @@ -106,6 +108,7 @@ func (o *RolloutLatestOptions) Complete(f *clientcmd.Factory, cmd *cobra.Command

o.out = out
o.shortOutput = kcmdutil.GetFlagString(cmd, "output") == "name"
o.again = kcmdutil.GetFlagBool(cmd, "again")

return nil
}
Expand Down Expand Up @@ -145,7 +148,7 @@ func (o RolloutLatestOptions) RunRolloutLatest() error {

request := &deployapi.DeploymentRequest{
Name: config.Name,
Latest: true,
Latest: !o.again,
Force: true,
}

Expand Down
2 changes: 1 addition & 1 deletion test/end-to-end/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ os::cmd::try_until_success 'oc get rc/failing-dc-1'
os::cmd::expect_success 'oc logs -f dc/failing-dc'
os::cmd::try_until_text "oc get rc/failing-dc-1 --template={{.metadata.annotations}}" 'openshift.io/deployment.phase:Failed'
os::cmd::expect_success_and_text 'oc logs dc/failing-dc' 'test pre hook executed'
os::cmd::expect_success 'oc deploy failing-dc --latest'
os::cmd::expect_success 'oc rollout latest dc/failing-dc --again'
os::cmd::expect_success_and_text 'oc logs --version=1 dc/failing-dc' 'test pre hook executed'
os::cmd::expect_success_and_text 'oc logs --previous dc/failing-dc' 'test pre hook executed'
# Make sure --since-time adds the right query param, and actually returns logs
Expand Down