Skip to content

Commit 9e749bc

Browse files
committed
Merge branch 'main' of https://github.com/coder/coder into cj/howto-add-rbac-frobulation
Signed-off-by: Danny Kopping <danny@coder.com>
2 parents 16d0869 + d0f36dc commit 9e749bc

File tree

1,353 files changed

+142536
-129874
lines changed

Some content is hidden

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

1,353 files changed

+142536
-129874
lines changed

.devcontainer/devcontainer.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"name": "Development environments on your infrastructure",
3-
"image": "codercom/oss-dogfood:latest",
2+
"name": "Development environments on your infrastructure",
3+
"image": "codercom/oss-dogfood:latest",
44

5-
"features": {
6-
// See all possible options here https://github.com/devcontainers/features/tree/main/src/docker-in-docker
7-
"ghcr.io/devcontainers/features/docker-in-docker:2": {
8-
"moby": "false"
9-
}
10-
},
11-
// SYS_PTRACE to enable go debugging
12-
"runArgs": ["--cap-add=SYS_PTRACE"]
5+
"features": {
6+
// See all possible options here https://github.com/devcontainers/features/tree/main/src/docker-in-docker
7+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
8+
"moby": "false"
9+
}
10+
},
11+
// SYS_PTRACE to enable go debugging
12+
"runArgs": ["--cap-add=SYS_PTRACE"]
1313
}

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trim_trailing_whitespace = true
77
insert_final_newline = true
88
indent_style = tab
99

10-
[*.{md,json,yaml,yml,tf,tfvars,nix}]
10+
[*.{md,yaml,yml,tf,tfvars,nix}]
1111
indent_style = space
1212
indent_size = 2
1313

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33

44
# chore: format code with semicolons when using prettier (#9555)
55
988c9af0153561397686c119da9d1336d2433fdd
6+
# chore: use tabs for prettier and biome (#14283)
7+
95a7c0c4f087744a22c2e88dd3c5d30024d5fb02

