Skip to content

Commit bdc2144

Browse files
committed
Merge branch 'main' into asher/monitoring
2 parents e8e1e04 + e2030bb commit bdc2144

File tree

351 files changed

+13376
-4152
lines changed

Some content is hidden

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

351 files changed

+13376
-4152
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/dependabot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ updates:
5555
- version-update:semver-major
5656

5757
- package-ecosystem: "terraform"
58-
directory: "/examples"
58+
directory: "/examples/templates"
5959
schedule:
6060
interval: "weekly"
6161
time: "06:00"

.github/stale.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# Number of days of inactivity before an issue becomes stale
2-
daysUntilStale: 14
2+
daysUntilStale: 60
33
# Number of days of inactivity before a stale issue is closed
4-
daysUntilClose: 5
5-
# Only apply the stale logic to pulls, since we are using issues to manage work
6-
only: pulls
4+
daysUntilClose: 7
75
# Label to apply when stale.
86
staleLabel: stale
97
# Comment to post when marking an issue as stale. Set to `false` to disable

.github/workflows/chromatic.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,22 @@
66
# SEE: https://www.chromatic.com/docs/ci
77
name: chromatic
88

9+
# REMARK: We want Chromatic to run whenever anything in the FE or its deps
10+
# change, including node_modules and generated code. Currently, all
11+
# node_modules and generated code live in site. If any of these are
12+
# hoisted, we'll want to adjust the paths filter to account for them.
913
on:
1014
push:
15+
paths:
16+
- site/**
1117
branches:
1218
- main
1319
tags:
1420
- "*"
1521

1622
pull_request:
23+
paths:
24+
- site/**
1725

1826
jobs:
1927
deploy:
@@ -34,7 +42,7 @@ jobs:
3442
# storybook snapshots will require manual approval/review in order for
3543
# the check to pass. This is desired in PRs, but not in mainline.
3644
- name: Publish to Chromatic (non-mainline)
37-
if: github.ref != 'refs/heads/main'
45+
if: github.ref != 'refs/heads/main' && github.repository_owner == 'coder'
3846
uses: chromaui/action@v1
3947
with:
4048
buildScriptName: "storybook:build"
@@ -51,7 +59,7 @@ jobs:
5159
# commits, but it's good to be defensive in case, otherwise CI remains
5260
# infinitely "in progress" in mainline unless we re-review each build.
5361
- name: Publish to Chromatic (mainline)
54-
if: github.ref == 'refs/heads/main'
62+
if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder'
5563
uses: chromaui/action@v1
5664
with:
5765
autoAcceptChanges: true

.github/workflows/coder.yaml

Lines changed: 25 additions & 19 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"
@@ -172,7 +171,7 @@ jobs:
172171
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
173172

174173
- name: Install goreleaser
175-
uses: jaxxstorm/action-install-gh-release@v1.6.0
174+
uses: jaxxstorm/action-install-gh-release@v1.7.1
176175
env:
177176
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
178177
with:
@@ -209,7 +208,8 @@ jobs:
209208
token: ${{ secrets.CODECOV_TOKEN }}
210209
files: ./gotests.coverage
211210
flags: unittest-go-${{ matrix.os }}
212-
fail_ci_if_error: true
211+
# this flakes and sometimes fails the build
212+
fail_ci_if_error: false
213213

214214
test-go-postgres:
215215
name: "test/go/postgres"
@@ -241,7 +241,7 @@ jobs:
241241
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
242242

243243
- name: Install goreleaser
244-
uses: jaxxstorm/action-install-gh-release@v1.6.0
244+
uses: jaxxstorm/action-install-gh-release@v1.7.1
245245
env:
246246
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
247247
with:
@@ -276,10 +276,7 @@ jobs:
276276
done
277277
278278
- 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
279+
run: "make test-postgres"
283280

284281
- name: Upload DataDog Trace
285282
if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
@@ -295,7 +292,8 @@ jobs:
295292
token: ${{ secrets.CODECOV_TOKEN }}
296293
files: ./gotests.coverage
297294
flags: unittest-go-postgres-${{ matrix.os }}
298-
fail_ci_if_error: true
295+
# this flakes and sometimes fails the build
296+
fail_ci_if_error: false
299297

300298
deploy:
301299
name: "deploy"
@@ -339,7 +337,7 @@ jobs:
339337
path: ${{ steps.go-cache-paths.outputs.go-mod }}
340338
key: ${{ runner.os }}-release-go-mod-${{ hashFiles('**/go.sum') }}
341339

342-
- uses: goreleaser/goreleaser-action@v2
340+
- uses: goreleaser/goreleaser-action@v3
343341
with:
344342
install-only: true
345343

@@ -355,18 +353,25 @@ jobs:
355353
js-${{ runner.os }}-
356354
357355
- name: Build site
358-
run: make site/out/index.html
356+
run: make -B site/out/index.html
359357

360358
- name: Build Release
361-
uses: goreleaser/goreleaser-action@v2.9.1
359+
uses: goreleaser/goreleaser-action@v3
362360
with:
363361
version: latest
364362
args: release --snapshot --rm-dist --skip-sign
365363

