Skip to content

Commit 18db62b

Browse files
author
Katie Horne
committed
Merge branch 'main' into docker-compose
2 parents 7843c93 + 7ac3cbe commit 18db62b

File tree

187 files changed

+5563
-2635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+5563
-2635
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
site/ @coder/frontend
2-
site/src/xServices @presleyp

.github/workflows/coder.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
- run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
106106
- run: go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.26
107107
- run: go install golang.org/x/tools/cmd/goimports@latest
108-
- run: "make --output-sync -j gen"
108+
- run: "make --output-sync -j -B gen"
109109
- run: ./scripts/check_unstaged.sh
110110

111111
style-fmt:
@@ -133,8 +133,7 @@ jobs:
133133
- name: Install node_modules
134134
run: ./scripts/yarn_install.sh
135135

136-
- name: "make fmt"
137-
run: "make --output-sync -j fmt"
136+
- run: "make --output-sync -j -B fmt"
138137

139138
test-go:
140139
name: "test/go"
@@ -276,10 +275,7 @@ jobs:
276275
done
277276
278277
- name: Test with PostgreSQL Database
279-
run: DB=ci gotestsum --junitfile="gotests.xml" --packages="./..." --
280-
-covermode=atomic -coverprofile="gotests.coverage" -timeout=3m
281-
-coverpkg=./...,github.com/coder/coder/codersdk
282-
-count=1 -parallel=2 -race -failfast
278+
run: "make test-postgres"
283279

284280
- name: Upload DataDog Trace
285281
if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
@@ -355,7 +351,7 @@ jobs:
355351
js-${{ runner.os }}-
356352
357353
- name: Build site
358-
run: make site/out/index.html
354+
run: make -B site/out/index.html
359355

360356
- name: Build Release
361357
uses: goreleaser/goreleaser-action@v2.9.1
@@ -488,7 +484,7 @@ jobs:
488484

489485
- name: Build
490486
run: |
491-
make site/out/index.html
487+
make -B site/out/index.html
492488
493489
- run: yarn playwright:install
494490
working-directory: site

.golangci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ linters-settings:
103103
settings:
104104
ruleguard:
105105
failOn: all
106-
rules: rules.go
106+
rules: '${configDir}/scripts/rules.go'
107107

108108
staticcheck:
109109
# https://staticcheck.io/docs/options#checks

.goreleaser.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,14 @@ archives:
22
- id: coder-linux
33
builds: [coder-linux]
44
format: tar.gz
5-
files:
6-
- src: docs/README.md
7-
dst: README.md
85

96
- id: coder-darwin
107
builds: [coder-darwin]
118
format: zip
12-
files:
13-
- src: docs/README.md
14-
dst: README.md
159

1610
- id: coder-windows
1711
builds: [coder-windows]
1812
format: zip
19-
files:
20-
- src: docs/README.md
21-
dst: README.md
2213

2314
before:
2415
hooks:

.vscode/settings.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
22
"cSpell.words": [
3+
"buildname",
34
"circbuf",
45
"cliflag",
56
"cliui",
67
"coderd",
78
"coderdtest",
89
"codersdk",
10+
"cronstrue",
911
"devel",
1012
"drpc",
1113
"drpcconn",
@@ -51,10 +53,12 @@
5153
"rpty",
5254
"sdkproto",
5355
"Signup",
56+
"sourcemapped",
5457
"stretchr",
5558
"TCGETS",
5659
"tcpip",
5760
"TCSETS",
61+
"testid",
5862
"tfexec",
5963
"tfjson",
6064
"tfstate",
@@ -76,7 +80,7 @@
7680
},
7781
{
7882
"match": "provisionerd/proto/provisionerd.proto",
79-
"cmd": "make provisionerd/proto/provisionerd.pb.go",
83+
"cmd": "make provisionerd/proto/provisionerd.pb.go"
8084
}
8185
]
8286
},
@@ -104,5 +108,5 @@
104108
},
105109
// We often use a version of TypeScript that's ahead of the version shipped
106110
// with VS Code.
107-
"typescript.tsdk": "./site/node_modules/typescript/lib",
111+
"typescript.tsdk": "./site/node_modules/typescript/lib"
108112
}

