Skip to content

Commit 26286f6

Browse files
committed
Merge remote-tracking branch 'origin' into bp-scaling-coder
2 parents ba303be + b3ba0f9 commit 26286f6

File tree

292 files changed

+12694
-4945
lines changed

Some content is hidden

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

292 files changed

+12694
-4945
lines changed

.github/cherry-pick-bot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
enabled: true
2+
preservePullRequestTitle: true

.github/workflows/ci.yaml

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ jobs:
318318
run: ./scripts/check_unstaged.sh
319319

320320
test-go:
321-
runs-on: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'depot-ubuntu-22.04-4' || matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'macos-latest-xlarge' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'windows-latest-16-cores' || matrix.os }}
321+
runs-on: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'depot-ubuntu-22.04-4' || matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'depot-macos-latest' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'windows-latest-16-cores' || matrix.os }}
322322
needs: changes
323323
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
324324
timeout-minutes: 20
@@ -379,7 +379,7 @@ jobs:
379379
api-key: ${{ secrets.DATADOG_API_KEY }}
380380

381381
test-go-pg:
382-
runs-on: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'depot-ubuntu-22.04-4' || matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'macos-latest-xlarge' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'windows-latest-16-cores' || matrix.os }}
382+
runs-on: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'depot-ubuntu-22.04-4' || matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'depot-macos-latest' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'windows-latest-16-cores' || matrix.os }}
383383
needs: changes
384384
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
385385
# This timeout must be greater than the timeout set by `go test` in
@@ -419,6 +419,8 @@ jobs:
419419
env:
420420
POSTGRES_VERSION: "13"
421421
TS_DEBUG_DISCO: "true"
422+
LC_CTYPE: "en_US.UTF-8"
423+
LC_ALL: "en_US.UTF-8"
422424
shell: bash
423425
run: |
424426
# if macOS, install google-chrome for scaletests
@@ -445,10 +447,14 @@ jobs:
445447
# C: drive is extremely slow: https://github.com/actions/runner-images/issues/8755
446448
mkdir -p "R:/temp/embedded-pg"
447449
go run scripts/embedded-pg/main.go -path "R:/temp/embedded-pg"
448-
DB=ci gotestsum --format standard-quiet -- -v -short -count=1 ./...
450+
# Reduce test parallelism, mirroring what we do for race tests.
451+
# We'd been encountering issues with timing related flakes, and
452+
# this seems to help.
453+
DB=ci gotestsum --format standard-quiet -- -v -short -count=1 -parallel 4 -p 4 ./...
449454
else
450455
go run scripts/embedded-pg/main.go
451-
DB=ci gotestsum --format standard-quiet -- -v -short -count=1 ./...
456+
# Reduce test parallelism, like for Windows above.
457+
DB=ci gotestsum --format standard-quiet -- -v -short -count=1 -parallel 4 -p 4 ./...
452458
fi
453459
454460
- name: Upload test stats to Datadog
@@ -1245,3 +1251,50 @@ jobs:
12451251
- name: Setup and run sqlc vet
12461252
run: |
12471253
make sqlc-vet
1254+
1255+
notify-slack-on-failure:
1256+
needs:
1257+
- required
1258+
runs-on: ubuntu-latest
1259+
if: failure() && github.ref == 'refs/heads/main'
1260+
1261+
steps:
1262+
- name: Send Slack notification
1263+
run: |
1264+
curl -X POST -H 'Content-type: application/json' \
1265+
--data '{
1266+
"blocks": [
1267+
{
1268+
"type": "header",
1269+
"text": {
1270+
"type": "plain_text",
1271+
"text": "❌ CI Failure in main",
1272+
"emoji": true
1273+
}
1274+
},
1275+
{
1276+
"type": "section",
1277+
"fields": [
1278+
{
1279+
"type": "mrkdwn",
1280+
"text": "*Workflow:*\n${{ github.workflow }}"
1281+
},
1282+
{
1283+
"type": "mrkdwn",
1284+
"text": "*Committer:*\n${{ github.actor }}"
1285+
},
1286+
{
1287+
"type": "mrkdwn",
1288+
"text": "*Commit:*\n${{ github.sha }}"
1289+
}
1290+
]
1291+
},
1292+
{
1293+
"type": "section",
1294+
"text": {
1295+
"type": "mrkdwn",
1296+
"text": "*View failure:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here>"
1297+
}
1298+
}
1299+
]
1300+
}' ${{ secrets.CI_FAILURE_SLACK_WEBHOOK }}

