Skip to content

Commit 83c23aa

Browse files
committed
Merge branch 'main' of https://github.com/coder/coder into bq/make-batch-action-ga
2 parents 614bc14 + 3557497 commit 83c23aa

File tree

229 files changed

+8271
-6202
lines changed

Some content is hidden

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

229 files changed

+8271
-6202
lines changed

.github/dependabot.yaml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ updates:
88
timezone: "America/Chicago"
99
labels: []
1010
commit-message:
11-
prefix: "chore"
11+
prefix: "ci"
1212
ignore:
1313
# These actions deliver the latest versions by updating the major
1414
# release tag, so ignore minor and patch versions
@@ -117,11 +117,6 @@ updates:
117117
- "@eslint*"
118118
- "@typescript-eslint/eslint-plugin"
119119
- "@typescript-eslint/parser"
120-
jest:
121-
patterns:
122-
- "jest*"
123-
- "@swc/jest"
124-
- "@types/jest"
125120

126121
- package-ecosystem: "npm"
127122
directory: "/offlinedocs/"
@@ -146,20 +141,6 @@ updates:
146141
- version-update:semver-major
147142

148143
# Update dogfood.
149-
- package-ecosystem: "docker"
150-
directory: "/dogfood/"
151-
schedule:
152-
interval: "weekly"
153-
time: "06:00"
154-
timezone: "America/Chicago"
155-
commit-message:
156-
prefix: "chore"
157-
labels: []
158-
groups:
159-
dogfood-docker:
160-
patterns:
161-
- "*"
162-
163144
- package-ecosystem: "terraform"
164145
directory: "/dogfood/"
165146
schedule:

.github/workflows/ci.yaml

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ jobs:
137137
138138
# Check for any typos
139139
- name: Check for typos
140-
uses: crate-ci/typos@v1.16.6
140+
uses: crate-ci/typos@v1.16.8
141141
with:
142142
config: .github/workflows/typos.toml
143143

@@ -169,14 +169,35 @@ jobs:
169169
with:
170170
fetch-depth: 1
171171

172-
- name: Install Nix
173-
uses: DeterminateSystems/nix-installer-action@v4
172+
- name: Setup Node
173+
uses: ./.github/actions/setup-node
174+
175+
- name: Setup Go
176+
uses: ./.github/actions/setup-go
174177

