feat: add link for viewing raw build logs in workspace and template build jobs (#21727)

* Adds support for parameter `format=text` in the following API routes:
  * `/api/v2/workspaceagents/:id/logs`
  * `/api/v2/workspacebuilds/:id/logs`
  * `/api/v2/templateversions/:id/logs` 
  * `/api/v2/templateversions/:id/dry-run/:id/logs` 

* Adds links to view raw logs on the following pages:
  * Workspace build page
  * Template editor page
  * Template version page

* Refactors existing log formatting in `cli/logs.go` to live in `codersdk`.

🤖 Generated with Claude Opus 4.5, reviewed by me.

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Cian Johnston
2026-02-03 09:45:23 +00:00
committed by GitHub
co-authored by Claude
parent f75cbab6ce
commit 353ebd9664
20 changed files with 863 additions and 120 deletions
+40
View File
@@ -6722,6 +6722,16 @@ const docTemplate = `{
"description": "Follow log stream",
"name": "follow",
"in": "query"
},
{
"enum": [
"json",
"text"
],
"type": "string",
"description": "Log output format. Accepted: 'json' (default), 'text' (plain text with RFC3339 timestamps and ANSI colors). Not supported with follow=true.",
"name": "format",
"in": "query"
}
],
"responses": {
@@ -6981,6 +6991,16 @@ const docTemplate = `{
"description": "Follow log stream",
"name": "follow",
"in": "query"
},
{
"enum": [
"json",
"text"
],
"type": "string",
"description": "Log output format. Accepted: 'json' (default), 'text' (plain text with RFC3339 timestamps and ANSI colors). Not supported with follow=true.",
"name": "format",
"in": "query"
}
],
"responses": {
@@ -9944,6 +9964,16 @@ const docTemplate = `{
"description": "Disable compression for WebSocket connection",
"name": "no_compression",
"in": "query"
},
{
"enum": [
"json",
"text"
],
"type": "string",
"description": "Log output format. Accepted: 'json' (default), 'text' (plain text with RFC3339 timestamps and ANSI colors). Not supported with follow=true.",
"name": "format",
"in": "query"
}
],
"responses": {
@@ -10239,6 +10269,16 @@ const docTemplate = `{
"description": "Follow log stream",
"name": "follow",
"in": "query"
},
{
"enum": [
"json",
"text"
],
"type": "string",
"description": "Log output format. Accepted: 'json' (default), 'text' (plain text with RFC3339 timestamps and ANSI colors). Not supported with follow=true.",
"name": "format",
"in": "query"
}
],
"responses": {