Skip to content

feat: Add deployment side config-ssh options #6613

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 34 commits into from
Mar 16, 2023
Merged
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
79535d0
feat: Allow setting deployment wide ssh config settings
Emyrk Mar 14, 2023
f0eb123
feat: config-ssh respects deployment ssh config
Emyrk Mar 15, 2023
4beeb62
Catch early parse error
Emyrk Mar 15, 2023
08f5d3d
Add to unit test
Emyrk Mar 15, 2023
c8c5189
fix typo
Emyrk Mar 15, 2023
96ad4bc
Add unit test
Emyrk Mar 15, 2023
f9f4a8f
Fix output
Emyrk Mar 15, 2023
ebf9eb9
Make gen
Emyrk Mar 15, 2023
119695b
Simplify if/else
Emyrk Mar 15, 2023
b8f3242
Fix AutorizeAllEndpoints
Emyrk Mar 15, 2023
b082a5a
Fic swager docs
Emyrk Mar 15, 2023
4a1e3c2
Make gen
Emyrk Mar 15, 2023
01ea08f
The '.' is now configurable
Emyrk Mar 15, 2023
7074f50
CODER env prefix is automatic
Emyrk Mar 15, 2023
952c591
Renames
Emyrk Mar 15, 2023
dae091a
Make gen
Emyrk Mar 15, 2023
a1dd7d4
Fix AutorizeAllEndpoints
Emyrk Mar 15, 2023
4f42634
Rename to drop 'CLI'
Emyrk Mar 15, 2023
c218edd
Prefix requires .
Emyrk Mar 15, 2023
a752fc8
Use constant in test
Emyrk Mar 15, 2023
d328d97
Linting
Emyrk Mar 15, 2023
a4b9620
Formatting
Emyrk Mar 15, 2023
78fbda8
Allow the user to override the host prefix
Emyrk Mar 16, 2023
d28b850
Fix doc messages
Emyrk Mar 16, 2023
617d987
Make gen
Emyrk Mar 16, 2023
eb4bb7b
Fix comment
Emyrk Mar 16, 2023
123ce02
Remove "CLI" part of naming
Emyrk Mar 16, 2023
ca41cce
Update golden files
Emyrk Mar 16, 2023
efcbc29
Fix 404 logic
Emyrk Mar 16, 2023
3c1c87f
remove 1 error check
Emyrk Mar 16, 2023
4586b11
Move buildinfo into deployment.go
Emyrk Mar 16, 2023
0f2ef97
fixup! Move buildinfo into deployment.go
Emyrk Mar 16, 2023
a5aac50
make gen
Emyrk Mar 16, 2023
a3254cd
Golden files
Emyrk Mar 16, 2023
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
Make gen
  • Loading branch information
Emyrk committed Mar 15, 2023
commit dae091ad3b976dc9d05d81413f22fb0611f7c8fb
78 changes: 39 additions & 39 deletions coderd/apidoc/docs.go

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

70 changes: 35 additions & 35 deletions coderd/apidoc/swagger.json

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

2 changes: 1 addition & 1 deletion coderd/clissh.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
// @Security CoderSessionToken
// @Produce json
// @Tags General
// @Success 200 {object} codersdk.CLISSHConfigResponse
// @Success 200 {object} codersdk.SSHConfigResponse
// @Router /deployment/ssh [get]
func (a *API) cliSSHConfig(rw http.ResponseWriter, r *http.Request) {
httpapi.Write(r.Context(), rw, http.StatusOK, a.SSHConfig)
Expand Down
70 changes: 35 additions & 35 deletions docs/api/general.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,41 +64,6 @@ curl -X GET http://coder-server:8080/api/v2/buildinfo \
| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------------ |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.BuildInfoResponse](schemas.md#codersdkbuildinforesponse) |

## CLI SSH Config

### Code samples

```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/config-ssh \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```

`GET /config-ssh`

### Example responses

> 200 Response

```json
{
"deployment_name": "string",
"ssh_config_options": {
"property1": "string",
"property2": "string"
}
}
```

### Responses

| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------------------ |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.CLISSHConfigResponse](schemas.md#codersdkclisshconfigresponse) |

To perform this operation, you must be authenticated. [Learn more](authentication.md).

## Report CSP violations

### Code samples
Expand Down Expand Up @@ -437,6 +402,41 @@ curl -X GET http://coder-server:8080/api/v2/deployment/config \

To perform this operation, you must be authenticated. [Learn more](authentication.md).

## CLI SSH Config

### Code samples

```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/deployment/ssh \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```

`GET /deployment/ssh`

### Example responses

> 200 Response

```json
{
"hostname_prefix": "string",
"ssh_config_options": {
"property1": "string",
"property2": "string"
}
}
```

### Responses

| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------------ |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.SSHConfigResponse](schemas.md#codersdksshconfigresponse) |

To perform this operation, you must be authenticated. [Learn more](authentication.md).

## Get deployment stats

### Code samples
Expand Down
40 changes: 20 additions & 20 deletions docs/api/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -1116,26 +1116,6 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
| `deploymentName` | string | false | | Deploymentname is the config-ssh Hostname prefix |
| `sshconfigOptions` | array of string | false | | Sshconfigoptions are additional options to add to the ssh config file. This will override defaults. |

## codersdk.CLISSHConfigResponse

```json
{
"deployment_name": "string",
"ssh_config_options": {
"property1": "string",
"property2": "string"
}
}
```

### Properties

| Name | Type | Required | Restrictions | Description |
| -------------------- | ------ | -------- | ------------ | ----------- |
| `deployment_name` | string | false | | |
| `ssh_config_options` | object | false | | |
| » `[any property]` | string | false | | |

## codersdk.CreateFirstUserRequest

```json
Expand Down Expand Up @@ -3363,6 +3343,26 @@ Parameter represents a set value for the scope.
| `display_name` | string | false | | |
| `name` | string | false | | |

## codersdk.SSHConfigResponse

```json
{
"hostname_prefix": "string",
"ssh_config_options": {
"property1": "string",
"property2": "string"
}
}
```

### Properties

| Name | Type | Required | Restrictions | Description |
| -------------------- | ------ | -------- | ------------ | ----------- |
| `hostname_prefix` | string | false | | |
| `ssh_config_options` | object | false | | |
| » `[any property]` | string | false | | |

## codersdk.ServiceBannerConfig

```json
Expand Down
12 changes: 6 additions & 6 deletions site/src/api/typesGenerated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,6 @@ export interface CLISSHConfig {
readonly SSHConfigOptions: string[]
}

// From codersdk/deployment.go
export interface CLISSHConfigResponse {
readonly deployment_name: string
readonly ssh_config_options: Record<string, string>
}

// From codersdk/parameters.go
export interface ComputedParameter extends Parameter {
readonly source_value: string
Expand Down Expand Up @@ -680,6 +674,12 @@ export interface Role {
readonly display_name: string
}

// From codersdk/deployment.go
export interface SSHConfigResponse {
readonly hostname_prefix: string
readonly ssh_config_options: Record<string, string>
}

// From codersdk/serversentevents.go
export interface ServerSentEvent {
readonly type: ServerSentEventType
Expand Down