175-
- name: Run the Magic Nix Cache
176-
uses: DeterminateSystems/magic-nix-cache-action@v2
178+
- name: Setup sqlc
179+
uses: ./.github/actions/setup-sqlc
180+
181+
- name: go install tools
182+
run: |
183+
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
184+
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
185+
go install golang.org/x/tools/cmd/goimports@latest
186+
go install github.com/mikefarah/yq/v4@v4.30.6
187+
go install github.com/golang/mock/mockgen@v1.6.0
188+
189+
- name: Install Protoc
190+
run: |
191+
mkdir -p /tmp/proto
192+
pushd /tmp/proto
193+
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
194+
unzip protoc.zip
195+
cp -r ./bin/* /usr/local/bin
196+
cp -r ./include /usr/local/bin/include
197+
popd
177198
178199
- name: make gen
179-
run: "nix-shell --command 'make --output-sync -j -B gen'"
200+
run: "make --output-sync -j -B gen"
180201

181202
- name: Check for unstaged files
182203
run: ./scripts/check_unstaged.sh
@@ -508,15 +529,27 @@ jobs:
508529
- name: Setup Terraform
509530
uses: ./.github/actions/setup-tf
510531

511-
- name: Install Nix
512-
uses: DeterminateSystems/nix-installer-action@v4
532+
- name: go install tools
533+
run: |
534+
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
535+
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
536+
go install golang.org/x/tools/cmd/goimports@latest
537+
go install github.com/mikefarah/yq/v4@v4.30.6
538+
go install github.com/golang/mock/mockgen@v1.6.0
513539
514-
- name: Run the Magic Nix Cache
515-
uses: DeterminateSystems/magic-nix-cache-action@v2
540+
- name: Install Protoc
541+
run: |
542+
mkdir -p /tmp/proto
543+
pushd /tmp/proto
544+
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
545+
unzip protoc.zip
546+
cp -r ./bin/* /usr/local/bin
547+
cp -r ./include /usr/local/bin/include
548+
popd
516549
517550
- name: Build
518551
run: |
519-
nix-shell --command 'make -B site/out/index.html'
552+
make -B site/out/index.html
520553
521554
- run: pnpm playwright:install
522555
working-directory: site

.github/workflows/pr-cleanup.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Cleanup PR deployment and image
1+
name: pr-cleanup
22
on:
33
pull_request:
44
types: closed
@@ -35,14 +35,14 @@ jobs:
3535

3636
- name: Set up kubeconfig
3737
run: |
38-
set -euxo pipefail
38+
set -euo pipefail
3939
mkdir -p ~/.kube
4040
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG }}" > ~/.kube/config
4141
export KUBECONFIG=~/.kube/config
4242
4343
- name: Delete helm release
4444
run: |
45-
set -euxo pipefail
45+
set -euo pipefail
4646
helm delete --namespace "pr${{ steps.pr_number.outputs.PR_NUMBER }}" "pr${{ steps.pr_number.outputs.PR_NUMBER }}" || echo "helm release not found"
4747
4848
- name: "Remove PR namespace"
@@ -51,7 +51,7 @@ jobs:
5151
5252
- name: "Remove DNS records"
5353
run: |
54-
set -euxo pipefail
54+
set -euo pipefail
5555
# Get identifier for the record
5656
record_id=$(curl -X GET "https://api.cloudflare.com/client/v4/zones/${{ secrets.PR_DEPLOYMENTS_ZONE_ID }}/dns_records?name=%2A.pr${{ steps.pr_number.outputs.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" \
5757
-H "Authorization: Bearer ${{ secrets.PR_DEPLOYMENTS_CLOUDFLARE_API_TOKEN }}" \

.golangci.yaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
# Over time we should try tightening some of these.
33

44
linters-settings:
5+
dupl:
6+
# goal: 100
7+
threshold: 412
8+
59
exhaustruct:
610
include:
711
# Gradually extend to cover more of the codebase.
812
- 'httpmw\.\w+'
913
gocognit:
10-
min-complexity: 46 # Min code complexity (def 30).
14+
min-complexity: 300
1115

1216
goconst:
1317
min-len: 4 # Min length of string consts (def 3).
@@ -118,10 +122,6 @@ linters-settings:
118122
goimports:
119123
local-prefixes: coder.com,cdr.dev,go.coder.com,github.com/cdr,github.com/coder
120124

121-
gocyclo:
122-
# goal: 30
123-
min-complexity: 47
124-
125125
importas:
126126
no-unaliased: true
127127

@@ -232,7 +232,11 @@ linters:
232232
- exportloopref
233233
- forcetypeassert
234234
- gocritic
235-
- gocyclo
235+
# gocyclo is may be useful in the future when we start caring
236+
# about testing complexity, but for the time being we should
237+
# create a good culture around cognitive complexity.
238+
# - gocyclo
239+
- gocognit
236240
- goimports
237241
- gomodguard
238242
- gosec
@@ -268,3 +272,4 @@ linters:
268272
- typecheck
269273
- unconvert
270274
- unused
275+
- dupl

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,10 @@ DB_GEN_FILES := \
456456

457457
# all gen targets should be added here and to gen/mark-fresh
458458
gen: \
459-
coderd/database/dump.sql \
460-
$(DB_GEN_FILES) \
461459
provisionersdk/proto/provisioner.pb.go \
462460
provisionerd/proto/provisionerd.pb.go \
461+
coderd/database/dump.sql \
462+
$(DB_GEN_FILES) \
463463
site/src/api/typesGenerated.ts \
464464
coderd/rbac/object_gen.go \
465465
docs/admin/prometheus.md \
@@ -478,10 +478,10 @@ gen: \
478478
# used during releases so we don't run generation scripts.
479479
gen/mark-fresh:
480480
files="\
481-
coderd/database/dump.sql \
482-
$(DB_GEN_FILES) \
483481
provisionersdk/proto/provisioner.pb.go \
484482
provisionerd/proto/provisionerd.pb.go \
483+
coderd/database/dump.sql \
484+
$(DB_GEN_FILES) \
485485
site/src/api/typesGenerated.ts \
486486
coderd/rbac/object_gen.go \
487487
docs/admin/prometheus.md \

cli/agent_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ func TestWorkspaceAgent(t *testing.T) {
7575
user := coderdtest.CreateFirstUser(t, client)
7676
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
7777
Parse: echo.ParseComplete,
78-
ProvisionApply: []*proto.Provision_Response{{
79-
Type: &proto.Provision_Response_Complete{
80-
Complete: &proto.Provision_Complete{
78+
ProvisionApply: []*proto.Response{{
79+
Type: &proto.Response_Apply{
80+
Apply: &proto.ApplyComplete{
8181
Resources: []*proto.Resource{{
8282
Name: "somename",
8383
Type: "someinstance",
@@ -127,9 +127,9 @@ func TestWorkspaceAgent(t *testing.T) {
127127
user := coderdtest.CreateFirstUser(t, client)
128128
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
129129
Parse: echo.ParseComplete,
130-
ProvisionApply: []*proto.Provision_Response{{
131-
Type: &proto.Provision_Response_Complete{
132-
Complete: &proto.Provision_Complete{
130+
ProvisionApply: []*proto.Response{{
131+
Type: &proto.Response_Apply{
132+
Apply: &proto.ApplyComplete{
133133
Resources: []*proto.Resource{{
134134
Name: "somename",
135135
Type: "someinstance",
@@ -179,9 +179,9 @@ func TestWorkspaceAgent(t *testing.T) {
179179
user := coderdtest.CreateFirstUser(t, client)
180180
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
181181
Parse: echo.ParseComplete,
182-
ProvisionApply: []*proto.Provision_Response{{
183-
Type: &proto.Provision_Response_Complete{
184-
Complete: &proto.Provision_Complete{
182+
ProvisionApply: []*proto.Response{{
183+
Type: &proto.Response_Apply{
184+
Apply: &proto.ApplyComplete{
185185
Resources: []*proto.Resource{{
186186
Name: "somename",
187187
Type: "someinstance",

cli/configssh.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ func sshPrepareWorkspaceConfigs(ctx context.Context, client *codersdk.Client) (r
190190
}
191191
}
192192

193-
//nolint:gocyclo
194193
func (r *RootCmd) configSSH() *clibase.Cmd {
195194
var (
196195
sshConfigFile string

cli/configssh_test.go

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ func TestConfigSSH(t *testing.T) {
8282
authToken := uuid.NewString()
8383
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
8484
Parse: echo.ParseComplete,
85-
ProvisionPlan: []*proto.Provision_Response{{
86-
Type: &proto.Provision_Response_Complete{
87-
Complete: &proto.Provision_Complete{
85+
ProvisionPlan: []*proto.Response{{
86+
Type: &proto.Response_Plan{
87+
Plan: &proto.PlanComplete{
8888
Resources: []*proto.Resource{{
8989
Name: "example",
9090
Type: "aws_instance",
@@ -720,22 +720,11 @@ func TestConfigSSH_Hostnames(t *testing.T) {
720720
resources = append(resources, resource)
721721
}
722722

723-
provisionResponse := []*proto.Provision_Response{{
724-
Type: &proto.Provision_Response_Complete{
725-
Complete: &proto.Provision_Complete{
726-
Resources: resources,
727-
},
728-
},
729-
}}
730-
731723
client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true})
732724
user := coderdtest.CreateFirstUser(t, client)
733725
// authToken := uuid.NewString()
734-
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
735-
Parse: echo.ParseComplete,
736-
ProvisionPlan: provisionResponse,
737-
ProvisionApply: provisionResponse,
738-
})
726+
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID,
727+
echo.WithResources(resources))
739728
coderdtest.AwaitTemplateVersionJob(t, client, version.ID)
740729
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
741730
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)

0 commit comments

Comments
 (0)