Skip to content

Commit c3f5e2a

Browse files
Merge branch 'main' into dm-allow-notification-templates-to-be-disabled-by-default
2 parents fd7ed60 + 24dd8a1 commit c3f5e2a

35 files changed

+1618
-62
lines changed

.github/workflows/ci.yaml

+57-3
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,7 +447,10 @@ 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
451456
DB=ci gotestsum --format standard-quiet -- -v -short -count=1 ./...
@@ -1245,3 +1250,52 @@ jobs:
12451250
- name: Setup and run sqlc vet
12461251
run: |
12471252
make sqlc-vet
1253+
1254+
notify-slack-on-failure:
1255+
runs-on: ubuntu-latest
1256+
if: always() && failure() && github.ref == 'refs/heads/main'
1257+
1258+
steps:
1259+
- name: Send Slack notification
1260+
run: |
1261+
curl -X POST -H 'Content-type: application/json' \
1262+
--data '{
1263+
"blocks": [
1264+
{
1265+
"type": "header",
1266+
"text": {
1267+
"type": "plain_text",
1268+
"text": "❌ CI Failure in main",
1269+
"emoji": true
1270+
}
1271+
},
1272+
{
1273+
"type": "section",
1274+
"fields": [
1275+
{
1276+
"type": "mrkdwn",
1277+
"text": "*Workflow:*\n${{ github.workflow }}"
1278+
},
1279+
{
1280+
"type": "mrkdwn",
1281+
"text": "*Failed Job:*\n${{ github.job }}"
1282+
},
1283+
{
1284+
"type": "mrkdwn",
1285+
"text": "*Committer:*\n${{ github.actor }}"
1286+
},
1287+
{
1288+
"type": "mrkdwn",
1289+
"text": "*Commit:*\n${{ github.sha }}"
1290+
}
1291+
]
1292+
},
1293+
{
1294+
"type": "section",
1295+
"text": {
1296+
"type": "mrkdwn",
1297+
"text": "*View failure:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here>"
1298+
}
1299+
}
1300+
]
1301+
}' ${{ secrets.CI_FAILURE_SLACK_WEBHOOK }}

.github/workflows/nightly-gauntlet.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,55 @@ 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": "*Failed Job:*\n${{ github.job }}"
107+
},
108+
{
109+
"type": "mrkdwn",
110+
"text": "*Committer:*\n${{ github.actor }}"
111+
},
112+
{
113+
"type": "mrkdwn",
114+
"text": "*Commit:*\n${{ github.sha }}"
115+
}
116+
]
117+
},
118+
{
119+
"type": "section",
120+
"text": {
121+
"type": "mrkdwn",
122+
"text": "*View failure:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here>"
123+
}
124+
}
125+
]
126+
}' ${{ secrets.CI_FAILURE_SLACK_WEBHOOK }}

Makefile

+2-3
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ lint/markdown: node_modules/.installed
521521
# All files generated by the database should be added here, and this can be used
522522
# as a target for jobs that need to run after the database is generated.
523523
DB_GEN_FILES := \
524+
coderd/database/dump.sql \
524525
coderd/database/querier.go \
525526
coderd/database/unique_constraint.go \
526527
coderd/database/dbmem/dbmem.go \
@@ -540,8 +541,6 @@ GEN_FILES := \
540541
provisionersdk/proto/provisioner.pb.go \
541542
provisionerd/proto/provisionerd.pb.go \
542543
vpn/vpn.pb.go \
543-
coderd/database/dump.sql \
544-
$(DB_GEN_FILES) \
545544
site/src/api/typesGenerated.ts \
546545
coderd/rbac/object_gen.go \
547546
codersdk/rbacresources_gen.go \
@@ -559,7 +558,7 @@ GEN_FILES := \
559558
coderd/database/pubsub/psmock/psmock.go
560559

561560
# all gen targets should be added here and to gen/mark-fresh
562-
gen: $(GEN_FILES)
561+
gen: gen/db $(GEN_FILES)
563562
.PHONY: gen
564563

565564
gen/db: $(DB_GEN_FILES)

cli/ssh_test.go

+24-11
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,25 @@ func TestSSH(t *testing.T) {
154154
// a start build of the workspace.
155155
isFirstBuild := true
156156
buildURL := regexp.MustCompile("/api/v2/workspaces/.*/builds")
157-
buildReq := make(chan struct{})
158-
buildResume := make(chan struct{})
157+
buildPause := make(chan bool)
158+
buildDone := make(chan struct{})
159159
buildSyncMW := func(next http.Handler) http.Handler {
160160
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
161161
if r.Method == http.MethodPost && buildURL.MatchString(r.URL.Path) {
162162
if !isFirstBuild {
163-
t.Log("buildSyncMW: blocking build")
164-
buildReq <- struct{}{}
165-
<-buildResume
163+
t.Log("buildSyncMW: pausing build")
164+
if shouldContinue := <-buildPause; !shouldContinue {
165+
// We can't force the API to trigger a build conflict (racy) so we fake it.
166+
t.Log("buildSyncMW: return conflict")
167+
w.WriteHeader(http.StatusConflict)
168+
return
169+
}
166170
t.Log("buildSyncMW: resuming build")
171+
defer func() {
172+
t.Log("buildSyncMW: sending build done")
173+
buildDone <- struct{}{}
174+
t.Log("buildSyncMW: done")
175+
}()
167176
} else {
168177
isFirstBuild = false
169178
}
@@ -211,10 +220,15 @@ func TestSSH(t *testing.T) {
211220
for _, pty := range ptys {
212221
pty.ExpectMatchContext(ctx, "Workspace was stopped, starting workspace to allow connecting to")
213222
}
214-
for range ptys {
215-
testutil.RequireRecvCtx(ctx, t, buildReq)
223+
224+
// Allow one build to complete.
225+
testutil.RequireSendCtx(ctx, t, buildPause, true)
226+
testutil.RequireRecvCtx(ctx, t, buildDone)
227+
228+
// Allow the remaining builds to continue.
229+
for i := 0; i < len(ptys)-1; i++ {
230+
testutil.RequireSendCtx(ctx, t, buildPause, false)
216231
}
217-
close(buildResume)
218232

219233
var foundConflict int
220234
for _, pty := range ptys {
@@ -1132,9 +1146,8 @@ func TestSSH(t *testing.T) {
11321146
// started and accepting input on stdin.
11331147
_ = pty.Peek(ctx, 1)
11341148

1135-
// Download the test page
1136-
pty.WriteLine(fmt.Sprintf("ss -xl state listening src %s | wc -l", remoteSock))
1137-
pty.ExpectMatch("2")
1149+
pty.WriteLine(fmt.Sprintf("netstat -an | grep -q %s; echo \"returned $?\"", remoteSock))
1150+
pty.ExpectMatchContext(ctx, "returned 0")
11381151

11391152
// And we're done.
11401153
pty.WriteLine("exit")

coderd/apidoc/docs.go

+61
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

+57
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)