.github/workflows/nightly-gauntlet.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,51 @@ jobs:
7272
if: always()
7373
with:
7474
api-key: ${{ secrets.DATADOG_API_KEY }}
75+
76+
notify-slack-on-failure:
77+
needs:
78+
- go-race
79+
- go-timing
80+
runs-on: ubuntu-latest
81+
if: failure()
82+
83+
steps:
84+
- name: Send Slack notification
85+
run: |
86+
curl -X POST -H 'Content-type: application/json' \
87+
--data '{
88+
"blocks": [
89+
{
90+
"type": "header",
91+
"text": {
92+
"type": "plain_text",
93+
"text": "❌ Nightly gauntlet failed",
94+
"emoji": true
95+
}
96+
},
97+
{
98+
"type": "section",
99+
"fields": [
100+
{
101+
"type": "mrkdwn",
102+
"text": "*Workflow:*\n${{ github.workflow }}"
103+
},
104+
{
105+
"type": "mrkdwn",
106+
"text": "*Committer:*\n${{ github.actor }}"
107+
},
108+
{
109+
"type": "mrkdwn",
110+
"text": "*Commit:*\n${{ github.sha }}"
111+
}
112+
]
113+
},
114+
{
115+
"type": "section",
116+
"text": {
117+
"type": "mrkdwn",
118+
"text": "*View failure:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here>"
119+
}
120+
}
121+
]
122+
}' ${{ secrets.CI_FAILURE_SLACK_WEBHOOK }}

.github/workflows/pr-deploy.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
push:
88
branches-ignore:
99
- main
10+
- "temp-cherry-pick-*"
1011
workflow_dispatch:
1112
inputs:
1213
experiments:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ site/stats/
5454

5555
# direnv
5656
.envrc
57+
.direnv
5758
*.test
5859

5960
# Loadtesting

Makefile

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ $(CODER_DYLIBS): go.mod go.sum $(GO_SRC_FILES)
260260

261261
# This task builds both dylibs
262262
build/coder-dylib: $(CODER_DYLIBS)
263+
.PHONY: build/coder-dylib
263264

264265
# This task builds all archives. It parses the target name to get the metadata
265266
# for the build, so it must be specified in this format:
@@ -391,21 +392,31 @@ node_modules/.installed: package.json
391392
./scripts/pnpm_install.sh
392393

393394
offlinedocs/node_modules/.installed: offlinedocs/package.json
394-
cd offlinedocs
395+
cd offlinedocs/
395396
../scripts/pnpm_install.sh
396397

397398
site/node_modules/.installed: site/package.json
398-
cd site
399+
cd site/
399400
../scripts/pnpm_install.sh
400401

401-
site/out/index.html: site/node_modules/.installed $(shell find ./site $(FIND_EXCLUSIONS) -type f \( -name '*.ts' -o -name '*.tsx' \))
402-
cd site
402+
SITE_GEN_FILES := \
403+
site/src/api/typesGenerated.ts \
404+
site/src/api/rbacresourcesGenerated.ts \
405+
site/src/api/countriesGenerated.ts \
406+
site/src/theme/icons.json
407+
408+
site/out/index.html: \
409+
site/node_modules/.installed \
410+
site/static/install.sh \
411+
$(SITE_GEN_FILES) \
412+
$(shell find ./site $(FIND_EXCLUSIONS) -type f \( -name '*.ts' -o -name '*.tsx' \))
413+
cd site/
403414
# prevents this directory from getting to big, and causing "too much data" errors
404415
rm -rf out/assets/
405416
pnpm build
406417

407418
offlinedocs/out/index.html: offlinedocs/node_modules/.installed $(shell find ./offlinedocs $(FIND_EXCLUSIONS) -type f) $(shell find ./docs $(FIND_EXCLUSIONS) -type f | sed 's: :\\ :g')
408-
cd offlinedocs
419+
cd offlinedocs/
409420
../scripts/pnpm_install.sh
410421
pnpm export
411422

@@ -450,7 +461,7 @@ endif
450461

