22 Commits

Author SHA1 Message Date
Allison Larson
17d191ae24 Add -group flag to alloc exec, alloc logs command (#25568)
* Add -group flag to `alloc exec`, `alloc logs` command

* fixup! Add -group flag to `alloc exec`, `alloc logs` command

* Add -group option to alloc fs

* Add changelog
2025-03-31 14:17:45 -07:00
Phil Renaud
fb14c2b556 [ui] Actions service and flyout (#19084)
* Initial pass at a global actions instance queue

* Action card with a bunch of functionality that needs to be pared back a bit

* Happy little actions button

* runAction performs updated to use actions service

* Stop All and Clear Finished buttons

* Keyboard service now passes element, so we can pseudo-click the actions dropdown

* resizable sidebar code blocks

* Contextual actions within task and job levels

* runAction greatly consolidated

* Pluralize action text

* Peer grouping of flyout action intances

* ShortIDs instead of full alloc IDs

* Testfixes that previously depended on notifications

* Stop and stop all for peered action instances

* Job name in action instance card linkable

* Componentized actions global button

* scss consolidation

* Clear and Stop buttons become mutually exclusive in an action card

* Clean up action card title styles a bit

* todo-bashing

* stopAll and stopPeers separated and fixed up

* Socket handling functions moved to the Actions service

* Error handling on socket message

* Smarter import

* Documentation note: need alloc-exec and alloc-raw-exec for raw_exec jobs

* Tests for flyout and dropdown actions

* Docs link when in empty flyout/queue state and percy snapshot test for it
2023-11-26 23:46:44 -05:00
Piotr Kazmierczak
7c6863b479 cli: setup vault command (#18910)
An interactive setup helper for configuring Vault to accept Nomad WI-enabled
workloads.

---------

Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
2023-11-07 10:42:00 +01:00
Phil Renaud
8902afe651 Nomad Actions (#18794)
* Scaffolding actions (#18639)

* Task-level actions for job submissions and retrieval

* FIXME: Temporary workaround to get ember dev server to pass exec through to 4646

* Update api/tasks.go

Co-authored-by: Tim Gross <tgross@hashicorp.com>

* Update command/agent/job_endpoint.go

Co-authored-by: Tim Gross <tgross@hashicorp.com>

* Diff and copy implementations

* Action structs get their own file, diff updates to behave like our other diffs

* Test to observe actions changes in a version update

* Tests migrated into structs/diff_test and modified with PR comments in mind

* APIActionToSTructsAction now returns a new value

* de-comment some plain parts, remove unused action lookup

* unused param in action converter

---------

Co-authored-by: Tim Gross <tgross@hashicorp.com>

* New endpoint: job/:id/actions (#18690)

* unused param in action converter

* backing out of parse_job level and moved toward new endpoint level

* Adds taskName and taskGroupName to actions at job level

* Unmodified job mock actions tests

* actionless job test

* actionless job test

* Multi group multi task actions test

* HTTP method check for GET, cleaner errors in job_endpoint_test

* decomment

* Actions aggregated at job model level (#18733)

* Removal of temporary fix to proxy to 4646

* Run Action websocket endpoint (#18760)

* Working demo for review purposes

* removal of cors passthru for websockets

* Remove job_endpoint-specific ws handlers and aimed at existing alloc exec handlers instead

* PR comments adressed, no need for taskGroup pass, better group and task lookups from alloc

* early return in action validate and removed jobid from req args per PR comments

* todo removal, we're checking later in the rpc

* boolean style change on tty

* Action CLI command (#18778)

* Action command init and stuck-notes

* Conditional reqpath to aim at Job action endpoint

* De-logged

* General CLI command cleanup, observe namespace, pass action as string, get random alloc w group adherence

* tab and varname cleanup

* Remove action param from Allocations().Exec calls

* changelog

* dont nil-check acl

---------

Co-authored-by: Tim Gross <tgross@hashicorp.com>
2023-10-20 13:05:55 -04:00
hashicorp-copywrite[bot]
a9d61ea3fd Update copyright file headers to BUSL-1.1 2023-08-10 17:27:29 -05:00
Tim Gross
4fb5bf9a16 cli: support wildcard namespace in alloc subcommands (#18095)
The alloc exec and filesystem/logs commands allow passing the `-job` flag to
select a random allocation. If the namespace for the command is set to `*`, the
RPC handler doesn't handle this correctly as it's expecting to query for a
specific job. Most commands handle this ambiguity by first verifying that only a
single object of the type in question exists (ex. a single node or job).

Update these commands so that when the `-job` flag is set we first verify
there's a single job that matches. This also allows us to extend the
functionality to allow for the `-job` flag to support prefix matching.

Fixes: #12097
2023-07-31 13:15:15 -04:00
hashicorp-copywrite[bot]
f005448366 [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00: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
James Rasell
ab9ba35e6a chore: fixup inconsistent method receiver names. (#11704) 2021-12-20 11:44:21 +01:00
Kris Hicks
d5ea0042ed Refactor alloc exec command (#9718)
This re-arranges the alloc exec Run implementation to have validation
hoisted as high as possible.
2021-01-05 09:33:04 -08:00
Kris Hicks
85ed8ddd4f Add gosimple linter (#9590) 2020-12-09 11:05:18 -08: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
Mahmood Ali
f376f7338c cli: query all namespaces for alloc subcommands 2020-06-17 16:31:06 -04:00
Buck Doyle
635f67b507 CLI: Remove duplicated error output (#6738) 2019-11-19 16:05:53 -06:00
Mahmood Ali
638434ae53 nomad exec: check stdout for tty as well
When inferring whether to use TTY, check both stdin and stdout are
terminals.

Otherwise, we get failures like the following:

```
$ nomad alloc exec --job example echo hi
hi
$ echo | nomad alloc exec --job example echo hi
hi
$ nomad alloc exec --job example echo hi | head -n1
failed to exec into task: not a terminal
```
2019-11-12 11:39:06 -05:00
Mahmood Ali
30b148c8d4 Restore tty start before emitting errors
Otherwise, the error message appears indented unexpectedly.
2019-05-17 11:58:31 -04:00
Mahmood Ali
eedd8e9e66 Implement escaping chrarcter for alloc exec 2019-05-16 16:22:52 -04:00
Mahmood Ali
c1c9d9b07d fix typo 2019-05-15 13:01:05 -04:00
Mahmood Ali
d675d28ff3 Handle Terminal Output state in Windows 2019-05-15 10:37:37 -04:00
Mahmood Ali
8bbc78a48a Add clarifying comments for negating -i or -t 2019-05-15 10:35:12 -04:00
Mahmood Ali
bad77f1ece add CLI commands for nomad exec 2019-05-12 22:04:50 -04:00