Skip to content

Commit 2f9c32c

Browse files
committed
Merge branch 'main' into lilac/local-cli-install
2 parents 1a6b15b + 0008c13 commit 2f9c32c

File tree

58 files changed

+2550
-221
lines changed

Some content is hidden

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

58 files changed

+2550
-221
lines changed

.github/workflows/ci.yaml

Lines changed: 53 additions & 3 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
@@ -451,7 +453,8 @@ jobs:
451453
DB=ci gotestsum --format standard-quiet -- -v -short -count=1 -parallel 4 -p 4 ./...
452454
else
453455
go run scripts/embedded-pg/main.go
454-
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 ./...
455458
fi
456459
457460
- name: Upload test stats to Datadog
@@ -1248,3 +1251,50 @@ jobs:
12481251
- name: Setup and run sqlc vet
12491252
run: |
12501253
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 }}

.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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ lint/markdown: node_modules/.installed
531531
# All files generated by the database should be added here, and this can be used
532532
# as a target for jobs that need to run after the database is generated.
533533
DB_GEN_FILES := \
534+
coderd/database/dump.sql \
534535
coderd/database/querier.go \
535536
coderd/database/unique_constraint.go \
536537
coderd/database/dbmem/dbmem.go \
@@ -550,7 +551,6 @@ GEN_FILES := \
550551
provisionersdk/proto/provisioner.pb.go \
551552
provisionerd/proto/provisionerd.pb.go \
552553
vpn/vpn.pb.go \
553-
coderd/database/dump.sql \
554554
$(DB_GEN_FILES) \
555555
$(SITE_GEN_FILES) \
556556
coderd/rbac/object_gen.go \
@@ -567,7 +567,7 @@ GEN_FILES := \
567567

568568

569569
# all gen targets should be added here and to gen/mark-fresh
570-
gen: $(GEN_FILES)
570+
gen: gen/db $(GEN_FILES)
571571
.PHONY: gen
572572

573573
gen/db: $(DB_GEN_FILES)

cli/ssh_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,9 +1146,8 @@ func TestSSH(t *testing.T) {
11461146
// started and accepting input on stdin.
11471147
_ = pty.Peek(ctx, 1)
11481148

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

11531152
// And we're done.
11541153
pty.WriteLine("exit")

coderd/apidoc/docs.go

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/coderd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ func New(options *Options) *API {
12811281
r.Use(apiKeyMiddleware)
12821282
r.Get("/daus", api.deploymentDAUs)
12831283
r.Get("/user-activity", api.insightsUserActivity)
1284+
r.Get("/user-status-counts", api.insightsUserStatusCounts)
12841285
r.Get("/user-latency", api.insightsUserLatency)
12851286
r.Get("/templates", api.insightsTemplates)
12861287
})

coderd/database/dbauthz/dbauthz.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,6 +2421,13 @@ func (q *querier) GetUserNotificationPreferences(ctx context.Context, userID uui
24212421
return q.db.GetUserNotificationPreferences(ctx, userID)
24222422
}
24232423

2424+
func (q *querier) GetUserStatusCounts(ctx context.Context, arg database.GetUserStatusCountsParams) ([]database.GetUserStatusCountsRow, error) {
2425+
if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceUser); err != nil {
2426+
return nil, err
2427+
}
2428+
return q.db.GetUserStatusCounts(ctx, arg)
2429+
}
2430+
24242431
func (q *querier) GetUserWorkspaceBuildParameters(ctx context.Context, params database.GetUserWorkspaceBuildParametersParams) ([]database.GetUserWorkspaceBuildParametersRow, error) {
24252432
u, err := q.db.GetUserByID(ctx, params.OwnerID)
24262433
if err != nil {

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,6 +1708,12 @@ func (s *MethodTestSuite) TestUser() {
17081708
rbac.ResourceTemplate.InOrg(orgID), policy.ActionRead,
17091709
)
17101710
}))
1711+
s.Run("GetUserStatusCounts", s.Subtest(func(db database.Store, check *expects) {
1712+
check.Args(database.GetUserStatusCountsParams{
1713+
StartTime: time.Now().Add(-time.Hour * 24 * 30),
1714+
EndTime: time.Now(),
1715+
}).Asserts(rbac.ResourceUser, policy.ActionRead)
1716+
}))
17111717
}
17121718

17131719
func (s *MethodTestSuite) TestWorkspace() {

0 commit comments

Comments
 (0)