Skip to content

Commit a6cb7fa

Browse files
committed
merge: main
2 parents 0dd834d + 712098f commit a6cb7fa

File tree

1,364 files changed

+86850
-43513
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,364 files changed

+86850
-43513
lines changed

.github/pull_request_template.md

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

.github/workflows/ci.yaml

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ jobs:
3535
uses: actions/checkout@v3
3636

3737
# Install Go!
38-
- uses: actions/setup-go@v3
38+
- uses: actions/setup-go@v4
3939
with:
4040
go-version: "~1.20"
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.14.3
4545
with:
4646
config: .github/workflows/typos.toml
4747
- name: Fix the typos
@@ -150,8 +150,9 @@ jobs:
150150
- name: Install node_modules
151151
run: ./scripts/yarn_install.sh
152152

153-
- uses: actions/setup-go@v3
153+
- uses: actions/setup-go@v4
154154
with:
155+
cache: false
155156
go-version: "~1.20"
156157

157158
- name: Echo Go Cache Paths
@@ -174,7 +175,7 @@ jobs:
174175

175176
- name: Install sqlc
176177
run: |
177-
curl -sSL https://github.com/kyleconroy/sqlc/releases/download/v1.16.0/sqlc_1.16.0_linux_amd64.tar.gz | sudo tar -C /usr/bin -xz sqlc
178+
curl -sSL https://github.com/kyleconroy/sqlc/releases/download/v1.17.2/sqlc_1.17.2_linux_amd64.tar.gz | sudo tar -C /usr/bin -xz sqlc
178179
- name: Install protoc-gen-go
179180
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
180181
- name: Install protoc-gen-go-drpc
@@ -186,8 +187,9 @@ jobs:
186187

187188
- name: Install Protoc
188189
run: |
189-
# protoc must be in lockstep with our dogfood Dockerfile
190-
# or the version in the comments will differ.
190+
# protoc must be in lockstep with our dogfood Dockerfile or the
191+
# version in the comments will differ. This is also defined in
192+
# security.yaml
191193
set -x
192194
cd dogfood
193195
DOCKER_BUILDKIT=1 docker build . --target proto -t protoc
@@ -249,18 +251,16 @@ jobs:
249251
steps:
250252
- uses: actions/checkout@v3
251253

252-
- uses: actions/setup-go@v3
254+
- uses: actions/setup-go@v4
253255
with:
256+
cache: false
254257
go-version: "~1.20"
255258

256-
# Sadly the new "set output" syntax (of writing env vars to
257-
# $GITHUB_OUTPUT) does not work on both powershell and bash so we use the
258-
# deprecated syntax here.
259259
- name: Echo Go Cache Paths
260260
id: go-cache-paths
261261
run: |
262-
echo "::set-output name=GOCACHE::$(go env GOCACHE)"
263-
echo "::set-output name=GOMODCACHE::$(go env GOMODCACHE)"
262+
echo "GOCACHE=$(go env GOCACHE)" >> ${{ runner.os == 'Windows' && '$env:' || '$' }}GITHUB_OUTPUT
263+
echo "GOMODCACHE=$(go env GOMODCACHE)" >> ${{ runner.os == 'Windows' && '$env:' || '$' }}GITHUB_OUTPUT
264264
265265
- name: Go Build Cache
266266
uses: actions/cache@v3
@@ -275,7 +275,7 @@ jobs:
275275
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
276276

277277
- name: Install gotestsum
278-
uses: jaxxstorm/action-install-gh-release@v1.9.0
278+
uses: jaxxstorm/action-install-gh-release@v1.10.0
279279
env:
280280
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
281281
with:
@@ -301,7 +301,14 @@ jobs:
301301
echo "cover=false" >> $GITHUB_OUTPUT
302302
fi
303303
304-
gotestsum --junitfile="gotests.xml" --packages="./..." -- -parallel=8 -timeout=5m -short -failfast $COVERAGE_FLAGS
304+
gotestsum --junitfile="gotests.xml" --jsonfile="gotests.json" --packages="./..." -- -parallel=8 -timeout=7m -short -failfast $COVERAGE_FLAGS
305+
306+
- name: Print test stats
307+
if: success() || failure()
308+
run: |
309+
# Artifacts are not available after rerunning a job,
310+
# so we need to print the test stats to the log.
311+
go run ./scripts/ci-report/main.go gotests.json | tee gotests_stats.json
305312
306313
- uses: actions/upload-artifact@v3
307314
if: success() || failure()
@@ -332,8 +339,9 @@ jobs:
332339
steps:
333340
- uses: actions/checkout@v3
334341

335-
- uses: actions/setup-go@v3
342+
- uses: actions/setup-go@v4
336343
with:
344+
cache: false
337345
go-version: "~1.20"
338346

339347
- name: Echo Go Cache Paths
@@ -355,7 +363,7 @@ jobs:
355363
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
356364