451462
fmt/biome: site/node_modules/.installed
452463
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/biome$(RESET)"
453-
cd site
464+
cd site/
454465
# Avoid writing files in CI to reduce file write activity
455466
ifdef CI
456467
pnpm run format:check
@@ -487,7 +498,7 @@ lint/site-icons:
487498
.PHONY: lint/site-icons
488499

489500
lint/ts: site/node_modules/.installed
490-
cd site
501+
cd site/
491502
pnpm lint
492503
.PHONY: lint/ts
493504

@@ -509,7 +520,7 @@ lint/shellcheck: $(SHELL_SRC_FILES)
509520
.PHONY: lint/shellcheck
510521

511522
lint/helm:
512-
cd helm
523+
cd helm/
513524
make lint
514525
.PHONY: lint/helm
515526

@@ -520,6 +531,7 @@ lint/markdown: node_modules/.installed
520531
# All files generated by the database should be added here, and this can be used
521532
# as a target for jobs that need to run after the database is generated.
522533
DB_GEN_FILES := \
534+
coderd/database/dump.sql \
523535
coderd/database/querier.go \
524536
coderd/database/unique_constraint.go \
525537
coderd/database/dbmem/dbmem.go \
@@ -539,26 +551,23 @@ GEN_FILES := \
539551
provisionersdk/proto/provisioner.pb.go \
540552
provisionerd/proto/provisionerd.pb.go \
541553
vpn/vpn.pb.go \
542-
coderd/database/dump.sql \
543554
$(DB_GEN_FILES) \
544-
site/src/api/typesGenerated.ts \
555+
$(SITE_GEN_FILES) \
545556
coderd/rbac/object_gen.go \
546557
codersdk/rbacresources_gen.go \
547-
site/src/api/rbacresourcesGenerated.ts \
548-
site/src/api/countriesGenerated.ts \
549558
docs/admin/integrations/prometheus.md \
550559
docs/reference/cli/index.md \
551560
docs/admin/security/audit-logs.md \
552561
coderd/apidoc/swagger.json \
553562
provisioner/terraform/testdata/version \
554563
site/e2e/provisionerGenerated.ts \
555-
site/src/theme/icons.json \
556564
examples/examples.gen.json \
557565
$(TAILNETTEST_MOCKS) \
558566
coderd/database/pubsub/psmock/psmock.go
559567

568+
560569
# all gen targets should be added here and to gen/mark-fresh
561-
gen: $(GEN_FILES)
570+
gen: gen/db $(GEN_FILES)
562571
.PHONY: gen
563572

564573
gen/db: $(DB_GEN_FILES)
@@ -599,7 +608,7 @@ gen/mark-fresh:
599608
fi
600609

601610
# touch sets the mtime of the file to the current time
602-
touch $$file
611+
touch "$$file"
603612
done
604613
.PHONY: gen/mark-fresh
605614

