Skip to content

Commit 8d7507d

Browse files
authored
Merge branch 'main' into sigusr2
2 parents 68a4022 + 18e19d2 commit 8d7507d

Some content is hidden

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

79 files changed

+2936
-2267
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ body:
5757
id: logs
5858
attributes:
5959
label: Logs
60-
description: Run code-server with the --verbose flag and then paste any relevant logs from the server, from the browser console and/or the browser network tab. For issues with installation, include installation logs (i.e. output of `yarn global add code-server`).
60+
description: Run code-server with the --verbose flag and then paste any relevant logs from the server, from the browser console and/or the browser network tab. For issues with installation, include installation logs (i.e. output of `npm install -g code-server`).
6161
- type: textarea
6262
attributes:
6363
label: Screenshot/Video

.github/workflows/ci.yaml

+75-62
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
steps:
3030
- name: Checkout repo
3131
uses: actions/checkout@v3
32+
with:
33+
fetch-depth: 0
34+
submodules: true
3235

3336
- name: Install Node.js v14
3437
uses: actions/setup-node@v3
@@ -38,21 +41,17 @@ jobs:
3841
- name: Install helm
3942
uses: azure/[email protected]
4043

41-
# NOTE@jsjoeio
42-
# disabling this until we can audit the build process
43-
# and the usefulness of this step
44-
# See: https://github.com/coder/code-server/issues/4287
45-
# - name: Fetch dependencies from cache
46-
# id: cache-yarn
47-
# uses: actions/cache@v2
48-
# with:
49-
# path: "**/node_modules"
50-
# key: yarn-build-${{ hashFiles('**/yarn.lock') }}
51-
# restore-keys: |
52-
# yarn-build-
44+
- name: Fetch dependencies from cache
45+
id: cache-yarn
46+
uses: actions/cache@v3
47+
with:
48+
path: "**/node_modules"
49+
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
50+
restore-keys: |
51+
yarn-build-
5352
5453
- name: Install dependencies
55-
# if: steps.cache-yarn.outputs.cache-hit != 'true'
54+
if: steps.cache-yarn.outputs.cache-hit != 'true'
5655
run: yarn --frozen-lockfile
5756

5857
- name: Run yarn fmt
@@ -71,6 +70,9 @@ jobs:
7170
steps:
7271
- name: Checkout repo
7372
uses: actions/checkout@v3
73+
with:
74+
fetch-depth: 0
75+
submodules: true
7476

7577
- name: Install Node.js v14
7678
uses: actions/setup-node@v3
@@ -79,7 +81,7 @@ jobs:
7981

8082
- name: Fetch dependencies from cache
8183
id: cache-yarn
82-
uses: actions/cache@v2
84+
uses: actions/cache@v3
8385
with:
8486
path: "**/node_modules"
8587
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
@@ -102,60 +104,56 @@ jobs:
102104
env:
103105
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
104106
steps:
105-
- uses: actions/checkout@v3
107+
- name: Checkout repo
108+
uses: actions/checkout@v3
106109
with:
107110
fetch-depth: 0
111+
submodules: true
112+
113+
- name: Install quilt
114+
run: sudo apt update && sudo apt install quilt
115+
116+
- name: Patch Code
117+
run: quilt push -a
108118

109119
- name: Install Node.js v14
110120
uses: actions/setup-node@v3
111121
with:
112122
node-version: "14"
113123

114-
# TODO@Teffen investigate why this omits code-oss-dev/node_modules
115-
# - name: Fetch dependencies from cache
116-
# id: cache-yarn
117-
# uses: actions/cache@v2
118-
# with:
119-
# path: |
120-
# "**/node_modules"
121-
# "**/vendor/modules"
122-
# "**/vendor/modules/code-oss-dev/node_modules"
123-
# key: yarn-build-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/vendor/yarn.lock') }}
124-
# restore-keys: |
125-
# yarn-build-
124+
- name: Fetch dependencies from cache
125+
id: cache-yarn
126+
uses: actions/cache@v3
127+
with:
128+
path: "**/node_modules"
129+
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
130+
restore-keys: |
131+
yarn-build-
126132
127133
- name: Install dependencies
128-
# if: steps.cache-yarn.outputs.cache-hit != 'true'
134+
if: steps.cache-yarn.outputs.cache-hit != 'true'
129135
run: yarn --frozen-lockfile
130136

131137
- name: Build code-server
132138
run: yarn build
133139

134-
# Parse the hash of the latest commit inside vendor/modules/code-oss-dev
135-
# use this to avoid rebuilding it if nothing changed
136-
# How it works: the `git log` command fetches the hash of the last commit
137-
# that changed a file inside `vendor/modules/code-oss-dev`. If a commit changes any file in there,
138-
# the hash returned will change, and we rebuild vscode. If the hash did not change,
139-
# (for example, a change to `src/` or `docs/`), we reuse the same build as last time.
140-
# This saves a lot of time in CI, as compiling VSCode can take anywhere from 5-10 minutes.
141-
- name: Get latest vendor/modules/code-oss-dev rev
140+
# Get Code's git hash. When this changes it means the content is
141+
# different and we need to rebuild.
142+
- name: Get latest lib/vscode rev
142143
id: vscode-rev
143-
run: echo "::set-output name=rev::$(jq -r '.devDependencies["code-oss-dev"]' vendor/package.json | sed -r 's|.*#(.*)$|\1|')"
144+
run: echo "::set-output name=rev::$(git rev-parse HEAD:./lib/vscode)"
144145

