mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
Generated
+3
@@ -11142,6 +11142,9 @@ const docTemplate = `{
|
|||||||
"codersdk.WorkspaceAgent": {
|
"codersdk.WorkspaceAgent": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"api_version": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"apps": {
|
"apps": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
|
|||||||
Generated
+3
@@ -10108,6 +10108,9 @@
|
|||||||
"codersdk.WorkspaceAgent": {
|
"codersdk.WorkspaceAgent": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"api_version": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"apps": {
|
"apps": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
|
|||||||
@@ -6308,6 +6308,7 @@ func (q *FakeQuerier) UpdateWorkspaceAgentStartupByID(_ context.Context, arg dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
agent.Version = arg.Version
|
agent.Version = arg.Version
|
||||||
|
agent.APIVersion = arg.APIVersion
|
||||||
agent.ExpandedDirectory = arg.ExpandedDirectory
|
agent.ExpandedDirectory = arg.ExpandedDirectory
|
||||||
agent.Subsystems = arg.Subsystems
|
agent.Subsystems = arg.Subsystems
|
||||||
q.workspaceAgents[index] = agent
|
q.workspaceAgents[index] = agent
|
||||||
|
|||||||
@@ -8039,7 +8039,8 @@ UPDATE
|
|||||||
SET
|
SET
|
||||||
version = $2,
|
version = $2,
|
||||||
expanded_directory = $3,
|
expanded_directory = $3,
|
||||||
subsystems = $4
|
subsystems = $4,
|
||||||
|
api_version = $5
|
||||||
WHERE
|
WHERE
|
||||||
id = $1
|
id = $1
|
||||||
`
|
`
|
||||||
@@ -8049,6 +8050,7 @@ type UpdateWorkspaceAgentStartupByIDParams struct {
|
|||||||
Version string `db:"version" json:"version"`
|
Version string `db:"version" json:"version"`
|
||||||
ExpandedDirectory string `db:"expanded_directory" json:"expanded_directory"`
|
ExpandedDirectory string `db:"expanded_directory" json:"expanded_directory"`
|
||||||
Subsystems []WorkspaceAgentSubsystem `db:"subsystems" json:"subsystems"`
|
Subsystems []WorkspaceAgentSubsystem `db:"subsystems" json:"subsystems"`
|
||||||
|
APIVersion string `db:"api_version" json:"api_version"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *sqlQuerier) UpdateWorkspaceAgentStartupByID(ctx context.Context, arg UpdateWorkspaceAgentStartupByIDParams) error {
|
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.Version,
|
||||||
arg.ExpandedDirectory,
|
arg.ExpandedDirectory,
|
||||||
pq.Array(arg.Subsystems),
|
pq.Array(arg.Subsystems),
|
||||||
|
arg.APIVersion,
|
||||||
)
|
)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ UPDATE
|
|||||||
SET
|
SET
|
||||||
version = $2,
|
version = $2,
|
||||||
expanded_directory = $3,
|
expanded_directory = $3,
|
||||||
subsystems = $4
|
subsystems = $4,
|
||||||
|
api_version = $5
|
||||||
WHERE
|
WHERE
|
||||||
id = $1;
|
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
|
// @Summary Submit workspace agent startup
|
||||||
// @ID submit-workspace-agent-startup
|
// @ID submit-workspace-agent-startup
|
||||||
// @Security CoderSessionToken
|
// @Security CoderSessionToken
|
||||||
@@ -321,6 +323,7 @@ func (api *API) postWorkspaceAgentStartup(rw http.ResponseWriter, r *http.Reques
|
|||||||
Version: req.Version,
|
Version: req.Version,
|
||||||
ExpandedDirectory: req.ExpandedDirectory,
|
ExpandedDirectory: req.ExpandedDirectory,
|
||||||
Subsystems: convertWorkspaceAgentSubsystems(req.Subsystems),
|
Subsystems: convertWorkspaceAgentSubsystems(req.Subsystems),
|
||||||
|
APIVersion: AgentAPIVersionREST,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
|
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
|
||||||
Message: "Error setting agent version",
|
Message: "Error setting agent version",
|
||||||
@@ -1542,6 +1545,7 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator tailnet.Coordin
|
|||||||
LogsOverflowed: dbAgent.LogsOverflowed,
|
LogsOverflowed: dbAgent.LogsOverflowed,
|
||||||
LogSources: logSources,
|
LogSources: logSources,
|
||||||
Version: dbAgent.Version,
|
Version: dbAgent.Version,
|
||||||
|
APIVersion: dbAgent.APIVersion,
|
||||||
EnvironmentVariables: envs,
|
EnvironmentVariables: envs,
|
||||||
Directory: dbAgent.Directory,
|
Directory: dbAgent.Directory,
|
||||||
ExpandedDirectory: dbAgent.ExpandedDirectory,
|
ExpandedDirectory: dbAgent.ExpandedDirectory,
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
"cdr.dev/slog"
|
"cdr.dev/slog"
|
||||||
"cdr.dev/slog/sloggers/slogtest"
|
"cdr.dev/slog/sloggers/slogtest"
|
||||||
"github.com/coder/coder/v2/agent/agenttest"
|
"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/coderdtest"
|
||||||
"github.com/coder/coder/v2/coderd/database"
|
"github.com/coder/coder/v2/coderd/database"
|
||||||
"github.com/coder/coder/v2/coderd/database/dbtime"
|
"github.com/coder/coder/v2/coderd/database/dbtime"
|
||||||
@@ -1367,6 +1368,7 @@ func TestWorkspaceAgent_Startup(t *testing.T) {
|
|||||||
require.Equal(t, expectedDir, wsagent.ExpandedDirectory)
|
require.Equal(t, expectedDir, wsagent.ExpandedDirectory)
|
||||||
// Sorted
|
// Sorted
|
||||||
require.Equal(t, expectedSubsystems, wsagent.Subsystems)
|
require.Equal(t, expectedSubsystems, wsagent.Subsystems)
|
||||||
|
require.Equal(t, coderd.AgentAPIVersionREST, wsagent.APIVersion)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("InvalidSemver", func(t *testing.T) {
|
t.Run("InvalidSemver", func(t *testing.T) {
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ func TestTimezoneOffsets(t *testing.T) {
|
|||||||
// Name: "Eastern",
|
// Name: "Eastern",
|
||||||
// Loc: must(time.LoadLocation("America/New_York")),
|
// Loc: must(time.LoadLocation("America/New_York")),
|
||||||
// ExpectedOffset: -4,
|
// ExpectedOffset: -4,
|
||||||
//},
|
// },
|
||||||
//{
|
//{
|
||||||
// Name: "Central",
|
// Name: "Central",
|
||||||
// Loc: must(time.LoadLocation("America/Chicago")),
|
// Loc: must(time.LoadLocation("America/Chicago")),
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ type WorkspaceAgent struct {
|
|||||||
Directory string `json:"directory,omitempty"`
|
Directory string `json:"directory,omitempty"`
|
||||||
ExpandedDirectory string `json:"expanded_directory,omitempty"`
|
ExpandedDirectory string `json:"expanded_directory,omitempty"`
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
|
APIVersion string `json:"api_version"`
|
||||||
Apps []WorkspaceApp `json:"apps"`
|
Apps []WorkspaceApp `json:"apps"`
|
||||||
// DERPLatency is mapped by region name (e.g. "New York City", "Seattle").
|
// DERPLatency is mapped by region name (e.g. "New York City", "Seattle").
|
||||||
DERPLatency map[string]DERPRegion `json:"latency,omitempty"`
|
DERPLatency map[string]DERPRegion `json:"latency,omitempty"`
|
||||||
|
|||||||
Generated
+1
@@ -699,6 +699,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaceagents/{workspaceagent} \
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
|
|||||||
Generated
+8
@@ -58,6 +58,7 @@ curl -X GET http://coder-server:8080/api/v2/users/{user}/workspace/{workspacenam
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -238,6 +239,7 @@ curl -X GET http://coder-server:8080/api/v2/workspacebuilds/{workspacebuild} \
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -557,6 +559,7 @@ curl -X GET http://coder-server:8080/api/v2/workspacebuilds/{workspacebuild}/res
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -677,6 +680,7 @@ Status Code **200**
|
|||||||
| ------------------------------- | ------------------------------------------------------------------------------------------------------ | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------------------- | ------------------------------------------------------------------------------------------------------ | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `[array item]` | array | false | | |
|
| `[array item]` | array | false | | |
|
||||||
| `» agents` | array | false | | |
|
| `» agents` | array | false | | |
|
||||||
|
| `»» api_version` | string | false | | |
|
||||||
| `»» apps` | array | false | | |
|
| `»» apps` | array | false | | |
|
||||||
| `»»» command` | string | false | | |
|
| `»»» command` | string | false | | |
|
||||||
| `»»» display_name` | string | false | | Display name is a friendly name for the app. |
|
| `»»» display_name` | string | false | | Display name is a friendly name for the app. |
|
||||||
@@ -844,6 +848,7 @@ curl -X GET http://coder-server:8080/api/v2/workspacebuilds/{workspacebuild}/sta
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -1029,6 +1034,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace}/builds \
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -1185,6 +1191,7 @@ Status Code **200**
|
|||||||
| `» reason` | [codersdk.BuildReason](schemas.md#codersdkbuildreason) | false | | |
|
| `» reason` | [codersdk.BuildReason](schemas.md#codersdkbuildreason) | false | | |
|
||||||
| `» resources` | array | false | | |
|
| `» resources` | array | false | | |
|
||||||
| `»» agents` | array | false | | |
|
| `»» agents` | array | false | | |
|
||||||
|
| `»»» api_version` | string | false | | |
|
||||||
| `»»» apps` | array | false | | |
|
| `»»» apps` | array | false | | |
|
||||||
| `»»»» command` | string | false | | |
|
| `»»»» command` | string | false | | |
|
||||||
| `»»»» display_name` | string | false | | Display name is a friendly name for the app. |
|
| `»»»» display_name` | string | false | | Display name is a friendly name for the app. |
|
||||||
@@ -1405,6 +1412,7 @@ curl -X POST http://coder-server:8080/api/v2/workspaces/{workspace}/builds \
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
|
|||||||
Generated
+6
@@ -5642,6 +5642,7 @@ If the schedule is empty, the user will be updated to use the default schedule.|
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -5812,6 +5813,7 @@ If the schedule is empty, the user will be updated to use the default schedule.|
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -5903,6 +5905,7 @@ If the schedule is empty, the user will be updated to use the default schedule.|
|
|||||||
|
|
||||||
| Name | Type | Required | Restrictions | Description |
|
| Name | Type | Required | Restrictions | Description |
|
||||||
| ---------------------------- | -------------------------------------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ---------------------------- | -------------------------------------------------------------------------------------------- | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `api_version` | string | false | | |
|
||||||
| `apps` | array of [codersdk.WorkspaceApp](#codersdkworkspaceapp) | false | | |
|
| `apps` | array of [codersdk.WorkspaceApp](#codersdkworkspaceapp) | false | | |
|
||||||
| `architecture` | string | false | | |
|
| `architecture` | string | false | | |
|
||||||
| `connection_timeout_seconds` | integer | false | | |
|
| `connection_timeout_seconds` | integer | false | | |
|
||||||
@@ -6331,6 +6334,7 @@ If the schedule is empty, the user will be updated to use the default schedule.|
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -6660,6 +6664,7 @@ If the schedule is empty, the user will be updated to use the default schedule.|
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -6896,6 +6901,7 @@ If the schedule is empty, the user will be updated to use the default schedule.|
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
|
|||||||
Generated
+4
@@ -1704,6 +1704,7 @@ curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/d
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -1824,6 +1825,7 @@ Status Code **200**
|
|||||||
| ------------------------------- | ------------------------------------------------------------------------------------------------------ | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------------------- | ------------------------------------------------------------------------------------------------------ | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `[array item]` | array | false | | |
|
| `[array item]` | array | false | | |
|
||||||
| `» agents` | array | false | | |
|
| `» agents` | array | false | | |
|
||||||
|
| `»» api_version` | string | false | | |
|
||||||
| `»» apps` | array | false | | |
|
| `»» apps` | array | false | | |
|
||||||
| `»»» command` | string | false | | |
|
| `»»» command` | string | false | | |
|
||||||
| `»»» display_name` | string | false | | Display name is a friendly name for the app. |
|
| `»»» display_name` | string | false | | Display name is a friendly name for the app. |
|
||||||
@@ -2120,6 +2122,7 @@ curl -X GET http://coder-server:8080/api/v2/templateversions/{templateversion}/r
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -2240,6 +2243,7 @@ Status Code **200**
|
|||||||
| ------------------------------- | ------------------------------------------------------------------------------------------------------ | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------------------- | ------------------------------------------------------------------------------------------------------ | -------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `[array item]` | array | false | | |
|
| `[array item]` | array | false | | |
|
||||||
| `» agents` | array | false | | |
|
| `» agents` | array | false | | |
|
||||||
|
| `»» api_version` | string | false | | |
|
||||||
| `»» apps` | array | false | | |
|
| `»» apps` | array | false | | |
|
||||||
| `»»» command` | string | false | | |
|
| `»»» command` | string | false | | |
|
||||||
| `»»» display_name` | string | false | | Display name is a friendly name for the app. |
|
| `»»» display_name` | string | false | | Display name is a friendly name for the app. |
|
||||||
|
|||||||
Generated
+5
@@ -90,6 +90,7 @@ curl -X POST http://coder-server:8080/api/v2/organizations/{organization}/member
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -299,6 +300,7 @@ curl -X GET http://coder-server:8080/api/v2/users/{user}/workspace/{workspacenam
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -511,6 +513,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces \
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -717,6 +720,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace} \
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
@@ -1042,6 +1046,7 @@ curl -X PUT http://coder-server:8080/api/v2/workspaces/{workspace}/dormant \
|
|||||||
{
|
{
|
||||||
"agents": [
|
"agents": [
|
||||||
{
|
{
|
||||||
|
"api_version": "string",
|
||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"command": "string",
|
"command": "string",
|
||||||
|
|||||||
Generated
+1
@@ -1387,6 +1387,7 @@ export interface WorkspaceAgent {
|
|||||||
readonly directory?: string;
|
readonly directory?: string;
|
||||||
readonly expanded_directory?: string;
|
readonly expanded_directory?: string;
|
||||||
readonly version: string;
|
readonly version: string;
|
||||||
|
readonly api_version: string;
|
||||||
readonly apps: WorkspaceApp[];
|
readonly apps: WorkspaceApp[];
|
||||||
readonly latency?: Record<string, DERPRegion>;
|
readonly latency?: Record<string, DERPRegion>;
|
||||||
readonly connection_timeout_seconds: number;
|
readonly connection_timeout_seconds: number;
|
||||||
|
|||||||
@@ -585,6 +585,7 @@ export const MockWorkspaceAgent: TypesGen.WorkspaceAgent = {
|
|||||||
status: "connected",
|
status: "connected",
|
||||||
updated_at: "",
|
updated_at: "",
|
||||||
version: MockBuildInfo.version,
|
version: MockBuildInfo.version,
|
||||||
|
api_version: "1.0",
|
||||||
latency: {
|
latency: {
|
||||||
"Coder Embedded DERP": {
|
"Coder Embedded DERP": {
|
||||||
latency_ms: 32.55,
|
latency_ms: 32.55,
|
||||||
|
|||||||
Reference in New Issue
Block a user