.gitattributes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Generated files
22
coderd/apidoc/docs.go linguist-generated=true
3-
docs/api/*.md linguist-generated=true
4-
docs/cli/*.md linguist-generated=true
3+
docs/reference/api/*.md linguist-generated=true
4+
docs/reference/cli/*.md linguist-generated=true
55
coderd/apidoc/swagger.json linguist-generated=true
66
coderd/database/dump.sql linguist-generated=true
77
peerbroker/proto/*.go linguist-generated=true

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

Lines changed: 3 additions & 3 deletions
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: 8
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

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,37 +86,26 @@ 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*"
94-
eslint:
95-
patterns:
96-
- "eslint*"
97-
- "@typescript-eslint*"
96+
exclude-patterns:
97+
- "jest-runner-eslint"
9898
jest:
9999
patterns:
100-
- "jest*"
100+
- "jest"
101101
- "@types/jest"
102102
vite:
103103
patterns:
104104
- "vite*"
105105
- "@vitejs/plugin-react"
106106
ignore:
107-
# Ignore patch updates for all dependencies
107+
# Ignore major version updates to avoid breaking changes
108108
- 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"
114109
update-types:
115110
- 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
122111
open-pull-requests-limit: 15

.github/workflows/ci.yaml

Lines changed: 14 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -121,25 +121,34 @@ jobs:
121121
needs: changes
122122
if: needs.changes.outputs.gomod == 'true'
123123
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
124-
permissions:
125-
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository.
126-
contents: write
127124
steps:
128125
- name: Checkout
129126
uses: actions/checkout@v4
130127
with:
131128
fetch-depth: 1
129+
# See: https://github.com/stefanzweifel/git-auto-commit-action?tab=readme-ov-file#commits-made-by-this-action-do-not-trigger-new-workflow-runs
130+
token: ${{ secrets.CDRCI_GITHUB_TOKEN }}
132131

133132
- name: Setup Go
134133
uses: ./.github/actions/setup-go
135134

136135
- name: Update Nix Flake SRI Hash
137136
run: ./scripts/update-flake.sh
138137

138+
# auto update flake for dependabot
139139
- uses: stefanzweifel/git-auto-commit-action@v5
140+
if: github.actor == 'dependabot[bot]'
140141
with:
141142
# Allows dependabot to still rebase!
142143
commit_message: "[dependabot skip] Update Nix Flake SRI Hash"
144+
commit_user_name: "dependabot[bot]"
145+
commit_user_email: "49699333+dependabot[bot]@users.noreply.github.com>"
146+
commit_author: "dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>"
147+
148+
# require everyone else to update it themselves
149+
- name: Ensure No Changes
150+
if: github.actor != 'dependabot[bot]'
151+
run: git diff --exit-code
143152

144153
lint:
145154
needs: changes
@@ -159,7 +168,7 @@ jobs:
159168

160169
- name: Get golangci-lint cache dir
161170
run: |
162-
linter_ver=$(egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/Dockerfile | cut -d '=' -f 2)
171+
linter_ver=$(egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/contents/Dockerfile | cut -d '=' -f 2)
163172
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$linter_ver
164173
dir=$(golangci-lint cache status | awk '/Dir/ { print $2 }')
165174
echo "LINT_CACHE_DIR=$dir" >> $GITHUB_ENV
@@ -175,7 +184,7 @@ jobs:
175184
176185
# Check for any typos
177186
- name: Check for typos
178-
uses: crate-ci/typos@v1.23.5
187+
uses: crate-ci/typos@v1.23.6
179188
with:
180189
config: .github/workflows/typos.toml
181190

@@ -700,7 +709,6 @@ jobs:
700709
- test-e2e
701710
- offlinedocs
702711
- sqlc-vet
703-
- dependency-license-review
704712
# Allow this job to run even if the needed jobs fail, are skipped or
705713
# cancelled.
706714
if: always()
@@ -717,7 +725,6 @@ jobs:
717725
echo "- test-js: ${{ needs.test-js.result }}"
718726
echo "- test-e2e: ${{ needs.test-e2e.result }}"
719727
echo "- offlinedocs: ${{ needs.offlinedocs.result }}"
720-
echo "- dependency-license-review: ${{ needs.dependency-license-review.result }}"
721728
echo
722729
723730
# We allow skipped jobs to pass, but not failed or cancelled jobs.
@@ -959,63 +966,3 @@ jobs:
959966
- name: Setup and run sqlc vet
960967
run: |
961968
make sqlc-vet
962-
963-
# dependency-license-review checks that no license-incompatible dependencies have been introduced.
964-
# This action is not intended to do a vulnerability check since that is handled by a separate action.
965-
dependency-license-review:
966-
runs-on: ubuntu-latest
967-
if: github.ref != 'refs/heads/main' && github.actor != 'dependabot[bot]'
968-
steps:
969-
- name: "Checkout Repository"
970-
uses: actions/checkout@v4
971-
- name: "Dependency Review"
972-
id: review
973-
uses: actions/dependency-review-action@v4.3.2
974-
with:
975-
allow-licenses: Apache-2.0, 0BSD, BSD-2-Clause, BSD-3-Clause, CC0-1.0, ISC, MIT, MIT-0, MPL-2.0
976-
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"
977-
license-check: true
978-
vulnerability-check: false
979-
- name: "Report"
980-
# make sure this step runs even if the previous failed
981-
if: always()
982-
shell: bash
983-
env:
984-
VULNERABLE_CHANGES: ${{ steps.review.outputs.invalid-license-changes }}
985-
run: |
986-
fields=( "unlicensed" "unresolved" "forbidden" )
987-
988-
# This is unfortunate that we have to do this but the action does not support failing on
989-
# an unknown license. The unknown dependency could easily have a GPL license which
990-
# would be problematic for us.
991-
# Track https://github.com/actions/dependency-review-action/issues/672 for when
992-
# we can remove this brittle workaround.
993-
for field in "${fields[@]}"; do
994-
# Use jq to check if the array is not empty
995-
if [[ $(echo "$VULNERABLE_CHANGES" | jq ".${field} | length") -ne 0 ]]; then
996-
echo "Invalid or unknown licenses detected, contact @sreya to ensure your added dependency falls under one of our allowed licenses."
997-
echo "$VULNERABLE_CHANGES" | jq
998-
exit 1
999-
fi
1000-
done
1001-
echo "No incompatible licenses detected"
1002-
meticulous:
1003-
runs-on: ubuntu-latest
1004-
steps:
1005-
- name: "Checkout Repository"
1006-
uses: actions/checkout@v4
1007-
- name: Setup Node
1008-
uses: ./.github/actions/setup-node
1009-
- name: Build
1010-
working-directory: ./site
1011-
run: pnpm build
1012-
- name: Serve
1013-
working-directory: ./site
1014-
run: |
1015-
pnpm vite preview &
1016-
sleep 5
1017-
- name: Run Meticulous tests
1018-
uses: alwaysmeticulous/report-diffs-action/cloud-compute@v1
1019-
with:
1020-
api-token: ${{ secrets.METICULOUS_API_TOKEN }}
1021-
app-url: "http://127.0.0.1:4173/"

.github/workflows/dogfood.yaml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ on:
1919

2020
jobs:
2121
build_image:
22+
if: github.actor != 'dependabot[bot]' # Skip Dependabot PRs
2223
runs-on: ubuntu-latest
2324
steps:
2425
- name: Checkout
@@ -55,7 +56,7 @@ jobs:
5556
project: b4q6ltmpzh
5657
token: ${{ secrets.DEPOT_TOKEN }}
5758
buildx-fallback: true
58-
context: "{{defaultContext}}:dogfood"
59+
context: "{{defaultContext}}:dogfood/contents"
5960
pull: true
6061
save: true
6162
push: ${{ github.ref == 'refs/heads/main' }}
@@ -68,7 +69,7 @@ jobs:
6869
token: ${{ secrets.DEPOT_TOKEN }}
6970
buildx-fallback: true
7071
context: "."
71-
file: "dogfood/Dockerfile.nix"
72+
file: "dogfood/contents/Dockerfile.nix"
7273
pull: true
7374
save: true
7475
push: ${{ github.ref == 'refs/heads/main' }}
@@ -89,6 +90,9 @@ jobs:
8990
cd dogfood
9091
terraform init -upgrade
9192
terraform validate
93+
cd contents
94+
terraform init -upgrade
95+
terraform validate
9296
9397
- name: Get short commit SHA
9498
if: github.ref == 'refs/heads/main'
@@ -100,22 +104,17 @@ jobs:
100104
id: message
101105
run: echo "pr_title=$(git log --format=%s -n 1 ${{ github.sha }})" >> $GITHUB_OUTPUT
102106

103-
- name: "Get latest Coder binary from the server"
104-
if: github.ref == 'refs/heads/main'
105-
run: |
106-
curl -fsSL "https://dev.coder.com/bin/coder-linux-amd64" -o "./coder"
107-
chmod +x "./coder"
108-
109107
- name: "Push template"
110108
if: github.ref == 'refs/heads/main'
111109
run: |
112-
./coder templates push $CODER_TEMPLATE_NAME --directory $CODER_TEMPLATE_DIR --yes --name=$CODER_TEMPLATE_VERSION --message="$CODER_TEMPLATE_MESSAGE"
110+
cd dogfood
111+
terraform apply -auto-approve
113112
env:
114113
# Consumed by Coder CLI
115114
CODER_URL: https://dev.coder.com
116115
CODER_SESSION_TOKEN: ${{ secrets.CODER_SESSION_TOKEN }}
117116
# Template source & details
118-
CODER_TEMPLATE_NAME: ${{ secrets.CODER_TEMPLATE_NAME }}
119-
CODER_TEMPLATE_VERSION: ${{ steps.vars.outputs.sha_short }}
120-
CODER_TEMPLATE_DIR: ./dogfood
121-
CODER_TEMPLATE_MESSAGE: ${{ steps.message.outputs.pr_title }}
117+
TF_VAR_CODER_TEMPLATE_NAME: ${{ secrets.CODER_TEMPLATE_NAME }}
118+
TF_VAR_CODER_TEMPLATE_VERSION: ${{ steps.vars.outputs.sha_short }}
119+
TF_VAR_CODER_TEMPLATE_DIR: ./contents
120+
TF_VAR_CODER_TEMPLATE_MESSAGE: ${{ steps.message.outputs.pr_title }}

.github/workflows/meticulous.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Workflow for serving the webapp locally & running Meticulous tests against it.
2+
3+
name: Meticulous
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
paths:
10+
- "site/**"
11+
pull_request:
12+
paths:
13+
- "site/**"
14+
# Meticulous needs the workflow to be triggered on workflow_dispatch events,
15+
# so that Meticulous can run the workflow on the base commit to compare
16+
# against if an existing workflow hasn't run.
17+
workflow_dispatch:
18+
19+
permissions:
20+
actions: write
21+
contents: read
22+
issues: write
23+
pull-requests: write
24+
statuses: read
25+
26+
jobs:
27+
meticulous:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: "Checkout Repository"
31+
uses: actions/checkout@v4
32+
- name: Setup Node
33+
uses: ./.github/actions/setup-node
34+
- name: Build
35+
working-directory: ./site
36+
run: pnpm build
37+
- name: Serve
38+
working-directory: ./site
39+
run: |
40+
pnpm vite preview &
41+
sleep 5
42+
- name: Run Meticulous tests
43+
uses: alwaysmeticulous/report-diffs-action/cloud-compute@v1
44+
with:
45+
api-token: ${{ secrets.METICULOUS_API_TOKEN }}
46+
app-url: "http://127.0.0.1:4173/"

0 commit comments

Comments
 (0)