Skip to content

Commit 31b4775

Browse files
authored
Merge branch 'coder:main' into patch-3
2 parents 1c3881a + a0e096b commit 31b4775

File tree

497 files changed

+30084
-13854
lines changed

Some content is hidden

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

497 files changed

+30084
-13854
lines changed

.github/pull_request_template.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
# Check for any typos!
4343
- name: Check for typos
44-
uses: crate-ci/typos@v1.13.9
44+
uses: crate-ci/typos@v1.13.14
4545
with:
4646
config: .github/workflows/typos.toml
4747
- name: Fix the typos
@@ -186,8 +186,9 @@ jobs:
186186

187187
- name: Install Protoc
188188
run: |
189-
# protoc must be in lockstep with our dogfood Dockerfile
190-
# or the version in the comments will differ.
189+
# protoc must be in lockstep with our dogfood Dockerfile or the
190+
# version in the comments will differ. This is also defined in
191+
# security.yaml
191192
set -x
192193
cd dogfood
193194
DOCKER_BUILDKIT=1 docker build . --target proto -t protoc
@@ -511,7 +512,7 @@ jobs:
511512
- name: Install node_modules
512513
run: ./scripts/yarn_install.sh
513514

514-
- run: yarn test:ci
515+
- run: yarn test:ci --max-workers ${{ steps.cpu-cores.outputs.count }}
515516
working-directory: site
516517

517518
- uses: codecov/codecov-action@v3

.github/workflows/contrib.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ concurrency: pr-${{ github.ref }}
1919

2020
jobs:
2121
# Dependabot is annoying, but this makes it a bit less so.
22-
auto-approve:
22+
auto-approve-dependabot:
2323
runs-on: ubuntu-latest
2424
if: github.event_name == 'pull_request_target'
2525
permissions:
@@ -33,7 +33,7 @@ jobs:
3333
steps:
3434
- name: cla
3535
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
36-
uses: contributor-assistant/github-action@v2.2.1
36+
uses: contributor-assistant/github-action@v2.3.0
3737
env:
3838
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3939
# the below token should have repo scope and must be manually added by you in the repository's secret

.github/workflows/docker-base.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,38 @@ jobs:
5353
project: wl5hnrrkns
5454
context: base-build-context
5555
file: scripts/Dockerfile.base
56+
platforms: linux/amd64,linux/arm64,linux/arm/v7
5657
pull: true
5758
no-cache: true
5859
push: true
5960
tags: |
6061
ghcr.io/coder/coder-base:latest
62+
63+
- name: Verify that images are pushed properly
64+
run: |
65+
# retry 10 times with a 5 second delay as the images may not be
66+
# available immediately
67+
for i in {1..10}; do
68+
rc=0
69+
raw_manifests=$(docker buildx imagetools inspect --raw ghcr.io/coder/coder-base:latest) || rc=$?
70+
if [[ "$rc" -eq 0 ]]; then
71+
break
72+
fi
73+
if [[ "$i" -eq 10 ]]; then
74+
echo "Failed to pull manifests after 10 retries"
75+
exit 1
76+
fi
77+
echo "Failed to pull manifests, retrying in 5 seconds"
78+
sleep 5
79+
done
80+
81+
manifests=$(
82+
echo "$raw_manifests" | \
83+
jq -r '.manifests[].platform | .os + "/" + .architecture + (if .variant then "/" + .variant else "" end)'
84+
)
85+
86+
# Verify all 3 platforms are present.
87+
set -euxo pipefail
88+
echo "$manifests" | grep -q linux/amd64
89+
echo "$manifests" | grep -q linux/arm64
90+
echo "$manifests" | grep -q linux/arm/v7

.github/workflows/pr-auto-assign.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Filtering pull requests is much easier when we can reliably guarantee
2+
# that the "Assignee" field is populated.
3+
name: PR Auto Assign
4+
5+
on:
6+
pull_request_target:
7+
types: [opened]
8+
9+
permissions:
10+
pull-requests: write
11+
12+
jobs:
13+
assign-author:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: toshimaru/auto-author-assign@v1.6.2

