Skip to content

Commit b0cec42

Browse files
committed
Merge branch 'main' into pnpm-fixup
2 parents 836a530 + 238e995 commit b0cec42

File tree

199 files changed

+27918
-20859
lines changed

Some content is hidden

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

199 files changed

+27918
-20859
lines changed

.github/actions/setup-node/action.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ runs:
1313
- name: Install pnpm
1414
uses: pnpm/action-setup@v3
1515
with:
16-
version: 9
16+
version: 9.6
1717
- name: Setup Node
18-
uses: actions/setup-node@v4.0.1
18+
uses: actions/setup-node@v4.0.3
1919
with:
20-
node-version: 18.19.0
20+
node-version: 20.16.0
2121
# See https://github.com/actions/setup-node#caching-global-packages-data
2222
cache: "pnpm"
2323
cache-dependency-path: ${{ inputs.directory }}/pnpm-lock.yaml

.github/dependabot.yaml

+8-15
Original file line numberDiff line numberDiff line change
@@ -86,37 +86,30 @@ updates:
8686
- "@mui*"
8787
react:
8888
patterns:
89-
- "react*"
90-
- "@types/react*"
89+
- "react"
90+
- "react-dom"
91+
- "@types/react"
92+
- "@types/react-dom"
9193
emotion:
9294
patterns:
9395
- "@emotion*"
96+
exclude-patterns:
97+
- "jest-runner-eslint"
9498
eslint:
9599
patterns:
96100
- "eslint*"
97101
- "@typescript-eslint*"
98102
jest:
99103
patterns:
100-
- "jest*"
104+
- "jest"
101105
- "@types/jest"
102106
vite:
103107
patterns:
104108
- "vite*"
105109
- "@vitejs/plugin-react"
106110
ignore:
107-
# Ignore patch updates for all dependencies
111+
# Ignore major version updates to avoid breaking changes
108112
- dependency-name: "*"
109-
update-types:
110-
- version-update:semver-patch
111-
# Ignore major updates to Node.js types, because they need to
112-
# correspond to the Node.js engine version
113-
- dependency-name: "@types/node"
114113
update-types:
115114
- version-update:semver-major
116-
# Ignore @storybook updates, run `pnpm dlx storybook@latest upgrade` to upgrade manually
117-
- dependency-name: "*storybook*" # matches @storybook/* and storybook*
118-
update-types:
119-
- version-update:semver-major
120-
- version-update:semver-minor
121-
- version-update:semver-patch
122115
open-pull-requests-limit: 15

.github/workflows/ci.yaml

+1-43
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ jobs:
184184
185185
# Check for any typos
186186
- name: Check for typos
187-
uses: crate-ci/typos@v1.23.5
187+
uses: crate-ci/typos@v1.23.6
188188
with:
189189
config: .github/workflows/typos.toml
190190