Makefile

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,33 @@ site/src/api/typesGenerated.ts: scripts/apitypings/main.go $(shell find codersdk
9191
go run scripts/apitypings/main.go > site/src/api/typesGenerated.ts
9292
cd site && yarn run format:types
9393

94-
test:
94+
.PHONY: test
95+
test: test-clean
9596
gotestsum -- -v -short ./...
97+
98+
.PHONY: test-postgres
99+
test-postgres: test-clean
100+
DB=ci gotestsum --junitfile="gotests.xml" --packages="./..." -- \
101+
-covermode=atomic -coverprofile="gotests.coverage" -timeout=5m \
102+
-coverpkg=./...,github.com/coder/coder/codersdk \
103+
-count=1 -parallel=1 -race -failfast
104+
105+
106+
.PHONY: test-postgres-docker
107+
test-postgres-docker:
108+
docker run \
109+
--env POSTGRES_PASSWORD=postgres \
110+
--env POSTGRES_USER=postgres \
111+
--env POSTGRES_DB=postgres \
112+
--env PGDATA=/tmp \
113+
--publish 5432:5432 \
114+
--name test-postgres-docker \
115+
--restart unless-stopped \
116+
--detach \
117+
postgres:11 \
118+
-c shared_buffers=1GB \
119+
-c max_connections=1000
120+
121+
.PHONY: test-clean
122+
test-clean:
123+
go clean -testcache

docs/README.md renamed to README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=soc
1010

1111
Provision remote development environments with Terraform.
1212

13-
![Kubernetes workspace in Coder v2](./screenshot.png)
13+
![Kubernetes workspace in Coder v2](./docs/screenshot.png)
1414

1515
## Highlights
1616

1717
- Automate development environments for Linux, Windows, and macOS
1818
- Start writing code with a single command
19-
- Get started quickly using one of the [examples](../examples) provided
19+
- Get started quickly using one of the [examples](./examples) provided
2020

2121
## Installing Coder
2222

@@ -34,7 +34,7 @@ CPU core and 2 GB RAM:
3434
You can set up a temporary deployment, a production deployment, or a system service:
3535

3636
- To set up a **temporary deployment**, start with dev mode (all data is in-memory and is
37-
destroyed on exit):
37+
destroyed on exit):
3838

3939
```bash
4040
coder server --dev
@@ -48,7 +48,7 @@ destroyed on exit):
4848
```
4949

5050
- To run as a **system service**, install with `.deb` (Debian, Ubuntu) or `.rpm`
51-
(Fedora, CentOS, RHEL, SUSE):
51+
(Fedora, CentOS, RHEL, SUSE):
5252

5353
```bash
5454
# Edit the configuration!
@@ -57,7 +57,7 @@ destroyed on exit):
5757
```
5858

5959
> Use `coder --help` to get a complete list of flags and environment
60-
variables.
60+
> variables.
6161
6262
See the [installation guide](install.md) for additional ways to deploy Coder.
6363

@@ -97,26 +97,26 @@ coder templates update gcp-linux
9797

9898
## Documentation
9999

