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

Actions: Handle Action failure in the /job/action endpoint and UI #19387

Open
philrenaud opened this issue Dec 8, 2023 · 0 comments
Open

Actions: Handle Action failure in the /job/action endpoint and UI #19387

philrenaud opened this issue Dec 8, 2023 · 0 comments
Labels
hcc/bff Internal: server-side stuff in a client-side world theme/actions Nomad Task Actions type/enhancement

Comments

@philrenaud
Copy link
Contributor

philrenaud commented Dec 8, 2023

Currently, the nomad job action CLI command handles unsuccessful actions with an error. Try, for example, running an action to curl a 404ing url and compare the output of the operator API and the CLI:

nomad operator api \
-H "Connection: Upgrade" \
-H "Upgrade: websocket" \
-H "Sec-WebSocket-Version: 13" \
-H "Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==" \
-verbose \
'/v1/job/actions-demo/action?action=ipinfo&allocID=06273d00-579c-1415-be3a-444ae4bcc03c&task=task&tty=true'
> GET /v1/job/actions-demo/action HTTP/1.1
> Connection: Upgrade
> Upgrade: websocket
> Sec-Websocket-Version: 13
> Sec-Websocket-Key: x3JJHMbDL1EzLkh9GBhXDw==
>
* Sending request and receiving response...
< HTTP/1.1 101 Switching Protocols
< Upgrade: websocket
< Connection: Upgrade
< Sec-Websocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk=
{"stdout":{"data":"Y3VybA=="}}R{"stdout":{"data":"OiAoNikgQ291bGQgbm90IHJlc29sdmUgaG9zdDogaXBpbmZvLmlvb28NCg=="}}{"stdout":{"close":true}}({"exited":true,"result":{"exit_code":6}}�[1m%                                              
nomad job action \
  -group=group \
  -task=task \
  -job=actions-demo \
  -t=true \
ipinfo
curl: (6) Could not resolve host: ipinfo.iooo
image

The socket provides an exit code in its exited frame, but that's not enough to show the wrapping connection as an error.

Provide a stderr message frame or otherwise return an error for the websocket connection.


(Note! This may be front-end solvable: an action that fails a curl request/404s will send back an exit code of 6 like this: {"exited":true,"result":{}}, which we could respond to here)

image
@philrenaud philrenaud added type/enhancement theme/actions Nomad Task Actions hcc/bff Internal: server-side stuff in a client-side world labels Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hcc/bff Internal: server-side stuff in a client-side world theme/actions Nomad Task Actions type/enhancement
Projects
None yet
Development

No branches or pull requests

1 participant