Skip to content

Commit 6100206

Browse files
committed
Merge remote-tracking branch 'origin/main' into dwahler/provisionerd
2 parents 6067403 + b101a6f commit 6100206

File tree

3,962 files changed

+4833
-2913
lines changed

Some content is hidden

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

3,962 files changed

+4833
-2913
lines changed

.github/workflows/coder.yaml

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
docs-only: ${{ steps.filter.outputs.docs_count == steps.filter.outputs.all_count }}
5353
sh: ${{ steps.filter.outputs.sh }}
5454
ts: ${{ steps.filter.outputs.ts }}
55+
k8s: ${{ steps.filter.outputs.k8s }}
5556
steps:
5657
- uses: actions/checkout@v3
5758
# For pull requests it's not necessary to checkout the code
@@ -69,6 +70,10 @@ jobs:
6970
- "**.sh"
7071
ts:
7172
- 'site/**'
73+
k8s:
74+
- 'helm/**'
75+
- Dockerfile
76+
- scripts/helm.sh
7277
- id: debug
7378
run: |
7479
echo "${{ toJSON(steps.filter )}}"
@@ -91,11 +96,20 @@ jobs:
9196
- uses: actions/checkout@v3
9297
- uses: actions/setup-go@v3
9398
with:
94-
go-version: "~1.18"
99+
go-version: "~1.19"
95100
- name: golangci-lint
96101
uses: golangci/golangci-lint-action@v3.2.0
97102
with:
98-
version: v1.46.0
103+
version: v1.48.0
104+
105+
check-enterprise-imports:
106+
name: check/enterprise-imports
107+
timeout-minutes: 5
108+
runs-on: ubuntu-latest
109+
steps:
110+
- uses: actions/checkout@v3
111+
- name: Check imports of enterprise code
112+
run: ./scripts/check_enterprise_imports.sh
99113

100114
style-lint-shellcheck:
101115
name: style/lint/shellcheck
@@ -136,6 +150,26 @@ jobs:
136150
run: yarn lint
137151
working-directory: site
138152

153+
style-lint-k8s:
154+
name: "style/lint/k8s"
155+
timeout-minutes: 5
156+
needs: changes
157+
if: needs.changes.outputs.k8s == 'true'
158+
runs-on: ubuntu-latest
159+
steps:
160+
- name: Checkout
161+
uses: actions/checkout@v3
162+
163+
- name: Install helm
164+
uses: azure/setup-helm@v3
165+
with:
166+
version: v3.9.2
167+
168+
- name: cd helm && make lint
169+
run: |
170+
cd helm
171+
make lint
172+
139173
gen:
140174
name: "style/gen"
141175
timeout-minutes: 8
@@ -165,7 +199,7 @@ jobs:
165199
version: "3.20.0"
166200
- uses: actions/setup-go@v3
167201
with:
168-
go-version: "~1.18"
202+
go-version: "~1.19"
169203

170204
- name: Echo Go Cache Paths
171205
id: go-cache-paths
@@ -185,14 +219,21 @@ jobs:
185219
path: ${{ steps.go-cache-paths.outputs.go-mod }}
186220
key: ${{ github.job }}-go-mod-${{ hashFiles('**/go.sum') }}
187221

188-
- run: |
222+
- name: Install sqlc
223+
run: |
189224
curl -sSL https://github.com/kyleconroy/sqlc/releases/download/v1.13.0/sqlc_1.13.0_linux_amd64.tar.gz | sudo tar -C /usr/bin -xz sqlc
225+
- name: Install protoc-gen-go
226+
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
227+
- name: Install protoc-gen-go-drpc
228+
run: go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.26
229+
- name: Install goimports
230+
run: go install golang.org/x/tools/cmd/goimports@latest
190231

191-
- run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
192-
- run: go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.26
193-
- run: go install golang.org/x/tools/cmd/goimports@latest
194-
- run: "make --output-sync -j -B gen"
195-
- run: ./scripts/check_unstaged.sh
232+
- name: make gen
233+
run: "make --output-sync -j -B gen"
234+
235+
- name: Check for unstaged files
236+
run: ./scripts/check_unstaged.sh
196237