145-
- name: Attempt to fetch vscode build from cache
146-
id: cache-vscode-2
147-
uses: actions/cache@v2
146+
# We need to rebuild when we have a new version of Code or when any of
147+
# the patches changed. Use VSCODE_CACHE_VERSION to force a rebuild.
148+
- name: Fetch prebuilt Code package from cache
149+
id: cache-vscode
150+
uses: actions/cache@v3
148151
with:
149-
path: |
150-
vendor/modules/code-oss-dev/.build
151-
vendor/modules/code-oss-dev/package.json
152-
vendor/modules/code-oss-dev/out-build
153-
vendor/modules/code-oss-dev/out-vscode-reh-web
154-
vendor/modules/code-oss-dev/out-vscode-reh-web-min
155-
key: vscode-reh-build-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}
152+
path: lib/vscode-reh-web-*
153+
key: vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ hashFiles('patches/*.diff') }}
156154

157155
- name: Build vscode
158-
if: steps.cache-vscode-2.outputs.cache-hit != 'true'
156+
if: steps.cache-vscode.outputs.cache-hit != 'true'
159157
run: yarn build:vscode
160158

161159
# Our code imports code from VS Code's `out` directory meaning VS Code
@@ -197,9 +195,13 @@ jobs:
197195
if: github.event.pull_request.head.repo.full_name == github.repository
198196
runs-on: ubuntu-latest
199197
steps:
200-
- uses: actions/checkout@v3
198+
- name: Checkout repo
199+
uses: actions/checkout@v3
200+
with:
201+
fetch-depth: 0
201202

202-
- uses: actions/download-artifact@v3
203+
- name: Download artifact
204+
uses: actions/download-artifact@v3
203205
id: download
204206
with:
205207
name: "npm-package"
@@ -226,7 +228,10 @@ jobs:
226228
container: "centos:7"
227229

228230
steps:
229-
- uses: actions/checkout@v3
231+
- name: Checkout repo
232+
uses: actions/checkout@v3
233+
with:
234+
fetch-depth: 0
230235

231236
- name: Install Node.js v14
232237
uses: actions/setup-node@v3
@@ -315,7 +320,10 @@ jobs:
315320
NODE_VERSION: v14.17.4
316321

317322
steps:
318-
- uses: actions/checkout@v3
323+
- name: Checkout repo
324+
uses: actions/checkout@v3
325+
with:
326+
fetch-depth: 0
319327

320328
- name: Install Node.js v14
321329
uses: actions/setup-node@v3
@@ -364,7 +372,10 @@ jobs:
364372
runs-on: macos-latest
365373
timeout-minutes: 15
366374
steps:
367-
- uses: actions/checkout@v3
375+
- name: Checkout repo
376+
uses: actions/checkout@v3
377+
with:
378+
fetch-depth: 0
368379

369380
- name: Install Node.js v14
370381
uses: actions/setup-node@v3
@@ -409,7 +420,11 @@ jobs:
409420
# since VS Code will load faster due to the bundling.
410421
CODE_SERVER_TEST_ENTRY: "./release-packages/code-server-linux-amd64"
411422
steps:
412-
- uses: actions/checkout@v3
423+
- name: Checkout repo
424+
uses: actions/checkout@v3
425+
with:
426+
fetch-depth: 0
427+
submodules: true
413428

414429
- name: Install Node.js v14
415430
uses: actions/setup-node@v3
@@ -418,7 +433,7 @@ jobs:
418433

419434
- name: Fetch dependencies from cache
420435
id: cache-yarn
421-
uses: actions/cache@v2
436+
uses: actions/cache@v3
422437
with:
423438
path: "**/node_modules"
424439
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
@@ -446,12 +461,6 @@ jobs:
446461
./test/node_modules/.bin/playwright install-deps
447462
./test/node_modules/.bin/playwright install
448463
449-
# TODO@jsjoeio - remove once we switch to submodules.
450-
- name: Create package.json for testing
451-
run: |
452-
mkdir -p ./vendor/modules/code-oss-dev
453-
echo '{ "version": "test" }' > ./vendor/modules/code-oss-dev/package.json
454-
455464
- name: Run end-to-end tests
456465
run: yarn test:e2e
457466

@@ -468,8 +477,11 @@ jobs:
468477
trivy-scan-repo:
469478
runs-on: ubuntu-20.04
470479
steps:
471-
- name: Checkout code
480+
- name: Checkout repo
472481
uses: actions/checkout@v3
482+
with:
483+
fetch-depth: 0
484+
473485
- name: Run Trivy vulnerability scanner in repo mode
474486
uses: aquasecurity/trivy-action@296212627a1e693efa09c00adc3e03b2ba8edf18
475487
with:
@@ -480,6 +492,7 @@ jobs:
480492
template: "@/contrib/sarif.tpl"
481493
output: "trivy-repo-results.sarif"
482494
severity: "HIGH,CRITICAL"
495+
483496
- name: Upload Trivy scan results to GitHub Security tab
484497
uses: github/codeql-action/upload-sarif@v1
485498
with:

.github/workflows/docker.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@ jobs:
3535
username: ${{ secrets.DOCKER_USERNAME }}
3636
password: ${{ secrets.DOCKER_PASSWORD }}
3737

38+
- name: Get version
39+
id: version
40+
run: echo "::set-output name=version::$(jq -r .version package.json)"
41+
42+
- name: Download artifact
43+
uses: dawidd6/action-download-artifact@v2
44+
id: download
45+
with:
46+
branch: v${{ steps.version.outputs.version }}
47+
workflow: ci.yaml
48+
workflow_conclusion: completed
49+
name: "release-packages"
50+
path: release-packages
51+
3852
- name: Run ./ci/steps/docker-buildx-push.sh
3953
run: ./ci/steps/docker-buildx-push.sh
4054
env:

.github/workflows/docs-preview.yaml

+7-72
Original file line numberDiff line numberDiff line change
@@ -17,89 +17,24 @@ permissions:
1717
security-events: none
1818
statuses: none
1919

20-
# Cancel in-progress runs for pull requests when developers push
21-
# additional changes, and serialize builds in branches.
22-
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
23-
concurrency:
24-
group: ${{ github.workflow }}-${{ github.ref }}
25-
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
26-
2720
jobs:
2821
preview:
2922
name: Docs preview
3023
runs-on: ubuntu-20.04
31-
environment: CI
32-
# Only run if PR comes from base repo
33-
# Reason: forks cannot access secrets and this will always fail
34-
if: github.event.pull_request.head.repo.full_name == github.repository
3524
steps:
36-
- name: Cancel Previous Runs
37-
uses: styfle/[email protected]
38-
39-
- name: Checkout m
40-
uses: actions/checkout@v3
41-
with:
42-
repository: coder/m
43-
ref: refs/heads/master
44-
ssh-key: ${{ secrets.READONLY_M_DEPLOY_KEY }}
45-
submodules: true
46-
fetch-depth: 0
47-
48-
- name: Install Node.js
49-
uses: actions/setup-node@v3
50-
with:
51-
node-version: 14
52-
53-
- name: Cache Node Modules
54-
uses: actions/cache@v2
55-
with:
56-
path: "/node_modules"
57-
key: node-${{ hashFiles('yarn.lock') }}
58-
59-
- name: Create Deployment
60-
id: deployment
61-
run: ./ci/scripts/github_deployment.sh create
62-
env:
63-
GITHUB_TOKEN: ${{ github.token }}
64-
DEPLOY_ENVIRONMENT: codercom-preview-docs
65-
66-
- name: Deploy Preview to Vercel
67-
id: preview
68-
run: ./ci/scripts/deploy_vercel.sh
69-
env:
70-
VERCEL_ORG_ID: team_tGkWfhEGGelkkqUUm9nXq17r
71-
VERCEL_PROJECT_ID: QmZRucMRh3GFk1817ZgXjRVuw5fhTspHPHKct3JNQDEPGd
72-
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
73-
CODE_SERVER_DOCS_MAIN_BRANCH: ${{ github.event.pull_request.head.sha }}
25+
- uses: actions/checkout@v3
7426

75-
- name: Install node_modules
76-
run: yarn install
77-
78-
- name: Check docs
79-
run: yarn ts-node ./product/coder.com/site/scripts/checkDocs.ts
80-
env:
81-
BASE_URL: ${{ steps.preview.outputs.url }}
82-
83-
- name: Update Deployment
84-
# If we don't specify always, it won't run this check if failed.
85-
# This means the deployment would be stuck pending.
86-
if: always()
87-
run: ./ci/scripts/github_deployment.sh update
88-
env:
89-
GITHUB_DEPLOYMENT: ${{ steps.deployment.outputs.id }}
90-
GITHUB_TOKEN: ${{ github.token }}
91-
DEPLOY_STATUS: ${{ steps.preview.outcome }}
92-
DEPLOY_URL: ${{ steps.preview.outputs.url }}
27+
- name: Set outputs
28+
id: vars
29+
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
9330

9431
- name: Comment Credentials
9532
uses: marocchino/sticky-pull-request-comment@v2
96-
if: always()
9733
with:
9834
header: codercom-preview-docs
9935
message: |
100-
✨ Coder.com for PR #${{ github.event.number }} deployed! It will be updated on every commit.
101-
102-
* _Host_: ${{ steps.preview.outputs.url }}/docs/code-server
103-
* _Last deploy status_: ${{ steps.preview.outcome }}
36+
✨ code-server docs for PR #${{ github.event.number }} is ready! It will be updated on every commit.
37+
* _Host_: https://coder.com/docs/code-server/${{ steps.vars.outputs.sha_short }}
38+
* _Last deploy status_: success
10439
* _Commit_: ${{ github.event.pull_request.head.sha }}
10540
* _Workflow status_: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

0 commit comments

Comments
 (0)