Merge pull request #10886 from hashicorp/cli-handle-successful-deployment

Handle successful/canceled/blocked deployments in CLI output
This commit is contained in:
Kent 'picat' Gruber 2021-07-16 12:27:22 -04:00 committed by GitHub
commit decd59dbd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -319,9 +319,20 @@ UPDATE:
c.ttyMonitor(client, rollback.ID, index, verbose)
return
} else {
endSpinner = glint.Layout(
glint.Text(fmt.Sprintf("! Deployment %q %s", limit(deployID, length), status)),
).Row().MarginLeft(2)
break UPDATE
}
case structs.DeploymentStatusSuccessful, structs.DeploymentStatusCancelled, structs.DeploymentStatusDescriptionBlocked:
case structs.DeploymentStatusSuccessful:
endSpinner = glint.Layout(
glint.Text(fmt.Sprintf("✓ Deployment %q %s", limit(deployID, length), status)),
).Row().MarginLeft(2)
break UPDATE
case structs.DeploymentStatusCancelled, structs.DeploymentStatusDescriptionBlocked:
endSpinner = glint.Layout(
glint.Text(fmt.Sprintf("! Deployment %q %s", limit(deployID, length), status)),
).Row().MarginLeft(2)
break UPDATE
default:
q.WaitIndex = meta.LastIndex

View File

@ -104,7 +104,7 @@ Monitor the status of a deployment that fails and has `auto_revert` set to `true
```shell-session
$ nomad deployment status -monitor e45
2021-06-09T15:49:19-07:00: Monitoring deployment "e45cc3c1"
Deployment "e45cc3c1" failed
! Deployment "e45cc3c1" failed
2021-06-09T15:49:48-07:00
ID = e45cc3c1

View File

@ -153,7 +153,7 @@ $ nomad job run -check-index 6 example.nomad
2021-06-09T16:57:30-07:00: Evaluation status changed: "pending" -> "complete"
==> 2021-06-09T16:57:30-07:00: Evaluation "5ef16dff" finished with status "complete"
==> 2021-06-09T16:57:30-07:00: Monitoring deployment "62eb607c"
Deployment "62eb607c" successful
Deployment "62eb607c" successful
2021-06-09T16:57:30-07:00
ID = 62eb607c