mirror of
https://github.com/coder/coder.git
synced 2025-07-08 11:39:50 +00:00
3
coderd/apidoc/docs.go
generated
3
coderd/apidoc/docs.go
generated
@ -11142,6 +11142,9 @@ const docTemplate = `{
|
||||
"codersdk.WorkspaceAgent": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"api_version": {
|
||||
"type": "string"
|
||||
},
|
||||
"apps": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
3
coderd/apidoc/swagger.json
generated
3
coderd/apidoc/swagger.json
generated
@ -10108,6 +10108,9 @@
|
||||
"codersdk.WorkspaceAgent": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"api_version": {
|
||||
"type": "string"
|
||||
},
|
||||
"apps": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
@ -6308,6 +6308,7 @@ func (q *FakeQuerier) UpdateWorkspaceAgentStartupByID(_ context.Context, arg dat
|
||||
}
|
||||
|
||||
agent.Version = arg.Version
|
||||
agent.APIVersion = arg.APIVersion
|
||||
agent.ExpandedDirectory = arg.ExpandedDirectory
|
||||
agent.Subsystems = arg.Subsystems
|
||||
q.workspaceAgents[index] = agent
|
||||
|
@ -8039,7 +8039,8 @@ UPDATE
|
||||
SET
|
||||
version = $2,
|
||||
expanded_directory = $3,
|
||||
subsystems = $4
|
||||
subsystems = $4,
|
||||
api_version = $5
|
||||
WHERE
|
||||
id = $1
|
||||
`
|
||||
@ -8049,6 +8050,7 @@ type UpdateWorkspaceAgentStartupByIDParams struct {
|
||||
Version string `db:"version" json:"version"`
|
||||
ExpandedDirectory string `db:"expanded_directory" json:"expanded_directory"`
|
||||
Subsystems []WorkspaceAgentSubsystem `db:"subsystems" json:"subsystems"`
|
||||
APIVersion string `db:"api_version" json:"api_version"`
|
||||
}
|
||||
|
||||
func (q *sqlQuerier) UpdateWorkspaceAgentStartupByID(ctx context.Context, arg UpdateWorkspaceAgentStartupByIDParams) error {
|
||||
@ -8057,6 +8059,7 @@ func (q *sqlQuerier) UpdateWorkspaceAgentStartupByID(ctx context.Context, arg Up
|
||||
arg.Version,
|
||||
arg.ExpandedDirectory,
|
||||
pq.Array(arg.Subsystems),
|
||||
arg.APIVersion,
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
@ -69,7 +69,8 @@ UPDATE
|
||||
SET
|
||||
version = $2,
|
||||
expanded_directory = $3,
|
||||
subsystems = $4
|
||||
subsystems = $4,
|
||||
api_version = $5
|
||||
WHERE
|
||||
id = $1;
|
||||
|
||||
|
@ -250,6 +250,8 @@ func (api *API) workspaceAgentManifest(rw http.ResponseWriter, r *http.Request)
|
||||
})
|
||||
}
|
||||
|
||||
const AgentAPIVersionREST = "1.0"
|
||||
|
||||
// @Summary Submit workspace agent startup
|
||||
// @ID submit-workspace-agent-startup
|
||||
// @Security CoderSessionToken
|
||||
@ -321,6 +323,7 @@ func (api *API) postWorkspaceAgentStartup(rw http.ResponseWriter, r *http.Reques
|
||||
Version: req.Version,
|
||||
ExpandedDirectory: req.ExpandedDirectory,
|
||||
Subsystems: convertWorkspaceAgentSubsystems(req.Subsystems),
|
||||
APIVersion: AgentAPIVersionREST,
|
||||
}); err != nil {
|
||||
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
|
||||
Message: "Error setting agent version",
|
||||
@ -1542,6 +1545,7 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator tailnet.Coordin
|
||||
LogsOverflowed: dbAgent.LogsOverflowed,
|
||||
LogSources: logSources,
|
||||
Version: dbAgent.Version,
|
||||
APIVersion: dbAgent.APIVersion,
|
||||
EnvironmentVariables: envs,
|
||||
Directory: dbAgent.Directory,
|
||||
ExpandedDirectory: dbAgent.ExpandedDirectory,
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"cdr.dev/slog"
|
||||
"cdr.dev/slog/sloggers/slogtest"
|
||||
"github.com/coder/coder/v2/agent/agenttest"
|
||||
"github.com/coder/coder/v2/coderd"
|
||||
"github.com/coder/coder/v2/coderd/coderdtest"
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
"github.com/coder/coder/v2/coderd/database/dbtime"
|
||||
@ -1367,6 +1368,7 @@ func TestWorkspaceAgent_Startup(t *testing.T) {
|
||||
require.Equal(t, expectedDir, wsagent.ExpandedDirectory)
|
||||
// Sorted
|
||||
require.Equal(t, expectedSubsystems, wsagent.Subsystems)
|
||||
require.Equal(t, coderd.AgentAPIVersionREST, wsagent.APIVersion)
|
||||
})
|
||||
|
||||
t.Run("InvalidSemver", func(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user