357365
- name: Install gotestsum
358-
uses: jaxxstorm/action-install-gh-release@v1.9.0
366+
uses: jaxxstorm/action-install-gh-release@v1.10.0
359367
env:
360368
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
361369
with:
@@ -371,6 +379,13 @@ jobs:
371379
run: |
372380
make test-postgres
373381
382+
- name: Print test stats
383+
if: success() || failure()
384+
run: |
385+
# Artifacts are not available after rerunning a job,
386+
# so we need to print the test stats to the log.
387+
go run ./scripts/ci-report/main.go gotests.json | tee gotests_stats.json
388+
374389
- uses: actions/upload-artifact@v3
375390
if: success() || failure()
376391
with:
@@ -415,8 +430,9 @@ jobs:
415430
- name: Set up Google Cloud SDK
416431
uses: google-github-actions/setup-gcloud@v1
417432

418-
- uses: actions/setup-go@v3
433+
- uses: actions/setup-go@v4
419434
with:
435+
cache: false
420436
go-version: "~1.20"
421437

422438
- name: Echo Go Cache Paths
@@ -511,7 +527,7 @@ jobs:
511527
- name: Install node_modules
512528
run: ./scripts/yarn_install.sh
513529

514-
- run: yarn test:ci
530+
- run: yarn test:ci --max-workers ${{ steps.cpu-cores.outputs.count }}
515531
working-directory: site
516532

517533
- uses: codecov/codecov-action@v3
@@ -544,8 +560,9 @@ jobs:
544560
.eslintcache
545561
key: js-${{ runner.os }}-e2e-${{ hashFiles('**/yarn.lock') }}
546562

547-
- uses: actions/setup-go@v3
563+
- uses: actions/setup-go@v4
548564
with:
565+
cache: false
549566
go-version: "~1.20"
550567

551568
- uses: hashicorp/setup-terraform@v2
@@ -622,6 +639,9 @@ jobs:
622639
- name: Publish to Chromatic (non-mainline)
623640
if: github.ref != 'refs/heads/main' && github.repository_owner == 'coder'
624641
uses: chromaui/action@v1
642+
env:
643+
NODE_OPTIONS: "--max_old_space_size=4096"
644+
STORYBOOK: true
625645
with:
626646
buildScriptName: "storybook:build"
627647
exitOnceUploaded: true
@@ -639,6 +659,9 @@ jobs:
639659
- name: Publish to Chromatic (mainline)
640660
if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder'
641661
uses: chromaui/action@v1
662+
env:
663+
NODE_OPTIONS: "--max_old_space_size=4096"
664+
STORYBOOK: true
642665
with:
643666
autoAcceptChanges: true
644667
buildScriptName: "storybook:build"

.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/cron-weekly.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Weekly Cron
2+
# runs every monday at 9 am
3+
on:
4+
schedule:
5+
- cron: "0 9 * * 1"
6+
workflow_dispatch: # allows to run manually for testing
7+
8+
jobs:
9+
check-docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@master
14+
15+
- name: Check Markdown links
16+
uses: gaurav-nelson/github-action-markdown-link-check@v1
17+
id: markdown-link-check
18+
# checks all markdown files from /docs including all subfolders
19+
with:
20+
use-quiet-mode: "yes"
21+
use-verbose-mode: "yes"
22+
config-file: ".github/workflows/mlc_config.json"
23+
folder-path: "docs/"
24+
file-path: "./README.md"
25+
26+
- name: Send Slack notification
27+
if: failure()
28+
run: |
29+
curl -X POST -H 'Content-type: application/json' -d '{"msg":"Broken links found in the documentation. Please check the logs at ${{ env.LOGS_URL }}"}' ${{ secrets.DOCS_LINK_SLACK_WEBHOOK }}
30+
echo "Sent Slack notification"
31+
env:
32+
LOGS_URL: https://github.com/coder/coder/actions/runs/${{ github.run_id }}

.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/mlc_config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
{
1919
"pattern": "tailscale.com"
2020
}
21-
]
21+
],
22+
"aliveStatusCodes": [200, 0]
2223
}

.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: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
username: ${{ github.actor }}
9191
password: ${{ secrets.GITHUB_TOKEN }}
9292

93-
- uses: actions/setup-go@v3
93+
- uses: actions/setup-go@v4
9494
with:
9595
go-version: "~1.20"
9696

@@ -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
@@ -272,10 +302,11 @@ jobs:
272302
helm repo index build/helm --url https://helm.coder.com/v2 --merge build/helm/index.yaml
273303
gsutil -h "Cache-Control:no-cache,max-age=0" cp build/helm/coder_helm_${version}.tgz gs://helm.coder.com/v2
274304
gsutil -h "Cache-Control:no-cache,max-age=0" cp build/helm/index.yaml gs://helm.coder.com/v2
305+
gsutil -h "Cache-Control:no-cache,max-age=0" cp helm/artifacthub-repo.yml gs://helm.coder.com/v2
275306
276307
- name: Upload artifacts to actions (if dry-run)
277308
if: ${{ inputs.dry_run }}
278-
uses: actions/upload-artifact@v2
309+
uses: actions/upload-artifact@v3
279310
with:
280311
name: release-artifacts
281312
path: |

0 commit comments

Comments
 (0)