@@ -664,16 +673,16 @@ vpn/vpn.pb.go: vpn/vpn.proto
664673
site/src/api/typesGenerated.ts: site/node_modules/.installed $(wildcard scripts/apitypings/*) $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
665674
# -C sets the directory for the go run command
666675
go run -C ./scripts/apitypings main.go > $@
667-
cd site
676+
cd site/
668677
pnpm exec biome format --write src/api/typesGenerated.ts
669678

670679
site/e2e/provisionerGenerated.ts: site/node_modules/.installed provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
671-
cd site
680+
cd site/
672681
pnpm run gen:provisioner
673682

674683
site/src/theme/icons.json: site/node_modules/.installed $(wildcard scripts/gensite/*) $(wildcard site/static/icon/*)
675684
go run ./scripts/gensite/ -icons "$@"
676-
cd site
685+
cd site/
677686
pnpm exec biome format --write src/theme/icons.json
678687

679688
examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(shell find ./examples/templates)
@@ -693,12 +702,12 @@ codersdk/rbacresources_gen.go: scripts/typegen/codersdk.gotmpl scripts/typegen/m
693702

694703
site/src/api/rbacresourcesGenerated.ts: site/node_modules/.installed scripts/typegen/codersdk.gotmpl scripts/typegen/main.go coderd/rbac/object.go coderd/rbac/policy/policy.go
695704
go run scripts/typegen/main.go rbac typescript > "$@"
696-
cd site
705+
cd site/
697706
pnpm exec biome format --write src/api/rbacresourcesGenerated.ts
698707

699708
site/src/api/countriesGenerated.ts: site/node_modules/.installed scripts/typegen/countries.tstmpl scripts/typegen/main.go codersdk/countries.go
700709
go run scripts/typegen/main.go countries > "$@"
701-
cd site
710+
cd site/
702711
pnpm exec biome format --write src/api/countriesGenerated.ts
703712

704713
docs/admin/integrations/prometheus.md: node_modules/.installed scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics
@@ -710,7 +719,7 @@ docs/reference/cli/index.md: node_modules/.installed site/node_modules/.installe
710719
CI=true BASE_PATH="." go run ./scripts/clidocgen
711720
pnpm exec markdownlint-cli2 --fix ./docs/reference/cli/*.md
712721
pnpm exec markdown-table-formatter ./docs/reference/cli/*.md
713-
cd site
722+
cd site/
714723
pnpm exec biome format --write ../docs/manifest.json
715724

716725
docs/admin/security/audit-logs.md: node_modules/.installed coderd/database/querier.go scripts/auditdocgen/main.go enterprise/audit/table.go coderd/rbac/object_gen.go
@@ -722,7 +731,7 @@ coderd/apidoc/swagger.json: node_modules/.installed site/node_modules/.installed
722731
./scripts/apidocgen/generate.sh
723732
pnpm exec markdownlint-cli2 --fix ./docs/reference/api/*.md
724733
pnpm exec markdown-table-formatter ./docs/reference/api/*.md
725-
cd site
734+
cd site/
726735
pnpm exec biome format --write ../docs/manifest.json ../coderd/apidoc/swagger.json
727736

728737
update-golden-files: \
@@ -850,6 +859,7 @@ test-migrations: test-postgres-docker
850859
if [[ "$${COMMIT_FROM}" == "$${COMMIT_TO}" ]]; then echo "Nothing to do!"; exit 0; fi
851860
echo "DROP DATABASE IF EXISTS migrate_test_$${COMMIT_FROM}; CREATE DATABASE migrate_test_$${COMMIT_FROM};" | psql 'postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable'
852861
go run ./scripts/migrate-test/main.go --from="$$COMMIT_FROM" --to="$$COMMIT_TO" --postgres-url="postgresql://postgres:postgres@localhost:5432/migrate_test_$${COMMIT_FROM}?sslmode=disable"
862+
.PHONY: test-migrations
853863

854864
# NOTE: we set --memory to the same size as a GitHub runner.
855865
test-postgres-docker:
@@ -897,6 +907,7 @@ test-tailnet-integration:
897907
-timeout=5m \
898908
-count=1 \
899909
./tailnet/test/integration
910+
.PHONY: test-tailnet-integration
900911

901912
# Note: we used to add this to the test target, but it's not necessary and we can
902913
# achieve the desired result by specifying -count=1 in the go test invocation
@@ -905,6 +916,11 @@ test-clean:
905916
go clean -testcache
906917
.PHONY: test-clean
907918

919+
test-e2e: site/node_modules/.installed site/out/index.html
920+
cd site/
921+
ifdef CI
922+
DEBUG=pw:api pnpm playwright:test --forbid-only --workers 1
923+
else
924+
pnpm playwright:test
925+
endif
908926
.PHONY: test-e2e
909-
test-e2e: site/node_modules/.installed
910-
cd ./site && DEBUG=pw:api pnpm playwright:test --forbid-only --workers 1

agent/agent_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import (
5858
)
5959

6060
func TestMain(m *testing.M) {
61-
goleak.VerifyTestMain(m)
61+
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
6262
}
6363

6464
// NOTE: These tests only work when your default shell is bash for some reason.

agent/agentscripts/agentscripts_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
)
2525

2626
func TestMain(m *testing.M) {
27-
goleak.VerifyTestMain(m)
27+
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
2828
}
2929

3030
func TestExecuteBasic(t *testing.T) {

agent/agentssh/agentssh_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
)
3030

3131
func TestMain(m *testing.M) {
32-
goleak.VerifyTestMain(m)
32+
goleak.VerifyTestMain(m, testutil.GoleakOptions...)
3333
}
3434

3535
func TestNewServer_ServeClient(t *testing.T) {

0 commit comments

Comments
 (0)