Skip to content

feat: Add agent logs in API, show startup_script tail on error (SSH) #6060

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

Closed
wants to merge 1 commit into from

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Feb 6, 2023

This PR adds support for requesting logs (e.g. agent and startup script) from the agent. It also adds support for showing the tail of the startup logs when an error is encountered during startup.

Note that one API endpoint is named tail, although tailing functionality is kinda missing at the moment. The idea is for it to receive a follow option in the future, to stream new logs over e.g. long-polling, sse or websocket.

Not super happy with API duplication in both coder agent and coderd, but I didn't come up with a better solution since webUI can't establish connections to the agent.

Refs: #2957


Example of ssh into errored workspace:

❯ coder ssh test

 > The workspace ran into a problem while getting ready,
   the agent startup script exited with non-zero status.
   See troubleshooting instructions at:
   https://coder.com/docs/coder-oss/latest/templates#troubleshooting-templates

Showing up to the last 10 lines from startup_script:

[startup_script] +zsh:2> echo 'TEST_VAR: test'
[startup_script] TEST_VAR: test
[startup_script] +zsh:3> echo 'Sleeping 30 seconds...'
[startup_script] Sleeping 30 seconds...
[startup_script] +zsh:4> sleep 30
[startup_script] +zsh:5> echo 'This might fail...'
[startup_script] This might fail...
[startup_script] +zsh:6> false

Agent startup script exited with non-zero status, use --no-wait to login anyway.
Run 'coder ssh --help' for usage.

@mafredri mafredri force-pushed the mafredri/feat-agent-log-streaming branch 11 times, most recently from 0b45ef3 to 217b5d4 Compare February 8, 2023 13:55
@mafredri mafredri force-pushed the mafredri/feat-agent-log-streaming branch from 217b5d4 to ea8a61a Compare February 8, 2023 17:26
@github-actions
Copy link

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Feb 16, 2023
@github-actions github-actions bot closed this Feb 19, 2023
@kylecarbs kylecarbs reopened this Feb 22, 2023
@github-actions github-actions bot removed the stale This issue is like stale bread. label Feb 23, 2023
@github-actions
Copy link

github-actions bot commented Mar 3, 2023

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Mar 3, 2023
@github-actions github-actions bot closed this Mar 7, 2023
@mafredri mafredri mentioned this pull request Apr 21, 2023
4 tasks
@github-actions github-actions bot deleted the mafredri/feat-agent-log-streaming branch August 9, 2023 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale This issue is like stale bread.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants