Skip to content

Commit 35c1c11

Browse files
authored
Merge branch 'main' into execscripts
2 parents a4a0270 + 84999cb commit 35c1c11

34 files changed

+1939
-525
lines changed

.github/workflows/pr-deploy.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ permissions:
3737
packages: write
3838
pull-requests: write # needed for commenting on PRs
3939

40-
concurrency:
41-
group: ${{ github.workflow }}-${{ github.ref }}
42-
cancel-in-progress: true
43-
4440
jobs:
4541
check_pr:
4642
runs-on: ubuntu-latest
@@ -73,7 +69,7 @@ jobs:
7369
CODER_BASE_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}
7470
CODER_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}
7571
NEW: ${{ steps.check_deployment.outputs.NEW }}
76-
BUILD: ${{ steps.build_conditionals.outputs.first_or_force_build || steps.build_conditionals.outputs.automatic_rebuild }}
72+
BUILD: ${{ steps.build_conditionals.outputs.first_or_force_build == 'true' || steps.build_conditionals.outputs.automatic_rebuild == 'true' }}
7773

7874
runs-on: "ubuntu-latest"
7975
steps:
@@ -166,7 +162,7 @@ jobs:
166162
echo "automatic_rebuild=${{ steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" >> $GITHUB_OUTPUT
167163
168164
comment-pr:
169-
needs: [check_pr, get_info]
165+
needs: get_info
170166
if: needs.get_info.outputs.BUILD == 'true' || github.event.inputs.deploy == 'true'
171167
runs-on: "ubuntu-latest"
172168
steps:
@@ -198,6 +194,10 @@ jobs:
198194
# Run build job only if there are changes in the files that we care about or if the workflow is manually triggered with --build flag
199195
if: needs.get_info.outputs.BUILD == 'true'
200196
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
197+
# This concurrency only cancels build jobs if a new build is triggred. It will avoid cancelling the current deployemtn in case of docs chnages.
198+
concurrency:
199+
group: build-${{ github.workflow }}-${{ github.ref }}-${{ needs.get_info.outputs.BUILD }}
200+
cancel-in-progress: true
201201
env:
202202
DOCKER_CLI_EXPERIMENTAL: "enabled"
203203
CODER_IMAGE_TAG: ${{ needs.get_info.outputs.CODER_IMAGE_TAG }}

coderd/database/dbauthz/dbauthz.go

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,13 @@ func (q *querier) DeleteAPIKeysByUserID(ctx context.Context, userID uuid.UUID) e
694694
return q.db.DeleteAPIKeysByUserID(ctx, userID)
695695
}
696696

