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

Print max-in-flight value alongside deployment status [main] #3098

Merged
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
2 changes: 2 additions & 0 deletions api/cloudcontroller/ccv3/constant/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ const (
DeploymentStatusValueActive DeploymentStatusValue = "ACTIVE"
DeploymentStatusValueFinalized DeploymentStatusValue = "FINALIZED"
)

const DeploymentMaxInFlightDefaultValue int = 1
20 changes: 8 additions & 12 deletions command/v7/shared/app_summary_displayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ func (display AppSummaryDisplayer) displayProcessTable(summary v7action.Detailed
if summary.Deployment.StatusValue == constant.DeploymentStatusValueActive {
display.UI.DisplayNewline()
display.UI.DisplayText(display.getDeploymentStatusText(summary))

var maxInFlight = summary.Deployment.Options.MaxInFlight
if maxInFlight > 0 && maxInFlight != constant.DeploymentMaxInFlightDefaultValue {
display.UI.DisplayText(fmt.Sprintf("max-in-flight: %d", maxInFlight))
}

if summary.Deployment.Strategy == constant.DeploymentStrategyCanary && summary.Deployment.StatusReason == constant.DeploymentStatusReasonPaused {
display.UI.DisplayNewline()
display.UI.DisplayText(fmt.Sprintf("Please run `cf continue-deployment %s` to promote the canary deployment, or `cf cancel-deployment %s` to rollback to the previous version.", summary.Application.Name, summary.Application.Name))
Expand All @@ -171,25 +177,15 @@ func (display AppSummaryDisplayer) displayProcessTable(summary v7action.Detailed

func (display AppSummaryDisplayer) getDeploymentStatusText(summary v7action.DetailedApplicationSummary) string {
var lastStatusChangeTime = display.getLastStatusChangeTime(summary)

if lastStatusChangeTime != "" {
return fmt.Sprintf("%s deployment currently %s (since %s)",
cases.Title(language.English, cases.NoLower).String(string(summary.Deployment.Strategy)),
summary.Deployment.StatusReason,
lastStatusChangeTime)
} else {
var sb strings.Builder
sb.WriteString(fmt.Sprintf("%s deployment currently %s.",
return fmt.Sprintf("%s deployment currently %s.",
cases.Title(language.English, cases.NoLower).String(string(summary.Deployment.Strategy)),
summary.Deployment.StatusReason))

if summary.Deployment.Strategy == constant.DeploymentStrategyCanary && summary.Deployment.StatusReason == constant.DeploymentStatusReasonPaused {
sb.WriteString("\n")
sb.WriteString(fmt.Sprintf(
"Please run `cf continue-deployment %s` to promote the canary deployment, or `cf cancel-deployment %s` to rollback to the previous version.",
summary.Application.Name, summary.Application.Name))
}
return sb.String()
summary.Deployment.StatusReason)
}
}

Expand Down
Loading
Loading