Skip to content

Commit ae56344

Browse files
authored
Merge branch 'main' into bryphe/refactor/add-stability-workflow
2 parents 5890ff1 + edd8345 commit ae56344

File tree

117 files changed

+471
-311
lines changed

Some content is hidden

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

117 files changed

+471
-311
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
site @coder/coder-frontend

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This repository contains source code for Coder V2. Additional documentation:
1010
## Directory Structure
1111

1212
- `.github/`: Settings for [Dependabot for updating dependencies](https://docs.github.com/en/code-security/supply-chain-security/customizing-dependency-updates) and [build/deploy pipelines with GitHub Actions](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions).
13-
- [`semantic.yaml`](./github/semantic.yaml): Configuration for [semantic pull requests](https://github.com/apps/semantic-pull-requests)\
13+
- [`semantic.yaml`](./github/semantic.yaml): Configuration for [semantic pull requests](https://github.com/apps/semantic-pull-requests)
1414
- `examples`: Example terraform project templates.
1515
- `site`: Front-end UI code.
1616

@@ -35,11 +35,33 @@ This repository contains source code for Coder V2. Additional documentation:
3535

3636
The `coder` CLI binary will now be available at `$GOPATH/bin/coder`
3737

38+
### Running
39+
40+
After building, the binaries will be available at:
41+
- `dist/coder_{os}_{arch}/coder`
42+
43+
For the purpose of these steps, an OS of `linux` and an arch of `amd64` is assumed.
44+
45+
To manually run the server and go through first-time set up, run the following commands in separate terminals:
46+
- `dist/coder_linux_amd64/coder daemon` <-- starts the Coder server on port 3000
47+
- `dist/coder_linux_amd64/coder login http://localhost:3000` <-- runs through first-time setup, creating a user and org
48+
49+
You'll now be able to login and access the server.
50+
51+
To create a project, run:
52+
- `dist/coder_linux_amd64/coder projects create -d /path/to/project`
53+
3854
### Development
3955

4056
- `./develop.sh`
4157

42-
The `develop.sh` script runs the server locally on port `3000`, and runs a hot-reload server for front-end code on `8080`.
58+
The `develop.sh` script does three things:
59+
60+
- runs `coder daemon` locally on port `3000`
61+
- runs `webpack-dev-server` on port `8080`
62+
- sets up an initial user and organization
63+
64+
This is the recommend flow for working on the front-end, as hot-reload is set up as part of the webpack config.
4365

4466
## Front-End Plan
4567

cli/daemon.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ func daemon() *cobra.Command {
5050
}
5151
defer listener.Close()
5252

53+
logger.Info(cmd.Context(), "daemon started", slog.F("url", accessURL.String()))
54+
5355
client := codersdk.New(accessURL)
5456
daemonClose, err := newProvisionerDaemon(cmd.Context(), client, logger)
5557
if err != nil {

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ require (
4747
github.com/pion/datachannel v1.5.2
4848
github.com/pion/logging v0.2.2
4949
github.com/pion/transport v0.13.0
50-
github.com/pion/webrtc/v3 v3.1.24
50+
github.com/pion/webrtc/v3 v3.1.25
5151
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
5252
github.com/powersj/whatsthis v1.3.0
5353
github.com/quasilyte/go-ruleguard/dsl v0.3.17
@@ -58,7 +58,7 @@ require (
5858
github.com/xlab/treeprint v1.1.0
5959
go.uber.org/atomic v1.9.0
6060
go.uber.org/goleak v1.1.12
61-
golang.org/x/crypto v0.0.0-20220214200702-86341886e292
61+
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd
6262
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a
6363
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5
6464
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
@@ -112,11 +112,11 @@ require (
112112
github.com/opencontainers/runc v1.1.0 // indirect
113113
github.com/pion/dtls/v2 v2.1.3 // indirect
114114
github.com/pion/ice/v2 v2.2.2 // indirect
115-
github.com/pion/interceptor v0.1.7 // indirect
115+
github.com/pion/interceptor v0.1.10 // indirect
116116
github.com/pion/mdns v0.0.5 // indirect
117117
github.com/pion/randutil v0.1.0 // indirect
118118
github.com/pion/rtcp v1.2.9 // indirect
119-
github.com/pion/rtp v1.7.4 // indirect
119+
github.com/pion/rtp v1.7.7 // indirect
120120
github.com/pion/sctp v1.8.2 // indirect
121121
github.com/pion/sdp/v3 v3.0.4 // indirect
122122
github.com/pion/srtp/v2 v2.0.5 // indirect

go.sum

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,14 +1005,12 @@ github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi
10051005
github.com/pierrec/lz4/v4 v4.1.8/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
10061006
github.com/pion/datachannel v1.5.2 h1:piB93s8LGmbECrpO84DnkIVWasRMk3IimbcXkTQLE6E=
10071007
github.com/pion/datachannel v1.5.2/go.mod h1:FTGQWaHrdCwIJ1rw6xBIfZVkslikjShim5yr05XFuCQ=
1008-
github.com/pion/dtls/v2 v2.1.2/go.mod h1:o6+WvyLDAlXF7YiPB/RlskRoeK+/JtuaZa5emwQcWus=
10091008
github.com/pion/dtls/v2 v2.1.3 h1:3UF7udADqous+M2R5Uo2q/YaP4EzUoWKdfX2oscCUio=
10101009
github.com/pion/dtls/v2 v2.1.3/go.mod h1:o6+WvyLDAlXF7YiPB/RlskRoeK+/JtuaZa5emwQcWus=
1011-
github.com/pion/ice/v2 v2.2.1/go.mod h1:Op8jlPtjeiycsXh93Cs4jK82C9j/kh7vef6ztIOvtIQ=
10121010
github.com/pion/ice/v2 v2.2.2 h1:UfmAslxZ0u0itVjA4x7aw7WeQIv22FdF8VjW9cM+74g=
10131011
github.com/pion/ice/v2 v2.2.2/go.mod h1:vLI7dFqxw8zMSb9J+ca74XU7JjLhddgfQB9+BbTydCo=
1014-
github.com/pion/interceptor v0.1.7 h1:HThW0tIIKT9RRoDWGURe8rlZVOx0fJHxBHpA0ej0+bo=
1015-
github.com/pion/interceptor v0.1.7/go.mod h1:Lh3JSl/cbJ2wP8I3ccrjh1K/deRGRn3UlSPuOTiHb6U=
1012+
github.com/pion/interceptor v0.1.10 h1:DJ2GjMGm4XGIQgMJxuEpdaExdY/6RdngT7Uh4oVmquU=
1013+
github.com/pion/interceptor v0.1.10/go.mod h1:Lh3JSl/cbJ2wP8I3ccrjh1K/deRGRn3UlSPuOTiHb6U=
10161014
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
10171015
github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms=
10181016
github.com/pion/mdns v0.0.5 h1:Q2oj/JB3NqfzY9xGZ1fPzZzK7sDSD8rZPOvcIQ10BCw=
@@ -1023,8 +1021,9 @@ github.com/pion/rtcp v1.2.6/go.mod h1:52rMNPWFsjr39z9B9MhnkqhPLoeHTv1aN63o/42bWE
10231021
github.com/pion/rtcp v1.2.9 h1:1ujStwg++IOLIEoOiIQ2s+qBuJ1VN81KW+9pMPsif+U=
10241022
github.com/pion/rtcp v1.2.9/go.mod h1:qVPhiCzAm4D/rxb6XzKeyZiQK69yJpbUDJSF7TgrqNo=
10251023
github.com/pion/rtp v1.7.0/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
1026-
github.com/pion/rtp v1.7.4 h1:4dMbjb1SuynU5OpA3kz1zHK+u+eOCQjW3MAeVHf1ODA=
10271024
github.com/pion/rtp v1.7.4/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
1025+
github.com/pion/rtp v1.7.7 h1:MzaAfCVicTVxiZpM2o99+YFrKxyRsQ38nnIi4vJPuUY=
1026+
github.com/pion/rtp v1.7.7/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
10281027
github.com/pion/sctp v1.8.0/go.mod h1:xFe9cLMZ5Vj6eOzpyiKjT9SwGM4KpK/8Jbw5//jc+0s=
10291028
github.com/pion/sctp v1.8.2 h1:yBBCIrUMJ4yFICL3RIvR4eh/H2BTTvlligmSTy+3kiA=
10301029
github.com/pion/sctp v1.8.2/go.mod h1:xFe9cLMZ5Vj6eOzpyiKjT9SwGM4KpK/8Jbw5//jc+0s=
@@ -1042,8 +1041,8 @@ github.com/pion/turn/v2 v2.0.8 h1:KEstL92OUN3k5k8qxsXHpr7WWfrdp7iJZHx99ud8muw=
10421041
github.com/pion/turn/v2 v2.0.8/go.mod h1:+y7xl719J8bAEVpSXBXvTxStjJv3hbz9YFflvkpcGPw=
10431042
github.com/pion/udp v0.1.1 h1:8UAPvyqmsxK8oOjloDk4wUt63TzFe9WEJkg5lChlj7o=
10441043
github.com/pion/udp v0.1.1/go.mod h1:6AFo+CMdKQm7UiA0eUPA8/eVCTx8jBIITLZHc9DWX5M=
1045-
github.com/pion/webrtc/v3 v3.1.24 h1:s9PuwisrgHe1FTqfwK4p3T7rXtAHaUNhycbdMjADT28=
1046-
github.com/pion/webrtc/v3 v3.1.24/go.mod h1:mO/yv7fBN3Lp7YNlnYcTj1jtpvNvssJG+7eh6itZ4xM=
1044+
github.com/pion/webrtc/v3 v3.1.25 h1:8bTa2lLI5rszkKCKVO6L9VlKhhmmwMXZ/beSWLwQK14=
1045+
github.com/pion/webrtc/v3 v3.1.25/go.mod h1:BA9hvF1mCu64w/to7nHrSNMxx+zMqVst990zA7xgfCM=
10471046
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
10481047
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
10491048
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
@@ -1291,8 +1290,8 @@ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5y
12911290
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
12921291
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
12931292
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
1294-
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE=
1295-
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
1293+
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd h1:XcWmESyNjXJMLahc3mqVQJcgSTDxFxhETVlfk9uGc38=
1294+
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
12961295
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
12971296
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
12981297
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=

site/.storybook/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const path = require("path")
22

33
module.exports = {
4-
stories: ["../**/*.stories.mdx", "../**/*.stories.@(js|jsx|ts|tsx)"],
4+
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
55
addons: ["@storybook/addon-links", "@storybook/addon-essentials"],
66
babel: async (options) => ({
77
...options,

site/.storybook/preview.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
import ThemeProvider from "@material-ui/styles/ThemeProvider"
22
import { withThemes } from "@react-theming/storybook-addon"
3-
import { light, dark } from "../theme"
3+
import { light, dark } from "../src/theme"
44
import { addDecorator } from "node_modules/@storybook/react"
5+
import { createMemoryHistory } from "history"
6+
import { unstable_HistoryRouter as HistoryRouter } from "react-router-dom"
57

68
addDecorator(withThemes(ThemeProvider, [light, dark]))
79

10+
const history = createMemoryHistory()
11+
12+
const routerDecorator = (Story) => {
13+
return (
14+
<HistoryRouter history={history}>
15+
<Story />
16+
</HistoryRouter>
17+
)
18+
}
19+
20+
addDecorator(routerDecorator)
21+
822
export const parameters = {
923
actions: {
1024
argTypesRegex: "^on[A-Z].*",

site/components/EmptyState/index.test.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

site/e2e/pom/HealthzPage.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Locator, Page } from "@playwright/test"
2+
import { BasePom } from "./BasePom"
3+
4+
export class HealthzPage extends BasePom {
5+
constructor(baseURL: string | undefined, page: Page) {
6+
super(baseURL, "/healthz", page)
7+
}
8+
9+
getOk(): Locator {
10+
const locator = this.page.locator("text=ok")
11+
return locator
12+
}
13+
}

site/e2e/tests/healthz.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { test } from "@playwright/test"
2+
import { HealthzPage } from "../pom/HealthzPage"
3+
4+
test("Healthz is available without authentication", async ({ baseURL, page }) => {
5+
const healthzPage = new HealthzPage(baseURL, page)
6+
await page.goto(healthzPage.url, { waitUntil: "networkidle" })
7+
await healthzPage.getOk().waitFor({ state: "visible" })
8+
})

site/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module.exports = {
1111
preset: "ts-jest",
1212

1313
roots: ["<rootDir>"],
14+
setupFilesAfterEnv: ["./jest.setup.ts"],
1415
transform: {
1516
"^.+\\.tsx?$": "ts-jest",
1617
},

site/jest.setup.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Helper utility to fail jest tests if a console.error is logged
2+
// Pulled from this blog post:
3+
// https://www.benmvp.com/blog/catch-warnings-jest-tests/
4+
5+
// For now, I limited this to just 'error' - but failing on warnings
6+
// would be a nice next step! We may need to filter out some noise
7+
// from material-ui though.
8+
const CONSOLE_FAIL_TYPES = ["error" /* 'warn' */]
9+
10+
// Throw errors when a `console.error` or `console.warn` happens
11+
// by overriding the functions
12+
CONSOLE_FAIL_TYPES.forEach((logType: string) => {
13+
// Suppressing the no-explicit-any to override certain console functions for testing
14+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
15+
const consoleAsAny = global.console as any
16+
consoleAsAny[logType] = (message: string): void => {
17+
throw new Error(`Failing due to console.${logType} while running test!\n\n${message}`)
18+
}
19+
})
20+
21+
// This is needed because we are compiling under `--isolatedModules`
22+
export {}

site/package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
"storybook": "start-storybook -p 6006 -s ./static",
1818
"storybook:build": "build-storybook",
1919
"test": "jest --selectProjects test",
20-
"test:coverage": "jest --selectProjects test --collectCoverage"
20+
"test:coverage": "jest --selectProjects test --collectCoverage",
21+
"test:watch": "jest --selectProjects test --watch"
2122
},
2223
"dependencies": {
2324
"@material-ui/core": "4.9.4",
2425
"@material-ui/icons": "4.5.1",
2526
"@material-ui/lab": "4.0.0-alpha.42",
27+
"axios": "0.26.1",
2628
"formik": "2.2.9",
2729
"history": "5.3.0",
2830
"react": "17.0.2",
@@ -32,7 +34,7 @@
3234
"yup": "0.32.11"
3335
},
3436
"devDependencies": {
35-
"@playwright/test": "1.19.2",
37+
"@playwright/test": "1.20.0",
3638
"@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
3739
"@react-theming/storybook-addon": "1.1.5",
3840
"@storybook/addon-actions": "6.4.19",
@@ -46,10 +48,10 @@
4648
"@types/react": "17.0.40",
4749
"@types/react-dom": "17.0.13",
4850
"@types/superagent": "4.1.15",
49-
"@typescript-eslint/eslint-plugin": "4.33.0",
50-
"@typescript-eslint/parser": "4.33.0",
51+
"@typescript-eslint/eslint-plugin": "5.15.0",
52+
"@typescript-eslint/parser": "5.15.0",
5153
"copy-webpack-plugin": "10.2.4",
52-
"eslint": "7.32.0",
54+
"eslint": "8.11.0",
5355
"eslint-config-prettier": "8.5.0",
5456
"eslint-import-resolver-alias": "1.1.2",
5557
"eslint-import-resolver-typescript": "2.5.0",
@@ -64,7 +66,7 @@
6466
"jest": "27.5.1",
6567
"jest-junit": "13.0.0",
6668
"jest-runner-eslint": "1.0.0",
67-
"prettier": "2.5.1",
69+
"prettier": "2.6.0",
6870
"react-hot-loader": "4.13.0",
6971
"sql-formatter": "4.0.2",
7072
"ts-jest": "27.1.3",
File renamed without changes.

0 commit comments

Comments
 (0)