@@ -709,7 +709,6 @@ jobs:
709709
- test-e2e
710710
- offlinedocs
711711
- sqlc-vet
712-
- dependency-license-review
713712
# Allow this job to run even if the needed jobs fail, are skipped or
714713
# cancelled.
715714
if: always()
@@ -726,7 +725,6 @@ jobs:
726725
echo "- test-js: ${{ needs.test-js.result }}"
727726
echo "- test-e2e: ${{ needs.test-e2e.result }}"
728727
echo "- offlinedocs: ${{ needs.offlinedocs.result }}"
729-
echo "- dependency-license-review: ${{ needs.dependency-license-review.result }}"
730728
echo
731729
732730
# We allow skipped jobs to pass, but not failed or cancelled jobs.
@@ -968,43 +966,3 @@ jobs:
968966
- name: Setup and run sqlc vet
969967
run: |
970968
make sqlc-vet
971-
972-
# dependency-license-review checks that no license-incompatible dependencies have been introduced.
973-
# This action is not intended to do a vulnerability check since that is handled by a separate action.
974-
dependency-license-review:
975-
runs-on: ubuntu-latest
976-
if: github.ref != 'refs/heads/main' && github.actor != 'dependabot[bot]'
977-
steps:
978-
- name: "Checkout Repository"
979-
uses: actions/checkout@v4
980-
- name: "Dependency Review"
981-
id: review
982-
uses: actions/dependency-review-action@v4.3.2
983-
with:
984-
allow-licenses: Apache-2.0, 0BSD, BSD-2-Clause, BSD-3-Clause, CC0-1.0, ISC, MIT, MIT-0, MPL-2.0, OFL-1.1, BSD-3-Clause-Clear
985-
allow-dependencies-licenses: "pkg:golang/github.com/coder/wgtunnel@0.1.13-0.20240522110300-ade90dfb2da0, pkg:npm/pako@1.0.11, pkg:npm/caniuse-lite@1.0.30001639, pkg:githubactions/alwaysmeticulous/report-diffs-action/cloud-compute"
986-
license-check: true
987-
vulnerability-check: false
988-
- name: "Report"
989-
# make sure this step runs even if the previous failed
990-
if: always()
991-
shell: bash
992-
env:
993-
VULNERABLE_CHANGES: ${{ steps.review.outputs.invalid-license-changes }}
994-
run: |
995-
fields=( "unlicensed" "unresolved" "forbidden" )
996-
997-
# This is unfortunate that we have to do this but the action does not support failing on
998-
# an unknown license. The unknown dependency could easily have a GPL license which
999-
# would be problematic for us.
1000-
# Track https://github.com/actions/dependency-review-action/issues/672 for when
1001-
# we can remove this brittle workaround.
1002-
for field in "${fields[@]}"; do
1003-
# Use jq to check if the array is not empty
1004-
if [[ $(echo "$VULNERABLE_CHANGES" | jq ".${field} | length") -ne 0 ]]; then
1005-
echo "Invalid or unknown licenses detected, contact @sreya to ensure your added dependency falls under one of our allowed licenses."
1006-
echo "$VULNERABLE_CHANGES" | jq
1007-
exit 1
1008-
fi
1009-
done
1010-
echo "No incompatible licenses detected"