366364
- uses: actions/upload-artifact@v3
367365
with:
368-
name: coder_linux_amd64.deb
369-
path: ./dist/coder_*_linux_amd64.deb
366+
name: coder_windows_amd64.zip
367+
path: ./dist/coder_*_windows_amd64.zip
368+
retention-days: 7
369+
370+
- uses: actions/upload-artifact@v3
371+
with:
372+
name: coder_linux_amd64.tar.gz
373+
path: ./dist/coder_*_linux_amd64.tar.gz
374+
retention-days: 7
370375

371376
- name: Install Release
372377
run: |
@@ -418,7 +423,8 @@ jobs:
418423
token: ${{ secrets.CODECOV_TOKEN }}
419424
files: ./site/coverage/lcov.info
420425
flags: unittest-js
421-
fail_ci_if_error: true
426+
# this flakes and sometimes fails the build
427+
fail_ci_if_error: false
422428

423429
- name: Upload DataDog Trace
424430
if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
@@ -464,7 +470,7 @@ jobs:
464470
with:
465471
node-version: "14"
466472

467-
- uses: goreleaser/goreleaser-action@v2
473+
- uses: goreleaser/goreleaser-action@v3
468474
with:
469475
install-only: true
470476

@@ -488,7 +494,7 @@ jobs:
488494

489495
- name: Build
490496
run: |
491-
make site/out/index.html
497+
make -B site/out/index.html
492498
493499
- run: yarn playwright:install
494500
working-directory: site

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ jobs:
8080
run: make site/out/index.html
8181

8282
- name: Run GoReleaser
83-
uses: goreleaser/goreleaser-action@v2.9.1
83+
uses: goreleaser/goreleaser-action@v3
8484
with:
8585
version: latest
86-
args: release --rm-dist
86+
args: release --rm-dist --timeout 60m
8787
env:
8888
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8989
AC_USERNAME: ${{ secrets.AC_USERNAME }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ vendor
1414
.eslintcache
1515
yarn-error.log
1616
.idea
17+
.DS_Store
1718

1819
# Front-end ignore
1920
.next/

.golangci.yaml

Lines changed: 3 additions & 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
@@ -201,6 +201,8 @@ run:
201201
concurrency: 4
202202
skip-dirs:
203203
- node_modules
204+
skip-files:
205+
- scripts/rules.go
204206
timeout: 5m
205207

206208
# Over time, add more and more linters from

.goreleaser.yaml

Lines changed: 3 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:
@@ -153,6 +144,9 @@ docker_manifests:
153144

154145
release:
155146
ids: [coder-linux, coder-darwin, coder-windows, packages]
147+
footer: |
148+
## Container Image
149+
- `docker pull ghcr.io/coder/coder:{{ .Tag }}`
156150
157151
signs:
158152
- ids: [coder-darwin]

.vscode/settings.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
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",
1214
"drpcmux",
1315
"drpcserver",
1416
"Dsts",
1517
"fatih",
18+
"Formik",
1619
"goarch",
1720
"gographviz",
1821
"goleak",
1922
"gossh",
2023
"gsyslog",
2124
"hashicorp",
2225
"hclsyntax",
26+
"httpapi",
2327
"httpmw",
2428
"idtoken",
2529
"Iflag",
@@ -51,14 +55,18 @@
5155
"rpty",
5256
"sdkproto",
5357
"Signup",
58+
"sourcemapped",
5459
"stretchr",
5560
"TCGETS",
5661
"tcpip",
5762
"TCSETS",
63+
"templateversions",
64+
"testid",
5865
"tfexec",
5966
"tfjson",
6067
"tfstate",
6168
"trimprefix",
69+
"typegen",
6270
"unconvert",
6371
"Untar",
6472
"VMID",
@@ -76,7 +84,7 @@
7684
},
7785
{
7886
"match": "provisionerd/proto/provisionerd.proto",
79-
"cmd": "make provisionerd/proto/provisionerd.pb.go",
87+
"cmd": "make provisionerd/proto/provisionerd.pb.go"
8088
}
8189
]
8290
},
@@ -104,5 +112,5 @@
104112
},
105113
// We often use a version of TypeScript that's ahead of the version shipped
106114
// with VS Code.
107-
"typescript.tsdk": "./site/node_modules/typescript/lib",
115+
"typescript.tsdk": "./site/node_modules/typescript/lib"
108116
}

Makefile

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ INSTALL_DIR=$(shell go env GOPATH)/bin
44
GOOS=$(shell go env GOOS)
55
GOARCH=$(shell go env GOARCH)
66

7-
bin: $(shell find . -not -path './vendor/*' -type f -name '*.go') go.mod go.sum
7+
bin: $(shell find . -not -path './vendor/*' -type f -name '*.go') go.mod go.sum $(shell find ./examples/templates)
88
@echo "== This builds binaries for command-line usage."
99
@echo "== Use \"make build\" to embed the site."
1010
goreleaser build --snapshot --rm-dist --single-target
@@ -24,7 +24,7 @@ dev:
2424
./scripts/develop.sh
2525
.PHONY: dev
2626

27-
dist/artifacts.json: site/out/index.html $(shell find . -not -path './vendor/*' -type f -name '*.go') go.mod go.sum
27+
dist/artifacts.json: site/out/index.html $(shell find . -not -path './vendor/*' -type f -name '*.go') go.mod go.sum $(shell find ./examples/templates)
2828
goreleaser release --snapshot --rm-dist --skip-sign
2929

3030
fmt/prettier:
@@ -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

0 commit comments

Comments
 (0)