Skip to content

feat(coderd): add support for external agents to API's and provisioner #19286

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

Merged
merged 14 commits into from
Aug 19, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Add HasExternalAgent to TemplateVersion response
  • Loading branch information
kacpersaw committed Aug 19, 2025
commit 10e6853fca643b380793e743c05e92d5fff96ac7
5 changes: 4 additions & 1 deletion coderd/apidoc/docs.go

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

5 changes: 4 additions & 1 deletion coderd/apidoc/swagger.json

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

1 change: 1 addition & 0 deletions coderd/templateversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -1963,6 +1963,7 @@ func convertTemplateVersion(version database.TemplateVersion, job codersdk.Provi
Archived: version.Archived,
Warnings: warnings,
MatchedProvisioners: matchedProvisioners,
HasExternalAgent: version.HasExternalAgent.Bool,
}
}

Expand Down
33 changes: 33 additions & 0 deletions coderd/templateversions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2221,3 +2221,36 @@ func TestTemplateArchiveVersions(t *testing.T) {
require.NoError(t, err, "fetch all versions")
require.Len(t, remaining, totalVersions-len(expArchived)-len(allFailed)+1, "remaining versions")
}

func TestTemplateVersionHasExternalAgent(t *testing.T) {
t.Parallel()

client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true})
user := coderdtest.CreateFirstUser(t, client)

ctx := testutil.Context(t, testutil.WaitMedium)
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
Parse: echo.ParseComplete,
ProvisionPlan: []*proto.Response{
{
Type: &proto.Response_Plan{
Plan: &proto.PlanComplete{
Resources: []*proto.Resource{
{
Name: "example",
Type: "coder_external_agent",
},
},
HasExternalAgents: true,
},
},
},
},
ProvisionApply: echo.ApplyComplete,
})
coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID)

version, err := client.TemplateVersion(ctx, version.ID)
require.NoError(t, err)
require.True(t, version.HasExternalAgent)
}
2 changes: 2 additions & 0 deletions codersdk/templateversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type TemplateVersion struct {

Warnings []TemplateVersionWarning `json:"warnings,omitempty" enums:"DEPRECATED_PARAMETERS"`
MatchedProvisioners *MatchedProvisioners `json:"matched_provisioners,omitempty"`

HasExternalAgent bool `json:"has_external_agent"`
}

type TemplateVersionExternalAuth struct {
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/api/schemas.md

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

9 changes: 9 additions & 0 deletions docs/reference/api/templates.md

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

2 changes: 1 addition & 1 deletion docs/reference/api/workspaces.md

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

1 change: 1 addition & 0 deletions site/src/api/typesGenerated.ts

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

2 changes: 2 additions & 0 deletions site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,7 @@ You can add instructions here
[Some link info](https://coder.com)`,
created_by: MockUserOwner,
archived: false,
has_external_agent: false,
};

export const MockTemplateVersion2: TypesGen.TemplateVersion = {
Expand All @@ -751,6 +752,7 @@ You can add instructions here
[Some link info](https://coder.com)`,
created_by: MockUserOwner,
archived: false,
has_external_agent: false,
};

export const MockTemplateVersionWithMarkdownMessage: TypesGen.TemplateVersion =
Expand Down