697+
func (q *querier) DeleteAllTailnetClientSubscriptions(ctx context.Context, arg database.DeleteAllTailnetClientSubscriptionsParams) error {
698+
if err := q.authorizeContext(ctx, rbac.ActionDelete, rbac.ResourceTailnetCoordinator); err != nil {
699+
return err
700+
}
701+
return q.db.DeleteAllTailnetClientSubscriptions(ctx, arg)
702+
}
703+
697704
func (q *querier) DeleteApplicationConnectAPIKeysByUserID(ctx context.Context, userID uuid.UUID) error {
698705
// TODO: This is not 100% correct because it omits apikey IDs.
699706
err := q.authorizeContext(ctx, rbac.ActionDelete,
@@ -783,6 +790,13 @@ func (q *querier) DeleteTailnetClient(ctx context.Context, arg database.DeleteTa
783790
return q.db.DeleteTailnetClient(ctx, arg)
784791
}
785792

793+
func (q *querier) DeleteTailnetClientSubscription(ctx context.Context, arg database.DeleteTailnetClientSubscriptionParams) error {
794+
if err := q.authorizeContext(ctx, rbac.ActionDelete, rbac.ResourceTailnetCoordinator); err != nil {
795+
return err
796+
}
797+
return q.db.DeleteTailnetClientSubscription(ctx, arg)
798+
}
799+
786800
func (q *querier) GetAPIKeyByID(ctx context.Context, id string) (database.APIKey, error) {
787801
return fetch(q.log, q.auth, q.db.GetAPIKeyByID)(ctx, id)
788802
}
@@ -825,9 +839,9 @@ func (q *querier) GetAllTailnetAgents(ctx context.Context) ([]database.TailnetAg
825839
return q.db.GetAllTailnetAgents(ctx)
826840
}
827841

828-
func (q *querier) GetAllTailnetClients(ctx context.Context) ([]database.TailnetClient, error) {
842+
func (q *querier) GetAllTailnetClients(ctx context.Context) ([]database.GetAllTailnetClientsRow, error) {
829843
if err := q.authorizeContext(ctx, rbac.ActionRead, rbac.ResourceTailnetCoordinator); err != nil {
830-
return []database.TailnetClient{}, err
844+
return []database.GetAllTailnetClientsRow{}, err
831845
}
832846
return q.db.GetAllTailnetClients(ctx)
833847
}
@@ -2817,6 +2831,13 @@ func (q *querier) UpsertTailnetClient(ctx context.Context, arg database.UpsertTa
28172831
return q.db.UpsertTailnetClient(ctx, arg)
28182832
}
28192833

2834+
func (q *querier) UpsertTailnetClientSubscription(ctx context.Context, arg database.UpsertTailnetClientSubscriptionParams) error {
2835+
if err := q.authorizeContext(ctx, rbac.ActionUpdate, rbac.ResourceTailnetCoordinator); err != nil {
2836+
return err
2837+
}
2838+
return q.db.UpsertTailnetClientSubscription(ctx, arg)
2839+
}
2840+
28202841
func (q *querier) UpsertTailnetCoordinator(ctx context.Context, id uuid.UUID) (database.TailnetCoordinator, error) {
28212842
if err := q.authorizeContext(ctx, rbac.ActionUpdate, rbac.ResourceTailnetCoordinator); err != nil {
28222843
return database.TailnetCoordinator{}, err

coderd/database/dbfake/dbfake.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,15 @@ func (q *FakeQuerier) DeleteAPIKeysByUserID(_ context.Context, userID uuid.UUID)
856856
return nil
857857
}
858858

859+
func (*FakeQuerier) DeleteAllTailnetClientSubscriptions(_ context.Context, arg database.DeleteAllTailnetClientSubscriptionsParams) error {
860+
err := validateDatabaseType(arg)
861+
if err != nil {
862+
return err
863+
}
864+
865+
return ErrUnimplemented
866+
}
867+
859868
func (q *FakeQuerier) DeleteApplicationConnectAPIKeysByUserID(_ context.Context, userID uuid.UUID) error {
860869
q.mutex.Lock()
861870
defer q.mutex.Unlock()
@@ -989,6 +998,10 @@ func (*FakeQuerier) DeleteTailnetClient(context.Context, database.DeleteTailnetC
989998
return database.DeleteTailnetClientRow{}, ErrUnimplemented
990999
}
9911000

1001+
func (*FakeQuerier) DeleteTailnetClientSubscription(context.Context, database.DeleteTailnetClientSubscriptionParams) error {
1002+
return ErrUnimplemented
1003+
}
1004+
9921005
func (q *FakeQuerier) GetAPIKeyByID(_ context.Context, id string) (database.APIKey, error) {
9931006
q.mutex.RLock()
9941007
defer q.mutex.RUnlock()
@@ -1104,7 +1117,7 @@ func (*FakeQuerier) GetAllTailnetAgents(_ context.Context) ([]database.TailnetAg
11041117
return nil, ErrUnimplemented
11051118
}
11061119

1107-
func (*FakeQuerier) GetAllTailnetClients(_ context.Context) ([]database.TailnetClient, error) {
1120+
func (*FakeQuerier) GetAllTailnetClients(_ context.Context) ([]database.GetAllTailnetClientsRow, error) {
11081121
return nil, ErrUnimplemented
11091122
}
11101123

@@ -6193,6 +6206,10 @@ func (*FakeQuerier) UpsertTailnetClient(context.Context, database.UpsertTailnetC
61936206
return database.TailnetClient{}, ErrUnimplemented
61946207
}
61956208

6209+
func (*FakeQuerier) UpsertTailnetClientSubscription(context.Context, database.UpsertTailnetClientSubscriptionParams) error {
6210+
return ErrUnimplemented
6211+
}
6212+
61966213
func (*FakeQuerier) UpsertTailnetCoordinator(context.Context, uuid.UUID) (database.TailnetCoordinator, error) {
61976214
return database.TailnetCoordinator{}, ErrUnimplemented
61986215
}

coderd/database/dbmetrics/dbmetrics.go

Lines changed: 22 additions & 1 deletion
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: 44 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dump.sql

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

coderd/database/foreign_key_constraint.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.

0 commit comments

Comments
 (0)