197238
style-fmt:
198239
name: "style/fmt"
@@ -222,7 +263,8 @@ jobs:
222263
- name: Install shfmt
223264
run: go install mvdan.cc/sh/v3/cmd/shfmt@v3.5.0
224265

225-
- run: |
266+
- name: make fmt
267+
run: |
226268
export PATH=${PATH}:$(go env GOPATH)/bin
227269
make --output-sync -j -B fmt
228270
@@ -241,7 +283,7 @@ jobs:
241283

242284
- uses: actions/setup-go@v3
243285
with:
244-
go-version: "~1.18"
286+
go-version: "~1.19"
245287

246288
- name: Echo Go Cache Paths
247289
id: go-cache-paths
@@ -328,7 +370,7 @@ jobs:
328370

329371
- uses: actions/setup-go@v3
330372
with:
331-
go-version: "~1.18"
373+
go-version: "~1.19"
332374

333375
- name: Echo Go Cache Paths
334376
id: go-cache-paths
@@ -411,7 +453,7 @@ jobs:
411453

412454
- uses: actions/setup-go@v3
413455
with:
414-
go-version: "~1.18"
456+
go-version: "~1.19"
415457

416458
- name: Echo Go Cache Paths
417459
id: go-cache-paths
@@ -516,7 +558,7 @@ jobs:
516558
# Go is required for uploading the test results to datadog
517559
- uses: actions/setup-go@v3
518560
with:
519-
go-version: "~1.18"
561+
go-version: "~1.19"
520562

521563
- uses: actions/setup-node@v3
522564
with:
@@ -574,7 +616,7 @@ jobs:
574616
# Go is required for uploading the test results to datadog
575617
- uses: actions/setup-go@v3
576618
with:
577-
go-version: "~1.18"
619+
go-version: "~1.19"
578620

579621
- uses: hashicorp/setup-terraform@v2
580622
with:

