Skip to content

feat: coder-attach: add support for external workspaces #19178

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 34 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3ea541e
Add attach command and API endpoints for init-script and external age…
kacpersaw Jul 23, 2025
4818df1
add has_external_agents column to template_versions table
kacpersaw Jul 24, 2025
4bfdb83
add external workspace creation and agent instruction commands to cli
kacpersaw Jul 28, 2025
1044051
add has_external_agent to workspace builds
kacpersaw Jul 29, 2025
fd2458b
add list command for external workspaces
kacpersaw Jul 30, 2025
0c39f50
add AgentExternal component to display external agent connection deta…
kacpersaw Jul 30, 2025
23e555a
Merge remote-tracking branch 'origin/main' into kacpersaw/feat-coder-…
kacpersaw Jul 31, 2025
f9f5be1
add tests
kacpersaw Jul 31, 2025
e281f0e
Delete coder attach golden
kacpersaw Aug 5, 2025
d77522d
Hide agent apps when connecting & is external agent
kacpersaw Aug 5, 2025
451c806
Merge remote-tracking branch 'origin/main' into kacpersaw/feat-coder-…
kacpersaw Aug 5, 2025
f9274fe
Reformat code
kacpersaw Aug 5, 2025
00b6f26
Merge remote-tracking branch 'origin/main' into kacpersaw/feat-coder-…
kacpersaw Aug 6, 2025
c019a31
bump provisionerd proto version to v1.9
kacpersaw Aug 6, 2025
7d07857
Add beforeCreate and afterCreate to create handler, apply review sugg…
kacpersaw Aug 6, 2025
c462a69
Refactor init-script endpoint to use path params instead of query params
kacpersaw Aug 6, 2025
2d2dfec
Refactor init-script endpoint, apply review suggestions for db
kacpersaw Aug 6, 2025
387fc04
Apply FE review suggestions
kacpersaw Aug 6, 2025
c2588ea
Return 404 if workspace agent is authenticated through instance id
kacpersaw Aug 6, 2025
33dd778
Merge UpdateTemplateVersionAITaskByJobID and UpdateTemplateVersionExt…
kacpersaw Aug 7, 2025
c413479
update external agent credentials to include command in response
kacpersaw Aug 7, 2025
3c1d694
Bump terraform-provider-coder to v2.10.0
kacpersaw Aug 8, 2025
73acd0f
Merge remote-tracking branch 'origin/main' into kacpersaw/feat-coder-…
kacpersaw Aug 8, 2025
7cc6861
Regenerate sql
kacpersaw Aug 8, 2025
da68c20
Fix lint & tests
kacpersaw Aug 8, 2025
2e24741
Regenerate dump.sql
kacpersaw Aug 8, 2025
682ea60
Fix provision test
kacpersaw Aug 8, 2025
51967a5
update external agent credentials summary and adjust authorization ch…
kacpersaw Aug 8, 2025
f060324
merge UpdateWorkspaceBuildAITaskByID with UpdateWorkspaceBuildExterna…
kacpersaw Aug 8, 2025
ff6e8fa
Apply suggestions from code review
kacpersaw Aug 8, 2025
e2a7182
Apply review suggestions
kacpersaw Aug 8, 2025
141bc54
Merge branch 'main' into kacpersaw/feat-coder-attach
kacpersaw Aug 8, 2025
a75c1f4
make gen
kacpersaw Aug 8, 2025
22f2c00
Merge remote-tracking branch 'origin/main' into kacpersaw/feat-coder-…
kacpersaw Aug 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/main' into kacpersaw/feat-coder-…
…attach

# Conflicts:
#	coderd/database/dump.sql
#	coderd/database/modelqueries.go
#	coderd/database/queries.sql.go
#	coderd/database/queries/templates.sql
#	coderd/searchquery/search.go
#	coderd/searchquery/search_test.go
  • Loading branch information
kacpersaw committed Aug 8, 2025
commit 73acd0f84e2f9e955dfd9fb73ad1aa705af81b7c
7 changes: 4 additions & 3 deletions coderd/database/dump.sql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions coderd/database/modelqueries.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ func (q *sqlQuerier) GetAuthorizedTemplates(ctx context.Context, arg GetTemplate
pq.Array(arg.IDs),
arg.Deprecated,
arg.HasAITask,
arg.AuthorID,
arg.AuthorUsername,
arg.HasExternalAgent,
)
if err != nil {
Expand Down
63 changes: 40 additions & 23 deletions coderd/database/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions coderd/database/queries/templates.sql
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ WHERE
tv.has_ai_task = sqlc.narg('has_ai_task') :: boolean
ELSE true
END
-- Filter by author_id
AND CASE
WHEN @author_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN
t.created_by = @author_id
ELSE true
END
-- Filter by author_username
AND CASE
WHEN @author_username :: text != '' THEN
t.created_by = (SELECT id FROM users WHERE lower(users.username) = lower(@author_username) AND deleted = false)
ELSE true
END

-- Filter by has_external_agent in latest version
AND CASE
WHEN sqlc.narg('has_external_agent') :: boolean IS NOT NULL THEN
Expand Down
21 changes: 14 additions & 7 deletions coderd/searchquery/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,23 @@ func Templates(ctx context.Context, db database.Store, actorID uuid.UUID, query

parser := httpapi.NewQueryParamParser()
filter := database.GetTemplatesWithFilterParams{
Deleted: parser.Boolean(values, false, "deleted"),
ExactName: parser.String(values, "", "exact_name"),
FuzzyName: parser.String(values, "", "name"),
IDs: parser.UUIDs(values, []uuid.UUID{}, "ids"),
Deprecated: parser.NullableBoolean(values, sql.NullBool{}, "deprecated"),
OrganizationID: parseOrganization(ctx, db, parser, values, "organization"),
HasAITask: parser.NullableBoolean(values, sql.NullBool{}, "has-ai-task"),
Deleted: parser.Boolean(values, false, "deleted"),
OrganizationID: parseOrganization(ctx, db, parser, values, "organization"),
ExactName: parser.String(values, "", "exact_name"),
FuzzyName: parser.String(values, "", "name"),
IDs: parser.UUIDs(values, []uuid.UUID{}, "ids"),
Deprecated: parser.NullableBoolean(values, sql.NullBool{}, "deprecated"),
HasAITask: parser.NullableBoolean(values, sql.NullBool{}, "has-ai-task"),
AuthorID: parser.UUID(values, uuid.Nil, "author_id"),
AuthorUsername: parser.String(values, "", "author"),
HasExternalAgent: parser.NullableBoolean(values, sql.NullBool{}, "has-external-agent"),
}

if filter.AuthorUsername == codersdk.Me {
filter.AuthorID = actorID
filter.AuthorUsername = ""
}

parser.ErrorExcessParams(values)
return filter, parser.Errors
}
Expand Down
8 changes: 8 additions & 0 deletions coderd/searchquery/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,14 @@ func TestSearchTemplates(t *testing.T) {
},
},
},
{
Name: "MyTemplates",
Query: "author:me",
Expected: database.GetTemplatesWithFilterParams{
AuthorUsername: "",
AuthorID: userID,
},
},
}

for _, c := range testCases {
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.