agent/agent.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,12 @@ func (a *agent) reportMetadata(ctx context.Context, conn drpc.Conn) error {
588588
updatedMetadata[mr.key] = mr.result
589589
continue
590590
case err := <-reportError:
591-
a.logger.Debug(ctx, "batch update metadata complete", slog.Error(err))
591+
logMsg := "batch update metadata complete"
592592
if err != nil {
593+
a.logger.Debug(ctx, logMsg, slog.Error(err))
593594
return xerrors.Errorf("failed to report metadata: %w", err)
594595
}
596+
a.logger.Debug(ctx, logMsg)
595597
reportInFlight = false
596598
case <-report:
597599
if len(updatedMetadata) == 0 {

cli/notifications_test.go

+13-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ import (
1616
"github.com/coder/coder/v2/testutil"
1717
)
1818

19+
func createOpts(t *testing.T) *coderdtest.Options {
20+
t.Helper()
21+
22+
dt := coderdtest.DeploymentValues(t)
23+
dt.Experiments = []string{string(codersdk.ExperimentNotifications)}
24+
return &coderdtest.Options{
25+
DeploymentValues: dt,
26+
}
27+
}
28+
1929
func TestNotifications(t *testing.T) {
2030
t.Parallel()
2131

@@ -42,7 +52,7 @@ func TestNotifications(t *testing.T) {
4252
t.Parallel()
4353

4454
// given
45-
ownerClient, db := coderdtest.NewWithDatabase(t, nil)
55+
ownerClient, db := coderdtest.NewWithDatabase(t, createOpts(t))
4656
_ = coderdtest.CreateFirstUser(t, ownerClient)
4757

4858
// when
@@ -72,7 +82,7 @@ func TestPauseNotifications_RegularUser(t *testing.T) {
7282
t.Parallel()
7383

7484
// given
75-
ownerClient, db := coderdtest.NewWithDatabase(t, nil)
85+
ownerClient, db := coderdtest.NewWithDatabase(t, createOpts(t))
7686
owner := coderdtest.CreateFirstUser(t, ownerClient)
7787
anotherClient, _ := coderdtest.CreateAnotherUser(t, ownerClient, owner.OrganizationID)
7888

@@ -87,7 +97,7 @@ func TestPauseNotifications_RegularUser(t *testing.T) {
8797
require.Error(t, err)
8898
require.ErrorAsf(t, err, &sdkError, "error should be of type *codersdk.Error")
8999
assert.Equal(t, http.StatusForbidden, sdkError.StatusCode())
90-
assert.Contains(t, sdkError.Message, "Insufficient permissions to update notifications settings.")
100+
assert.Contains(t, sdkError.Message, "Forbidden.")
91101

92102
// then
93103
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort)

cli/organizationmembers_test.go

-46
Original file line numberDiff line numberDiff line change
@@ -34,49 +34,3 @@ func TestListOrganizationMembers(t *testing.T) {
3434
require.Contains(t, buf.String(), owner.UserID.String())
3535
})
3636
}
37-
38-
func TestRemoveOrganizationMembers(t *testing.T) {
39-
t.Parallel()
40-
41-
t.Run("OK", func(t *testing.T) {
42-
t.Parallel()
43-
44-
ownerClient := coderdtest.New(t, &coderdtest.Options{})
45-
owner := coderdtest.CreateFirstUser(t, ownerClient)
46-
orgAdminClient, _ := coderdtest.CreateAnotherUser(t, ownerClient, owner.OrganizationID, rbac.ScopedRoleOrgAdmin(owner.OrganizationID))
47-
_, user := coderdtest.CreateAnotherUser(t, ownerClient, owner.OrganizationID)
48-
49-
ctx := testutil.Context(t, testutil.WaitMedium)
50-
51-
inv, root := clitest.New(t, "organization", "members", "remove", "-O", owner.OrganizationID.String(), user.Username)
52-
clitest.SetupConfig(t, orgAdminClient, root)
53-
54-
buf := new(bytes.Buffer)
55-
inv.Stdout = buf
56-
err := inv.WithContext(ctx).Run()
57-
require.NoError(t, err)
58-
59-
members, err := orgAdminClient.OrganizationMembers(ctx, owner.OrganizationID)
60-
require.NoError(t, err)
61-
62-
require.Len(t, members, 2)
63-
})
64-
65-
t.Run("UserNotExists", func(t *testing.T) {
66-
t.Parallel()
67-
68-
ownerClient := coderdtest.New(t, &coderdtest.Options{})
69-
owner := coderdtest.CreateFirstUser(t, ownerClient)
70-
orgAdminClient, _ := coderdtest.CreateAnotherUser(t, ownerClient, owner.OrganizationID, rbac.ScopedRoleOrgAdmin(owner.OrganizationID))
71-
72-
ctx := testutil.Context(t, testutil.WaitMedium)
73-
74-
inv, root := clitest.New(t, "organization", "members", "remove", "-O", owner.OrganizationID.String(), "random_name")
75-
clitest.SetupConfig(t, orgAdminClient, root)
76-
77-
buf := new(bytes.Buffer)
78-
inv.Stdout = buf
79-
err := inv.WithContext(ctx).Run()
80-
require.ErrorContains(t, err, "must be an existing uuid or username")
81-
})
82-
}

cli/organizationroles.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func (r *RootCmd) editOrganizationRole(orgContext *OrganizationContext) *serpent
203203
// Do not actually post
204204
updated = customRole
205205
} else {
206-
updated, err = client.PatchOrganizationRole(ctx, org.ID, customRole)
206+
updated, err = client.PatchOrganizationRole(ctx, customRole)
207207
if err != nil {
208208
return xerrors.Errorf("patch role: %w", err)
209209
}

cli/testdata/coder_server_--help.golden

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ OPTIONS:
2222
--cache-dir string, $CODER_CACHE_DIRECTORY (default: [cache dir])
2323
The directory to cache temporary files. If unspecified and
2424
$CACHE_DIRECTORY is set, it will be used for compatibility with
25-
systemd.
25+
systemd. This directory is NOT safe to be configured as a shared
26+
directory across coderd/provisionerd replicas.
2627

2728
--disable-owner-workspace-access bool, $CODER_DISABLE_OWNER_WORKSPACE_ACCESS
2829
Remove the permission for the 'owner' role to have workspace execution

cli/testdata/server-config.yaml.golden

+2-1
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,8 @@ updateCheck: false
414414
# (default: <unset>, type: bool)
415415
enableSwagger: false
416416
# The directory to cache temporary files. If unspecified and $CACHE_DIRECTORY is
417-
# set, it will be used for compatibility with systemd.
417+
# set, it will be used for compatibility with systemd. This directory is NOT safe
418+
# to be configured as a shared directory across coderd/provisionerd replicas.
418419
# (default: [cache dir], type: string)
419420
cacheDir: [cache dir]
420421
# Controls whether data will be stored in an in-memory database.

0 commit comments

Comments
 (0)