Skip to content

Commit b7331df

Browse files
authored
Merge branch 'main' into 216-disable-prettier-docs-md
2 parents 4dc14ea + c528791 commit b7331df

File tree

41 files changed

+1267
-329
lines changed

Some content is hidden

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

41 files changed

+1267
-329
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -630,11 +630,8 @@ jobs:
630630
working-directory: site
631631

632632
test-e2e:
633-
# test-e2e fails on 2-core 8GB runners, so we use the 4-core 16GB runner
634633
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-4' || 'ubuntu-latest' }}
635634
needs: changes
636-
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
637-
timeout-minutes: 20
638635
strategy:
639636
fail-fast: false
640637
matrix:
@@ -643,6 +640,9 @@ jobs:
643640
name: test-e2e
644641
- premium: true
645642
name: test-e2e-premium
643+
# Skip test-e2e on forks as they don't have access to CI secrets
644+
if: (needs.changes.outputs.go == 'true' || needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main') && !(github.event.pull_request.head.repo.fork)
645+
timeout-minutes: 20
646646
name: ${{ matrix.variant.name }}
647647
steps:
648648
- name: Harden Runner
@@ -749,7 +749,7 @@ jobs:
749749
# Prevent excessive build runs on minor version changes
750750
skip: "@(renovate/**|dependabot/**)"
751751
# Run TurboSnap to trace file dependencies to related stories
752-
# and tell chromatic to only take snapshots of relevent stories
752+
# and tell chromatic to only take snapshots of relevant stories
753753
onlyChanged: true
754754
# Avoid uploading single files, because that's very slow
755755
zip: true
@@ -776,7 +776,7 @@ jobs:
776776
workingDir: "./site"
777777
storybookBaseDir: "./site"
778778
# Run TurboSnap to trace file dependencies to related stories
779-
# and tell chromatic to only take snapshots of relevent stories
779+
# and tell chromatic to only take snapshots of relevant stories
780780
onlyChanged: true
781781
# Avoid uploading single files, because that's very slow
782782
zip: true

.github/workflows/contrib.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141

4242
cla:
4343
runs-on: ubuntu-latest
44+
permissions:
45+
pull-requests: write
4446
steps:
4547
- name: Harden Runner
4648
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
@@ -53,7 +55,7 @@ jobs:
5355
env:
5456
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5557
# the below token should have repo scope and must be manually added by you in the repository's secret
56-
PERSONAL_ACCESS_TOKEN: ${{ secrets.CDRCOMMUNITY_GITHUB_TOKEN }}
58+
PERSONAL_ACCESS_TOKEN: ${{ secrets.CDRCI2_GITHUB_TOKEN }}
5759
with:
5860
remote-organization-name: "coder"
5961
remote-repository-name: "cla"

coderd/database/dbauthz/dbauthz.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4138,6 +4138,17 @@ func (q *querier) UpdateWorkspacesDormantDeletingAtByTemplateID(ctx context.Cont
41384138
return q.db.UpdateWorkspacesDormantDeletingAtByTemplateID(ctx, arg)
41394139
}
41404140

4141+
func (q *querier) UpdateWorkspacesTTLByTemplateID(ctx context.Context, arg database.UpdateWorkspacesTTLByTemplateIDParams) error {
4142+
template, err := q.db.GetTemplateByID(ctx, arg.TemplateID)
4143+
if err != nil {
4144+
return xerrors.Errorf("get template by id: %w", err)
4145+
}
4146+
if err := q.authorizeContext(ctx, policy.ActionUpdate, template); err != nil {
4147+
return err
4148+
}
4149+
return q.db.UpdateWorkspacesTTLByTemplateID(ctx, arg)
4150+
}
4151+
41414152
func (q *querier) UpsertAnnouncementBanners(ctx context.Context, value string) error {
41424153
if err := q.authorizeContext(ctx, policy.ActionUpdate, rbac.ResourceDeploymentConfig); err != nil {
41434154
return err

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,12 @@ func (s *MethodTestSuite) TestTemplate() {
10171017
TemplateID: t1.ID,
10181018
}).Asserts(t1, policy.ActionUpdate)
10191019
}))
1020+
s.Run("UpdateWorkspacesTTLByTemplateID", s.Subtest(func(db database.Store, check *expects) {
1021+
t1 := dbgen.Template(s.T(), db, database.Template{})
1022+
check.Args(database.UpdateWorkspacesTTLByTemplateIDParams{
1023+
TemplateID: t1.ID,
1024+
}).Asserts(t1, policy.ActionUpdate)
1025+
}))
10201026
s.Run("UpdateTemplateActiveVersionByID", s.Subtest(func(db database.Store, check *expects) {
10211027
t1 := dbgen.Template(s.T(), db, database.Template{
10221028
ActiveVersionID: uuid.New(),

coderd/database/dbmem/dbmem.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10192,6 +10192,26 @@ func (q *FakeQuerier) UpdateWorkspacesDormantDeletingAtByTemplateID(_ context.Co
1019210192
return affectedRows, nil
1019310193
}
1019410194

10195+
func (q *FakeQuerier) UpdateWorkspacesTTLByTemplateID(_ context.Context, arg database.UpdateWorkspacesTTLByTemplateIDParams) error {
10196+
err := validateDatabaseType(arg)
10197+
if err != nil {
10198+
return err
10199+
}
10200+
10201+
q.mutex.Lock()
10202+
defer q.mutex.Unlock()
10203+
10204+
for i, ws := range q.workspaces {
10205+
if ws.TemplateID != arg.TemplateID {
10206+
continue
10207+
}
10208+
10209+
q.workspaces[i].Ttl = arg.Ttl
10210+
}
10211+
10212+
return nil
10213+
}
10214+
1019510215
func (q *FakeQuerier) UpsertAnnouncementBanners(_ context.Context, data string) error {
1019610216
q.mutex.RLock()
1019710217
defer q.mutex.RUnlock()

coderd/database/dbmetrics/querymetrics.go

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

coderd/database/dbmock/dbmock.go

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

coderd/database/querier.go

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

coderd/database/queries.sql.go

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

coderd/database/queries/workspaces.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,14 @@ SET
501501
WHERE
502502
id = $1;
503503

504+
-- name: UpdateWorkspacesTTLByTemplateID :exec
505+
UPDATE
506+
workspaces
507+
SET
508+
ttl = $2
509+
WHERE
510+
template_id = $1;
511+
504512
-- name: UpdateWorkspaceLastUsedAt :exec
505513
UPDATE
506514
workspaces

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy