-
Notifications
You must be signed in to change notification settings - Fork 330
cli/status: Add a '-refresh' flag to regenerate project applications status on request #2081
Conversation
This commit introduces a new flag, `-refresh`, which will refresh all of the requested status reports for the current view from running `waypoint status`. This means if you refresh a refresh for a project view, all of that projects applications will be refreshed. If you request a single app, only that app will be refreshed, etc.
This commit adds a new package for CLI callers to watch an already queued jobs output and stream it directly to the configured UI terminal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my big comments here is that the CLI subcommand is painfully aware and logic-divergent on whether this is "local" or "remote". All our other tasks also have this distinction, but this is handled at the CLI layer (does it go to a local runner, or remote?).
My opinion is that the CLI implementation should probably just schedule a status report refresh job no matter what and let the local vs remote runner handle that properly. The machinery all gets wired through automatically. This is how every other operation works afaik.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an error case that needs handled, I believe. See comments.
Co-authored-by: Rae Krantz <[email protected]>
No longer required
136d2ec
to
66c50b6
Compare
66c50b6
to
d7a4939
Compare
This commit introduces a new CLI option, WithOptionalApp, which allows CLIs like `status` to optionally be initialized with a config and a project client without a hard requirement on an app existing. It now uses DoApp directly to run a status report job. If the project is remote, and the CLI is not inside the project dir, it sets the ref app for the project client to use when queueing the status report job.
d7a4939
to
62a00c0
Compare
@@ -101,6 +102,15 @@ func (c *StatusCommand) Run(args []string) int { | |||
c.ui.Output(wpAppFlagAndTargetIncludedMsg, terminal.WithWarningStyle()) | |||
} | |||
|
|||
// Optionally refresh status | |||
if c.flagRefreshAppStatus { | |||
if err := c.RefreshApplicationStatus(projectTarget, appTarget); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential optimization: if they specify a -app flag, we don't need to refresh status on every app in the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should happen already!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gave it a whirl again, and my main points of confusion are more related to how Waypoint manages apps and projects. Which is something I need to fix 😅
-refresh
works well!
This pull request introduces a new flag,
-refresh
, which will refresh all of the requested status reports for the current view from runningwaypoint status
. This means if you refresh a refresh for a project view, all of that projects applications will be refreshed. If you request a single app, only that app will be refreshed, etc.