Skip to content

Commit fd5d49f

Browse files
committed
React to new --revision flag in rollout status
1 parent fc82249 commit fd5d49f

File tree

8 files changed

+31
-2
lines changed

8 files changed

+31
-2
lines changed

contrib/completions/bash/oc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11674,6 +11674,8 @@ _oc_rollout_status()
1167411674
flags+=("--recursive")
1167511675
flags+=("-R")
1167611676
local_nonpersistent_flags+=("--recursive")
11677+
flags+=("--revision=")
11678+
local_nonpersistent_flags+=("--revision=")
1167711679
flags+=("--as=")
1167811680
flags+=("--certificate-authority=")
1167911681
flags_with_completion+=("--certificate-authority")

contrib/completions/bash/openshift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16238,6 +16238,8 @@ _openshift_cli_rollout_status()
1623816238
flags+=("--recursive")
1623916239
flags+=("-R")
1624016240
local_nonpersistent_flags+=("--recursive")
16241+
flags+=("--revision=")
16242+
local_nonpersistent_flags+=("--revision=")
1624116243
flags+=("--as=")
1624216244
flags+=("--certificate-authority=")
1624316245
flags_with_completion+=("--certificate-authority")
@@ -26529,6 +26531,8 @@ _openshift_kube_rollout_status()
2652926531
flags+=("--recursive")
2653026532
flags+=("-R")
2653126533
local_nonpersistent_flags+=("--recursive")
26534+
flags+=("--revision=")
26535+
local_nonpersistent_flags+=("--revision=")
2653226536
flags+=("--allow-verification-with-non-compliant-keys")
2653326537
flags+=("--alsologtostderr")
2653426538
flags+=("--application-metrics-count-limit=")

contrib/completions/zsh/oc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11835,6 +11835,8 @@ _oc_rollout_status()
1183511835
flags+=("--recursive")
1183611836
flags+=("-R")
1183711837
local_nonpersistent_flags+=("--recursive")
11838+
flags+=("--revision=")
11839+
local_nonpersistent_flags+=("--revision=")
1183811840
flags+=("--as=")
1183911841
flags+=("--certificate-authority=")
1184011842
flags_with_completion+=("--certificate-authority")

contrib/completions/zsh/openshift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16399,6 +16399,8 @@ _openshift_cli_rollout_status()
1639916399
flags+=("--recursive")
1640016400
flags+=("-R")
1640116401
local_nonpersistent_flags+=("--recursive")
16402+
flags+=("--revision=")
16403+
local_nonpersistent_flags+=("--revision=")
1640216404
flags+=("--as=")
1640316405
flags+=("--certificate-authority=")
1640416406
flags_with_completion+=("--certificate-authority")
@@ -26690,6 +26692,8 @@ _openshift_kube_rollout_status()
2669026692
flags+=("--recursive")
2669126693
flags+=("-R")
2669226694
local_nonpersistent_flags+=("--recursive")
26695+
flags+=("--revision=")
26696+
local_nonpersistent_flags+=("--revision=")
2669326697
flags+=("--allow-verification-with-non-compliant-keys")
2669426698
flags+=("--alsologtostderr")
2669526699
flags+=("--application-metrics-count-limit=")

docs/man/man1/oc-rollout-status.1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ Watch the status of the latest rollout, until it's done.
2525
\fB\-R\fP, \fB\-\-recursive\fP=false
2626
Process the directory used in \-f, \-\-filename recursively. Useful when you want to manage related manifests organized within the same directory.
2727

28+
.PP
29+
\fB\-\-revision\fP=0
30+
Pin to a specific revision for showing its status. Defaults to 0 (last revision).
31+
2832

2933
.SH OPTIONS INHERITED FROM PARENT COMMANDS
3034
.PP

docs/man/man1/openshift-cli-rollout-status.1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ Watch the status of the latest rollout, until it's done.
2525
\fB\-R\fP, \fB\-\-recursive\fP=false
2626
Process the directory used in \-f, \-\-filename recursively. Useful when you want to manage related manifests organized within the same directory.
2727

28+
.PP
29+
\fB\-\-revision\fP=0
30+
Pin to a specific revision for showing its status. Defaults to 0 (last revision).
31+
2832

2933
.SH OPTIONS INHERITED FROM PARENT COMMANDS
3034
.PP

docs/man/man1/openshift-kube-rollout-status.1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ Watch the status of current rollout, until it's done.
2525
\fB\-R\fP, \fB\-\-recursive\fP=false
2626
Process the directory used in \-f, \-\-filename recursively. Useful when you want to manage related manifests organized within the same directory.
2727

28+
.PP
29+
\fB\-\-revision\fP=0
30+
Pin to a specific revision for showing its status. Defaults to 0 (last revision).
31+
2832

2933
.SH OPTIONS INHERITED FROM PARENT COMMANDS
3034
.PP

pkg/deploy/cmd/status.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ type DeploymentConfigStatusViewer struct {
2424
var _ kubectl.StatusViewer = &DeploymentConfigStatusViewer{}
2525

2626
// Status returns a message describing deployment status, and a bool value indicating if the status is considered done
27-
func (s *DeploymentConfigStatusViewer) Status(namespace, name string) (string, bool, error) {
27+
func (s *DeploymentConfigStatusViewer) Status(namespace, name string, desiredRevision int64) (string, bool, error) {
2828
config, err := s.dn.DeploymentConfigs(namespace).Get(name)
2929
if err != nil {
3030
return "", false, err
3131
}
32+
latestRevision := config.Status.LatestVersion
3233

33-
if config.Status.LatestVersion == 0 {
34+
if latestRevision == 0 {
3435
switch {
3536
case deployutil.HasImageChangeTrigger(config):
3637
return fmt.Sprintf("Deployment config %q waiting on image update\n", name), false, nil
@@ -40,6 +41,10 @@ func (s *DeploymentConfigStatusViewer) Status(namespace, name string) (string, b
4041
}
4142
}
4243

44+
if desiredRevision > 0 && latestRevision != desiredRevision {
45+
return "", false, fmt.Errorf("desired revision (%d) is different from the running revision (%d)", desiredRevision, latestRevision)
46+
}
47+
4348
cond := deployutil.GetDeploymentCondition(config.Status, deployapi.DeploymentProgressing)
4449

4550
if config.Generation <= config.Status.ObservedGeneration {

0 commit comments

Comments
 (0)