42 Commits

Author SHA1 Message Date
Phil Renaud
35e1ea4328 [cli] UI URL hints for common CLI commands (#24454)
* Basic implementation for server members and node status

* Commands for alloc status and job status

* -ui flag for most commands

* url hints for variables

* url hints for job dispatch, evals, and deployments

* agent config ui.cli_url_links to disable

* Fix an issue where path prefix was presumed for variables

* driver uncomment and general cleanup

* -ui flag on the generic status endpoint

* Job run command gets namespaces, and no longer gets ui hints for --output flag

* Dispatch command hints get a namespace, and bunch o tests

* Lots of tests depend on specific output, so let's not mess with them

* figured out what flagAddress is all about for testServer, oof

* Parallel outside of test instances

* Browser-opening test, sorta

* Env var for disabling/enabling CLI hints

* Addressing a few PR comments

* CLI docs available flags now all have -ui

* PR comments addressed; switched the env var to be consistent and scrunched monitor-adjacent hints a bit more

* ui.Output -> ui.Warn; moves hints from stdout to stderr

* isTerminal check and parseBool on command option

* terminal.IsTerminal check removed for test-runner-not-being-terminal reasons
2025-03-07 13:23:35 -05:00
hashicorp-copywrite[bot]
a9d61ea3fd Update copyright file headers to BUSL-1.1 2023-08-10 17:27:29 -05:00
Luiz Aoqui
26d38837d3 cli: output errors when monitoring deployment (#17348) 2023-05-30 11:12:12 -04:00
hashicorp-copywrite[bot]
f005448366 [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
Tim Gross
89f4f2b7a6 cli: Fix a panic in deployment status when scheduling is slow (#16011)
If a deployment fails, the `deployment status` command can get a nil deployment
when it checks for a rollback deployment if there isn't one (or at least not one
at the time of the query). Fix the panic.
2023-02-02 12:34:44 -05:00
Luiz Aoqui
d439fe0d90 cli: improve errors for multiregion deployments (#15326)
Co-authored-by: Piotr Kazmierczak <470696+pkazmierczak@users.noreply.github.com>
2022-11-23 16:40:13 -05:00
Jack
66c61e4fd2 cli: wait flag for use with deployment status -monitor (#15262) 2022-11-23 16:36:13 -05:00
James Rasell
581390bed1 cli: do not import structs, use API package only. (#13938) 2022-08-02 16:33:08 +02:00
Yoan Blanc
fdd8f39eb8 feat: docker/docker/pkg/term has been deprecated in favor of moby/term
See https://github.com/moby/moby/pull/40825

Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2022-06-26 15:35:27 +02:00
Lukas W
bb1fc6ec5f CLI: Return non-zero exit code when deployment fails in nomad run (#11550)
* Exit non-zero from run command if deployment fails
* Fix typo in deployment monitor introduced in 0edda11
2021-12-09 09:09:28 -05:00
Mahmood Ali
44ea61ef3a cli: Use glint to determine if os.Stdout is tty (#10926)
Use glint to determine if os.Stdout is a terminal.

glint Terminal renderer expects os.Stdout [not only to be a terminal, but also to have non-zero size](b492b545f6/renderer_term.go (L39-L46)). It's unclear how this condition arises, but this additional check causes Nomad to render deployments progress through glint when glint cannot support it.

By using golint to perform the check, we eliminate the risk of mis-judgement.
2021-07-23 11:27:47 -04:00
Kent 'picat' Gruber
4bcc72da1a Handle DeploymentStatusFailed unless hasAutoRevert 2021-07-15 17:06:13 -04:00
Kent 'picat' Gruber
440d556fdb Handle successful/canceled/blocked deployments in CLI output
Otherwise the spinner would just end, which felt a bit awkward.

I wanted to see a  "✓" to know that everything was ok, and a "!" (maybe something else?) if something went wrong.
2021-07-09 19:27:55 -04:00
Isabel Suchanek
ca010f9f87 cli: check deployment exists before monitoring (#10757)
System and batch jobs don't create deployments, which means nomad tries
to monitor a non-existent deployment when it runs a job and outputs an
error message. This adds a check to make sure a deployment exists before
monitoring. Also fixes some formatting.

Co-authored-by: Tim Gross <tgross@hashicorp.com>
2021-06-14 16:42:38 -07:00
Isabel Suchanek
0edda116ad cli: add monitor flag to deployment status
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.
2021-06-09 16:18:45 -07:00
Yoan Blanc
a814f0253f chore: bump golangci-lint from v1.24 to v1.39
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2021-04-03 09:50:23 +02:00
Tim Gross
8a66f11bb3 docs: describe required ACLs for all commands 2020-11-20 13:38:29 -05:00
Tim Gross
89f4f51746 command: remove -namespace from help options when not applicable 2020-11-19 16:28:39 -05:00
Drew Bailey
ce8f230cab Multiregion deploy status and job status CLI 2020-06-17 11:03:34 -04:00
Lang Martin
1bcb8f5afb command: deployment status without a prefix lists deployments (#7821) 2020-04-28 15:11:32 -04:00
Alex Dadgar
eb6a99a6d8 CLI 2018-05-07 14:50:01 -05:00
Nick Ethier
0216a8e377 command: use ':' instead of ',' in error msg 2018-04-18 13:55:51 -04:00
Nick Ethier
45b0ce9177 command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
Alex Dadgar
f6fbb36054 sync 2017-10-13 14:36:02 -07:00
piotr.krolikowski
395161c442 Fix panic while running latest deployment command 2017-09-06 20:26:22 +02:00
Alex Dadgar
0aec2c7399 Sort task groups when displaying a deployment
Fixes https://github.com/hashicorp/nomad/issues/3131
2017-08-30 10:41:34 -07:00
Alex Dadgar
5d65af523d Check for errors initializing client for autocomplete 2017-08-29 14:29:32 -07:00
Alex Dadgar
ce3c316592 don't limit on one arg 2017-08-28 13:40:04 -07:00
Alex Dadgar
85a1899dfa Reduce startup time on Mac
This PR moves creating the API client into the returned predict
function. The creation of the client causes a lookup of all the system
certificates and doing that for each command on mac was extremely slow.
2017-08-28 11:29:27 -07:00
Alex Dadgar
4d97b302a0 Search respects QueryOptions and returns QueryMeta
@chelseakomlo heads up on this change
2017-08-27 22:17:51 -07:00
Chelsea Holland Komlo
e88228cc5d add global flags to autocomplete 2017-08-23 22:58:44 +00:00
Chelsea Holland Komlo
335cf888b0 use PredictAnything when an flag accepts an argument 2017-08-23 22:58:44 +00:00
Chelsea Holland Komlo
c1e5c7132a enable autocompletion of flags 2017-08-23 22:57:07 +00:00
Alex Dadgar
3ae8ecb32f Autocomplete deployment commands 2017-08-22 13:05:24 -07:00
Alex Dadgar
487e1eafee New commands docs and small fixes
This PR adds the command documentations and has small CLI fixes.
2017-07-25 17:37:09 -07:00
Alex Dadgar
3cd8d50bbc Multiple matched objects now treated as an error condition. 2017-07-20 17:31:07 -07:00
Alex Dadgar
bdb71e7074 Small fixes and UX changes 2017-07-19 13:34:24 -07:00
Alex Dadgar
d06fa455b7 Small fixes 2017-07-07 17:34:50 -07:00
Alex Dadgar
466702a2db deployment status in job status view 2017-07-07 12:12:48 -07:00
Alex Dadgar
5bcf2dd1f0 deployment status indicates whether canaries were promoted 2017-07-07 12:12:48 -07:00
Alex Dadgar
468c886282 Formatting abilities 2017-07-07 12:07:07 -07:00
Alex Dadgar
bab25f6834 deployment status 2017-07-07 12:07:07 -07:00