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

cli: add monitor flag to deployment status #10661

Merged
merged 2 commits into from
Jun 9, 2021
Merged

Conversation

isabeldepapel
Copy link
Contributor

@isabeldepapel isabeldepapel commented May 26, 2021

Fixes #6818

Adding '-verbose' will print out the allocation information for the
deployment. This also changes the job run command so that it now blocks
until deployment is complete and adds timestamps to the output so that
it's more in line with the output of node drain.

This uses glint to print in place in running in a tty. Because glint
doesn't yet support cmd/powershell, Windows workflows use a different
library to print in place, which results in slightly different
formatting: 1) different margins, and 2) no spinner indicating
deployment in progress.

@apollo13
Copy link
Contributor

apollo13 commented Jun 1, 2021

I'd love to see something like that added to nomad job run as well, ie after submitting monitor the deployment (would be very useful for CI scripts to see the result of the deployment). Basically like levant does :)

@tgross
Copy link
Member

tgross commented Jun 1, 2021

Hi @apollo13! This PR is associated with @isabeldepapel's work on #6818 which is intended to implement just that.

Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @isabeldepapel! I've left a few suggestions / questions but nothing that should be a show-stopper. If you want to do the docs updates in a separate PR that's fine too, so long as they land in the same release.

command/agent/testagent.go Show resolved Hide resolved
command/deployment_status.go Outdated Show resolved Hide resolved
command/deployment_status.go Outdated Show resolved Hide resolved

switch status {
case structs.DeploymentStatusFailed:
if hasAutoRevert(deploy) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 This is a nice usability addition so that folks don't have to go rummaging around for it themselves.

command/deployment_status.go Outdated Show resolved Hide resolved
return
}

// Check for noop/no target rollbacks
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We slept before calling LatestDeployment above, which I think will work most of the time.

But if we have a cluster that's maybe in a troubled state with slow scheduling, can that LatestDeployment call potentially get the same deployment that just failed even though there eventually will be a rollback deployment? I think it's probably okay to bail out in that situation just because we probably don't have a good way of determining that, but let's flesh out this comment a bit to make sure that's clear to developers in case we want to revisit that decision later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I wasn't sure about sleeping since it didn't seem like the most robust way of getting the rollback but I couldn't think of anything better. Great suggestion on the comment though, will do

isabeldepapel and others added 2 commits June 9, 2021 14:08
Adding '-verbose' will print out the allocation information for the
deployment. This also changes the job run command so that it now blocks
until deployment is complete and adds timestamps to the output so that
it's more in line with the output of node drain.

This uses glint to print in place in running in a tty. Because glint
doesn't yet support cmd/powershell, Windows workflows use a different
library to print in place, which results in slightly different
formatting: 1) different margins, and 2) no spinner indicating
deployment in progress.
Glint pulled in an updated version of mitchellh/go-testing-interface
which broke some existing tests because the update added a Parallel()
method to testing.T. This switches to the standard library testing.TB
which doesn't have a Parallel() method.
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI options to follow/monitor deployments to completion
3 participants