.github/workflows/typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ MacOS = "macOS"
99
[files]
1010
extend-exclude = [
1111
"**.svg",
12+
"**.png",
1213
"**.lock",
1314
"go.sum",
1415
"go.mod",

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"cSpell.words": [
33
"apps",
44
"awsidentity",
5+
"bodyclose",
56
"buildinfo",
67
"buildname",
78
"circbuf",
@@ -52,6 +53,7 @@
5253
"ntqry",
5354
"OIDC",
5455
"oneof",
56+
"paralleltest",
5557
"parameterscopeid",
5658
"pqtype",
5759
"prometheusmetrics",
@@ -80,6 +82,7 @@
8082
"tfjson",
8183
"tfplan",
8284
"tfstate",
85+
"tparallel",
8386
"trimprefix",
8487
"turnconn",
8588
"typegen",

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ LABEL \
1515
org.opencontainers.image.version="$CODER_VERSION" \
1616
org.opencontainers.image.licenses="AGPL-3.0"
1717

18+
# The coder binary is injected by scripts/build_docker.sh.
19+
COPY --chown=coder:coder --chmod=755 coder /opt/coder
20+
1821
# Create coder group and user. We cannot use `addgroup` and `adduser` because
1922
# they won't work if we're building the image for a different architecture.
2023
COPY --chown=root:root --chmod=644 group passwd /etc/
21-
22-
# The coder binary is injected by scripts/build_docker.sh.
23-
COPY --chown=coder:coder --chmod=755 coder /opt/coder
24+
COPY --chown=coder:coder --chmod=700 empty-dir /home/coder
2425

2526
USER coder:coder
27+
ENV HOME=/home/coder
28+
WORKDIR /home/coder
29+
2630
ENTRYPOINT [ "/opt/coder", "server" ]

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ coderd/database/dump.sql: $(wildcard coderd/database/migrations/*.sql)
6363
coderd/database/querier.go: coderd/database/sqlc.yaml coderd/database/dump.sql $(wildcard coderd/database/queries/*.sql)
6464
coderd/database/generate.sh
6565

66-
# This target is deprecated, as GNU make has issues passing signals to subprocesses.
67-
dev:
68-
@echo Please run ./scripts/develop.sh manually.
69-
.PHONY: dev
70-
7166
fmt/prettier:
7267
@echo "--- prettier"
7368
cd site
@@ -121,6 +116,7 @@ lint: lint/shellcheck lint/go
121116
.PHONY: lint
122117

123118
lint/go:
119+
./scripts/check_enterprise_imports.sh
124120
golangci-lint run
125121
.PHONY: lint/go
126122

agent/reaper/reaper_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func TestReap(t *testing.T) {
2929
// exited processes and passing the PIDs through the shared
3030
// channel.
3131
t.Run("OK", func(t *testing.T) {
32+
t.Parallel()
3233
pids := make(reap.PidCh, 1)
3334
err := reaper.ForkReap(
3435
reaper.WithPIDCallback(pids),

cli/cliflag/cliflag.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
//
77
// Will produce the following usage docs:
88
//
9-
// -a, --address string The address to serve the API and dashboard (uses $CODER_ADDRESS). (default "127.0.0.1:3000")
10-
//
9+
// -a, --address string The address to serve the API and dashboard (uses $CODER_ADDRESS). (default "127.0.0.1:3000")
1110
package cliflag
1211

1312
import (

cli/cliflag/cliflag_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
)
1515

1616
// Testcliflag cannot run in parallel because it uses t.Setenv.
17+
//
1718
//nolint:paralleltest
1819
func TestCliflag(t *testing.T) {
1920
t.Run("StringDefault", func(t *testing.T) {

cli/clitest/clitest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
// New creates a CLI instance with a configuration pointed to a
2222
// temporary testing directory.
2323
func New(t *testing.T, args ...string) (*cobra.Command, config.Root) {
24-
cmd := cli.Root()
24+
cmd := cli.Root(cli.AGPL())
2525
dir := t.TempDir()
2626
root := config.Root(dir)
2727
cmd.SetArgs(append([]string{"--global-config", dir}, args...))

cli/cliui/table.go

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func DisplayTable(out any, sort string, filterColumns []string) (string, error)
9090
sort = strings.ToLower(strings.ReplaceAll(sort, "_", " "))
9191
h, ok := headersMap[sort]
9292
if !ok {
93-
return "", xerrors.Errorf("specified sort column %q not found in table headers, available columns are %q", sort, strings.Join(headersRaw, `", "`))
93+
return "", xerrors.Errorf(`specified sort column %q not found in table headers, available columns are "%v"`, sort, strings.Join(headersRaw, `", "`))
9494
}
9595

9696
// Autocorrect
@@ -101,7 +101,7 @@ func DisplayTable(out any, sort string, filterColumns []string) (string, error)
101101
column := strings.ToLower(strings.ReplaceAll(column, "_", " "))
102102
h, ok := headersMap[column]
103103
if !ok {
104-
return "", xerrors.Errorf("specified filter column %q not found in table headers, available columns are %q", sort, strings.Join(headersRaw, `", "`))
104+
return "", xerrors.Errorf(`specified filter column %q not found in table headers, available columns are "%v"`, sort, strings.Join(headersRaw, `", "`))
105105
}
106106

107107
// Autocorrect
@@ -158,6 +158,10 @@ func DisplayTable(out any, sort string, filterColumns []string) (string, error)
158158
if val != nil {
159159
v = val.Format(time.Stamp)
160160
}
161+
case fmt.Stringer:
162+
if val != nil {
163+
v = val.String()
164+
}
161165
}
162166

163167
rowSlice[i] = v
@@ -301,19 +305,3 @@ func valueToTableMap(val reflect.Value) (map[string]any, error) {
301305

302306
return row, nil
303307
}
304-
305-
func ValidateColumns(all, given []string) error {
306-
for _, col := range given {
307-
found := false
308-
for _, c := range all {
309-
if strings.EqualFold(strings.ReplaceAll(col, "_", " "), c) {
310-
found = true
311-
break
312-
}
313-
}
314-
if !found {
315-
return fmt.Errorf("unknown column: %s", col)
316-
}
317-
}
318-
return nil
319-
}

0 commit comments

Comments
 (0)