.github/workflows/release.yaml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,42 @@ jobs:
188188
project: wl5hnrrkns
189189
context: base-build-context
190190
file: scripts/Dockerfile.base
191+
platforms: linux/amd64,linux/arm64,linux/arm/v7
191192
pull: true
192193
no-cache: true
193194
push: true
194195
tags: |
195196
${{ steps.image-base-tag.outputs.tag }}
196197
198+
- name: Verify that images are pushed properly
199+
run: |
200+
# retry 10 times with a 5 second delay as the images may not be
201+
# available immediately
202+
for i in {1..10}; do
203+
rc=0
204+
raw_manifests=$(docker buildx imagetools inspect --raw "${{ steps.image-base-tag.outputs.tag }}") || rc=$?
205+
if [[ "$rc" -eq 0 ]]; then
206+
break
207+
fi
208+
if [[ "$i" -eq 10 ]]; then
209+
echo "Failed to pull manifests after 10 retries"
210+
exit 1
211+
fi
212+
echo "Failed to pull manifests, retrying in 5 seconds"
213+
sleep 5
214+
done
215+
216+
manifests=$(
217+
echo "$raw_manifests" | \
218+
jq -r '.manifests[].platform | .os + "/" + .architecture + (if .variant then "/" + .variant else "" end)'
219+
)
220+
221+
# Verify all 3 platforms are present.
222+
set -euxo pipefail
223+
echo "$manifests" | grep -q linux/amd64
224+
echo "$manifests" | grep -q linux/arm64
225+
echo "$manifests" | grep -q linux/arm/v7
226+
197227
- name: Build Linux Docker images
198228
run: |
199229
set -euxo pipefail
@@ -275,7 +305,7 @@ jobs:
275305
276306
- name: Upload artifacts to actions (if dry-run)
277307
if: ${{ inputs.dry_run }}
278-
uses: actions/upload-artifact@v2
308+
uses: actions/upload-artifact@v3
279309
with:
280310
name: release-artifacts
281311
path: |

.github/workflows/security.yaml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,11 @@ permissions:
66
security-events: write
77

88
on:
9-
push:
10-
branches: ["main"]
11-
12-
pull_request:
13-
branches: ["main"]
14-
159
workflow_dispatch:
1610

1711
schedule:
18-
# Run every week at 10:24 on Thursday.
19-
- cron: "24 10 * * 4"
12+
# Run every 6 hours Monday-Friday!
13+
- cron: "0 0,6,12,18 * * 1-5"
2014

2115
# Cancel in-progress runs for pull requests when developers push
2216
# additional changes
@@ -59,6 +53,17 @@ jobs:
5953
- name: Perform CodeQL Analysis
6054
uses: github/codeql-action/analyze@v2
6155

56+
- name: Send Slack notification on failure
57+
if: ${{ failure() }}
58+
run: |
59+
msg="❌ CodeQL Failed\n\nhttps://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
60+
curl \
61+
-qfsSL \
62+
-X POST \
63+
-H "Content-Type: application/json" \
64+
--data "{\"content\": \"$msg\"}" \
65+
"${{ secrets.SLACK_SECURITY_FAILURE_WEBHOOK_URL }}"
66+
6267
trivy:
6368
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
6469
steps:
@@ -94,6 +99,22 @@ jobs:
9499
95100
- name: Install yq
96101
run: go run github.com/mikefarah/yq/v4@v4.30.6
102+
- name: Install protoc-gen-go
103+
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
104+
- name: Install protoc-gen-go-drpc
105+
run: go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.26
106+
- name: Install Protoc
107+
run: |
108+
# protoc must be in lockstep with our dogfood Dockerfile or the
109+
# version in the comments will differ. This is also defined in
110+
# ci.yaml.
111+
set -x
112+
cd dogfood
113+
DOCKER_BUILDKIT=1 docker build . --target proto -t protoc
114+
protoc_path=/usr/local/bin/protoc
115+
docker run --rm --entrypoint cat protoc /tmp/bin/protoc > $protoc_path
116+
chmod +x $protoc_path
117+
protoc --version
97118
98119
- name: Build Coder linux amd64 Docker image
99120
id: build
@@ -116,7 +137,7 @@ jobs:
116137
echo "image=$(cat "$image_job")" >> $GITHUB_OUTPUT
117138
118139
- name: Run Trivy vulnerability scanner
119-
uses: aquasecurity/trivy-action@9ab158e8597f3b310480b9a69402b419bc03dbd5
140+
uses: aquasecurity/trivy-action@8bd2f9fbda2109502356ff8a6a89da55b1ead252
120141
with:
121142
image-ref: ${{ steps.build.outputs.image }}
122143
format: sarif
@@ -130,8 +151,19 @@ jobs:
130151
category: "Trivy"
131152