100-
- [About Coder](./about.md#about-coder)
101-
- [Why remote development](about.md#why-remote-development)
102-
- [Why Coder](about.md#why-coder)
103-
- [What Coder is not](about.md#what-coder-is-not)
104-
- [Comparison: Coder vs. [product]](about.md#comparison)
105-
- [Templates](./templates.md)
106-
- [Manage templates](./templates.md#manage-templates)
100+
- [About Coder](./docs/about.md#about-coder)
101+
- [Why remote development](./docs/about.md#why-remote-development)
102+
- [Why Coder](./docs/about.md#why-coder)
103+
- [What Coder is not](./docs/about.md#what-coder-is-not)
104+
- [Comparison: Coder vs. [product]](./docs/about.md#comparison)
105+
- [Templates](./docs/templates.md)
106+
- [Manage templates](./docs/templates.md#manage-templates)
107107
- [Persistent and ephemeral
108-
resources](./templates.md#persistent-and-ephemeral-resources)
109-
- [Parameters](./templates.md#parameters)
110-
- [Workspaces](./workspaces.md)
111-
- [Create workspaces](./workspaces.md#create-workspaces)
112-
- [Connect with SSH](./workspaces.md#connect-with-ssh)
113-
- [Editors and IDEs](./workspaces.md#editors-and-ides)
114-
- [Workspace lifecycle](./workspaces.md#workspace-lifecycle)
115-
- [Updating workspaces](./workspaces.md#updating-workspaces)
108+
resources](./docs/templates.md#persistent-and-ephemeral-resources)
109+
- [Parameters](./docs/templates.md#parameters)
110+
- [Workspaces](./docs/workspaces.md)
111+
- [Create workspaces](./docs/workspaces.md#create-workspaces)
112+
- [Connect with SSH](./docs/workspaces.md#connect-with-ssh)
113+
- [Editors and IDEs](./docs/workspaces.md#editors-and-ides)
114+
- [Workspace lifecycle](./docs/workspaces.md#workspace-lifecycle)
115+
- [Updating workspaces](./docs/workspaces.md#updating-workspaces)
116116

117117
## Contributing
118118

119-
Read the [contributing docs](./CONTRIBUTING.md).
119+
Read the [contributing docs](./docs/CONTRIBUTING.md).
120120

121121
## Contributors
122122

agent/usershell/usershell_darwin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ package usershell
33
import "os"
44

55
// Get returns the $SHELL environment variable.
6-
func Get(username string) (string, error) {
6+
func Get(_ string) (string, error) {
77
return os.Getenv("SHELL"), nil
88
}

cli/agent_test.go

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ func TestWorkspaceAgent(t *testing.T) {
1919
instanceID := "instanceidentifier"
2020
certificates, metadataClient := coderdtest.NewAzureInstanceIdentity(t, instanceID)
2121
client := coderdtest.New(t, &coderdtest.Options{
22-
AzureCertificates: certificates,
22+
AzureCertificates: certificates,
23+
IncludeProvisionerD: true,
2324
})
2425
user := coderdtest.CreateFirstUser(t, client)
25-
coderdtest.NewProvisionerDaemon(t, client)
2626
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
2727
Parse: echo.ParseComplete,
2828
Provision: []*proto.Provision_Response{{
@@ -49,13 +49,12 @@ func TestWorkspaceAgent(t *testing.T) {
4949
cmd, _ := clitest.New(t, "agent", "--auth", "azure-instance-identity", "--agent-url", client.URL.String())
5050
ctx, cancelFunc := context.WithCancel(context.Background())
5151
defer cancelFunc()
52+
errC := make(chan error)
5253
go func() {
53-
// A linting error occurs for weakly typing the context value here,
54-
// but it seems reasonable for a one-off test.
55-
// nolint
56-
ctx = context.WithValue(ctx, "azure-client", metadataClient)
57-
err := cmd.ExecuteContext(ctx)
58-
require.NoError(t, err)
54+
// A linting error occurs for weakly typing the context value here.
55+
//nolint // The above seems reasonable for a one-off test.
56+
ctx := context.WithValue(ctx, "azure-client", metadataClient)
57+
errC <- cmd.ExecuteContext(ctx)
5958
}()
6059
coderdtest.AwaitWorkspaceAgents(t, client, workspace.LatestBuild.ID)
6160
resources, err := client.WorkspaceResourcesByBuild(ctx, workspace.LatestBuild.ID)
@@ -66,17 +65,19 @@ func TestWorkspaceAgent(t *testing.T) {
6665
_, err = dialer.Ping()
6766
require.NoError(t, err)
6867
cancelFunc()
68+
err = <-errC
69+
require.NoError(t, err)
6970
})
7071

7172
t.Run("AWS", func(t *testing.T) {
7273
t.Parallel()
7374
instanceID := "instanceidentifier"
7475
certificates, metadataClient := coderdtest.NewAWSInstanceIdentity(t, instanceID)
7576
client := coderdtest.New(t, &coderdtest.Options{
76-
AWSCertificates: certificates,
77+
AWSCertificates: certificates,
78+
IncludeProvisionerD: true,
7779
})
7880
user := coderdtest.CreateFirstUser(t, client)
79-
coderdtest.NewProvisionerDaemon(t, client)
8081
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
8182
Parse: echo.ParseComplete,
8283
Provision: []*proto.Provision_Response{{
@@ -103,13 +104,12 @@ func TestWorkspaceAgent(t *testing.T) {
103104
cmd, _ := clitest.New(t, "agent", "--auth", "aws-instance-identity", "--agent-url", client.URL.String())
104105
ctx, cancelFunc := context.WithCancel(context.Background())
105106
defer cancelFunc()
107+
errC := make(chan error)
106108
go func() {
107-
// A linting error occurs for weakly typing the context value here,
108-
// but it seems reasonable for a one-off test.
109-
// nolint
110-
ctx = context.WithValue(ctx, "aws-client", metadataClient)
111-
err := cmd.ExecuteContext(ctx)
112-
require.NoError(t, err)
109+
// A linting error occurs for weakly typing the context value here.
110+
//nolint // The above seems reasonable for a one-off test.
111+
ctx := context.WithValue(ctx, "aws-client", metadataClient)
112+
errC <- cmd.ExecuteContext(ctx)
113113
}()
114114
coderdtest.AwaitWorkspaceAgents(t, client, workspace.LatestBuild.ID)
115115
resources, err := client.WorkspaceResourcesByBuild(ctx, workspace.LatestBuild.ID)
@@ -120,6 +120,8 @@ func TestWorkspaceAgent(t *testing.T) {
120120
_, err = dialer.Ping()
121121
require.NoError(t, err)
122122
cancelFunc()
123+
err = <-errC
124+
require.NoError(t, err)
123125
})
124126

125127
t.Run("GoogleCloud", func(t *testing.T) {
@@ -128,9 +130,9 @@ func TestWorkspaceAgent(t *testing.T) {
128130
validator, metadata := coderdtest.NewGoogleInstanceIdentity(t, instanceID, false)
129131
client := coderdtest.New(t, &coderdtest.Options{
130132
GoogleTokenValidator: validator,
133+
IncludeProvisionerD: true,
131134
})
132135
user := coderdtest.CreateFirstUser(t, client)
133-
coderdtest.NewProvisionerDaemon(t, client)
134136
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
135137
Parse: echo.ParseComplete,
136138
Provision: []*proto.Provision_Response{{
@@ -157,13 +159,12 @@ func TestWorkspaceAgent(t *testing.T) {
157159
cmd, _ := clitest.New(t, "agent", "--auth", "google-instance-identity", "--agent-url", client.URL.String())
158160
ctx, cancelFunc := context.WithCancel(context.Background())
159161
defer cancelFunc()
162+
errC := make(chan error)
160163
go func() {
161-
// A linting error occurs for weakly typing the context value here,
162-
// but it seems reasonable for a one-off test.
163-
// nolint
164-
ctx = context.WithValue(ctx, "gcp-client", metadata)
165-
err := cmd.ExecuteContext(ctx)
166-
require.NoError(t, err)
164+
// A linting error occurs for weakly typing the context value here.
165+
//nolint // The above seems reasonable for a one-off test.
166+
ctx := context.WithValue(ctx, "gcp-client", metadata)
167+
errC <- cmd.ExecuteContext(ctx)
167168
}()
168169
coderdtest.AwaitWorkspaceAgents(t, client, workspace.LatestBuild.ID)
169170
resources, err := client.WorkspaceResourcesByBuild(ctx, workspace.LatestBuild.ID)
@@ -174,5 +175,7 @@ func TestWorkspaceAgent(t *testing.T) {
174175
_, err = dialer.Ping()
175176
require.NoError(t, err)
176177
cancelFunc()
178+
err = <-errC
179+
require.NoError(t, err)
177180
})
178181
}

0 commit comments

Comments
 (0)