132153
- name: Upload Trivy scan results as an artifact
133-
uses: actions/upload-artifact@v2
154+
uses: actions/upload-artifact@v3
134155
with:
135156
name: trivy
136157
path: trivy-results.sarif
137158
retention-days: 7
159+
160+
- name: Send Slack notification on failure
161+
if: ${{ failure() }}
162+
run: |
163+
msg="❌ CodeQL Failed\n\nhttps://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
164+
curl \
165+
-qfsSL \
166+
-X POST \
167+
-H "Content-Type: application/json" \
168+
--data "{\"content\": \"$msg\"}" \
169+
"${{ secrets.SLACK_SECURITY_FAILURE_WEBHOOK_URL }}"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ site/test-results/*
2727
site/e2e/test-results/*
2828
site/e2e/states/*.json
2929
site/playwright-report/*
30+
site/.swc
3031

3132
# Make target for updating golden files.
3233
cli/testdata/.gen-golden
34+
helm/tests/testdata/.gen-golden
3335

3436
# Build
3537
/build/

.golangci.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ linters:
215215
- asciicheck
216216
- bidichk
217217
- bodyclose
218-
- deadcode
219218
- dogsled
220219
- errcheck
221220
- errname
@@ -259,4 +258,3 @@ linters:
259258
- typecheck
260259
- unconvert
261260
- unused
262-
- varcheck

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ site/test-results/*
3030
site/e2e/test-results/*
3131
site/e2e/states/*.json
3232
site/playwright-report/*
33+
site/.swc
3334

3435
# Make target for updating golden files.
3536
cli/testdata/.gen-golden
37+
helm/tests/testdata/.gen-golden
3638

3739
# Build
3840
/build/

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"agentsdk",
55
"apps",
66
"ASKPASS",
7+
"authcheck",
78
"autostop",
89
"awsidentity",
910
"bodyclose",

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ docs/admin/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/me
501501
yarn run format:write:only ../docs/admin/prometheus.md
502502

503503
docs/cli.md: scripts/clidocgen/main.go $(GO_SRC_FILES) docs/manifest.json
504-
rm -rf ./docs/cli/*.md
504+
# TODO(@ammario): re-enable server.md once we finish clibase migration.
505+
ls ./docs/cli/*.md | grep -vP "\/coder_server" | xargs rm
505506
BASE_PATH="." go run ./scripts/clidocgen
506507
cd site
507508
yarn run format:write:only ../docs/cli.md ../docs/cli/*.md ../docs/manifest.json
@@ -515,13 +516,17 @@ coderd/apidoc/swagger.json: $(shell find ./scripts/apidocgen $(FIND_EXCLUSIONS)
515516
./scripts/apidocgen/generate.sh
516517
yarn run --cwd=site format:write:only ../docs/api ../docs/manifest.json ../coderd/apidoc/swagger.json
517518

518-
update-golden-files: cli/testdata/.gen-golden
519+
update-golden-files: cli/testdata/.gen-golden helm/tests/testdata/.gen-golden
519520
.PHONY: update-golden-files
520521

521522
cli/testdata/.gen-golden: $(wildcard cli/testdata/*.golden) $(GO_SRC_FILES)
522523
go test ./cli -run=TestCommandHelp -update
523524
touch "$@"
524525

526+
helm/tests/testdata/.gen-golden: $(wildcard helm/tests/testdata/*.golden) $(GO_SRC_FILES)
527+
go test ./helm/tests -run=TestUpdateGoldenFiles -update
528+
touch "$@"
529+
525530
# Generate a prettierrc for the site package that uses relative paths for
526531
# overrides. This allows us to share the same prettier config between the
527532
# site and the root of the repo.

0 commit comments

Comments
 (0)