Skip to content

Commit 9a99df5

Browse files
committed
Merge remote-tracking branch 'origin/main' into coder_app-open_in
2 parents 8596e92 + dcf5153 commit 9a99df5

File tree

339 files changed

+19955
-8660
lines changed

Some content is hidden

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

339 files changed

+19955
-8660
lines changed

.github/.linkspector.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ ignorePatterns:
1818
- pattern: "i.imgur.com"
1919
- pattern: "code.visualstudio.com"
2020
- pattern: "www.emacswiki.org"
21+
- pattern: "linux.die.net/man"
2122
aliveStatusCodes:
2223
- 200

.github/workflows/ci.yaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ jobs:
188188
189189
# Check for any typos
190190
- name: Check for typos
191-
uses: crate-ci/typos@b74202f74b4346efdbce7801d187ec57b266bac8 # v1.27.3
191+
uses: crate-ci/typos@d1c850b2b5d502763520c25fb4a6a1128ad99bd9 # v1.28.3
192192
with:
193193
config: .github/workflows/typos.toml
194194

@@ -540,7 +540,7 @@ jobs:
540540
timeout-minutes: 25
541541
steps:
542542
- name: Harden Runner
543-
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
543+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
544544
with:
545545
egress-policy: audit
546546

@@ -630,11 +630,8 @@ jobs:
630630
working-directory: site
631631

632632
test-e2e:
633-
# test-e2e fails on 2-core 8GB runners, so we use the 4-core 16GB runner
634633
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-4' || 'ubuntu-latest' }}
635634
needs: changes
636-
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
637-
timeout-minutes: 20
638635
strategy:
639636
fail-fast: false
640637
matrix:
@@ -643,6 +640,9 @@ jobs:
643640
name: test-e2e
644641
- premium: true
645642
name: test-e2e-premium
643+
# Skip test-e2e on forks as they don't have access to CI secrets
644+
if: (needs.changes.outputs.go == 'true' || needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main') && !(github.event.pull_request.head.repo.fork)
645+
timeout-minutes: 20
646646
name: ${{ matrix.variant.name }}
647647
steps:
648648
- name: Harden Runner
@@ -666,6 +666,8 @@ jobs:
666666
name: make gen
667667

668668
- run: pnpm build
669+
env:
670+
NODE_OPTIONS: ${{ github.repository_owner == 'coder' && '--max_old_space_size=8192' || '' }}
669671
working-directory: site
670672

671673
- run: pnpm playwright:install
@@ -747,7 +749,7 @@ jobs:
747749
# Prevent excessive build runs on minor version changes
748750
skip: "@(renovate/**|dependabot/**)"
749751
# Run TurboSnap to trace file dependencies to related stories
750-
# and tell chromatic to only take snapshots of relevent stories
752+
# and tell chromatic to only take snapshots of relevant stories
751753
onlyChanged: true
752754
# Avoid uploading single files, because that's very slow
753755
zip: true
@@ -774,7 +776,7 @@ jobs:
774776
workingDir: "./site"
775777
storybookBaseDir: "./site"
776778
# Run TurboSnap to trace file dependencies to related stories
777-
# and tell chromatic to only take snapshots of relevent stories
779+
# and tell chromatic to only take snapshots of relevant stories
778780
onlyChanged: true
779781
# Avoid uploading single files, because that's very slow
780782
zip: true
@@ -893,7 +895,7 @@ jobs:
893895
needs: changes
894896
# We always build the dylibs on Go changes to verify we're not merging unbuildable code,
895897
# but they need only be signed and uploaded on coder/coder main.
896-
if: needs.changes.outputs.docs-only == 'false' || github.ref == 'refs/heads/main'
898+
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
897899
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest' }}
898900
steps:
899901
- name: Harden Runner
@@ -974,7 +976,7 @@ jobs:
974976
- changes
975977
- build-dylib
976978
if: github.ref == 'refs/heads/main' && needs.changes.outputs.docs-only == 'false' && !github.event.pull_request.head.repo.fork
977-
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
979+
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-22.04' }}
978980
permissions:
979981
packages: write # Needed to push images to ghcr.io
980982
env:
@@ -1144,7 +1146,7 @@ jobs:
11441146
version: "2.2.1"
11451147

11461148
- name: Get Cluster Credentials
1147-
uses: google-github-actions/get-gke-credentials@206d64b64b0eba0a6e2f25113d044c31776ca8d6 # v2.2.2
1149+
uses: google-github-actions/get-gke-credentials@9025e8f90f2d8e0c3dafc3128cc705a26d992a6a # v2.3.0
11481150
with:
11491151
cluster_name: dogfood-v2
11501152
location: us-central1-a

.github/workflows/contrib.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141

4242
cla:
4343
runs-on: ubuntu-latest
44+
permissions:
45+
pull-requests: write
4446
steps:
4547
- name: Harden Runner
4648
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
@@ -53,7 +55,7 @@ jobs:
5355
env:
5456
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5557
# the below token should have repo scope and must be manually added by you in the repository's secret
56-
PERSONAL_ACCESS_TOKEN: ${{ secrets.CDRCOMMUNITY_GITHUB_TOKEN }}
58+
PERSONAL_ACCESS_TOKEN: ${{ secrets.CDRCI2_GITHUB_TOKEN }}
5759
with:
5860
remote-organization-name: "coder"
5961
remote-repository-name: "cla"

.github/workflows/dogfood.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
uses: depot/setup-action@b0b1ea4f69e92ebf5dea3f8713a1b0c37b2126a5 # v1.6.0
5151

5252
- name: Set up Docker Buildx
53-
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
53+
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
5454

5555
- name: Login to DockerHub
5656
if: github.ref == 'refs/heads/main'

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ jobs:
4747

4848
# Upload the results to GitHub's code scanning dashboard.
4949
- name: "Upload to code-scanning"
50-
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
50+
uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
5151
with:
5252
sarif_file: results.sarif

.github/workflows/security.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
uses: ./.github/actions/setup-go
3939

4040
- name: Initialize CodeQL
41-
uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
41+
uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
4242
with:
4343
languages: go, javascript
4444

@@ -48,7 +48,7 @@ jobs:
4848
rm Makefile
4949
5050
- name: Perform CodeQL Analysis
51-
uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
51+
uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
5252

5353
- name: Send Slack notification on failure
5454
if: ${{ failure() }}
@@ -144,7 +144,7 @@ jobs:
144144
severity: "CRITICAL,HIGH"
145145

146146
- name: Upload Trivy scan results to GitHub Security tab
147-
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
147+
uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
148148
with:
149149
sarif_file: trivy-results.sarif
150150
category: "Trivy"

.github/workflows/weekly-docs.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ permissions:
1515

1616
jobs:
1717
check-docs:
18-
runs-on: ubuntu-latest
18+
# later versions of Ubuntu have disabled unprivileged user namespaces, which are required by the action
19+
runs-on: ubuntu-22.04
1920
permissions:
2021
pull-requests: write # required to post PR review comments by the action
2122
steps:

.golangci.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ linters-settings:
175175
- name: modifies-value-receiver
176176
- name: package-comments
177177
- name: range
178-
- name: range-val-address
179-
- name: range-val-in-closure
180178
- name: receiver-naming
181179
- name: redefines-builtin-id
182180
- name: string-of-int
@@ -199,6 +197,10 @@ linters-settings:
199197
govet:
200198
disable:
201199
- loopclosure
200+
gosec:
201+
excludes:
202+
# Implicit memory aliasing of items from a range statement (irrelevant as of Go v1.22)
203+
- G601
202204

203205
issues:
204206
# Rules listed here: https://github.com/securego/gosec#available-rules
@@ -238,7 +240,6 @@ linters:
238240
- errname
239241
- errorlint
240242
- exhaustruct
241-
- exportloopref
242243
- forcetypeassert
243244
- gocritic
244245
# gocyclo is may be useful in the future when we start caring

.vscode/markdown.code-snippets

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
"body": "![${TM_SELECTED_TEXT:${1:alt}}](${2:url})$0",
2121
"description": "image"
2222
},
23+
"premium-feature": {
24+
"prefix": "#premium-feature",
25+
"body": [
26+
"<blockquote class=\"info\">\n",
27+
"${1:feature} ${2|is,are|} an Enterprise and Premium feature. [Learn more](https://coder.com/pricing#compare-plans).\n",
28+
"</blockquote>"
29+
]
30+
},
2331
"tabs": {
2432
"prefix": "#tabs",
2533
"body": [

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,8 @@ vpn/vpn.pb.go: vpn/vpn.proto
640640
./vpn/vpn.proto
641641

642642
site/src/api/typesGenerated.ts: $(wildcard scripts/apitypings/*) $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
643-
go run ./scripts/apitypings/ > $@
644-
./scripts/pnpm_install.sh
643+
# -C sets the directory for the go run command
644+
go run -C ./scripts/apitypings main.go > $@
645645

646646
site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
647647
cd site

agent/agent.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"tailscale.com/util/clientmetric"
3434

3535
"cdr.dev/slog"
36+
"github.com/coder/coder/v2/agent/agentexec"
3637
"github.com/coder/coder/v2/agent/agentscripts"
3738
"github.com/coder/coder/v2/agent/agentssh"
3839
"github.com/coder/coder/v2/agent/proto"
@@ -80,6 +81,7 @@ type Options struct {
8081
ReportMetadataInterval time.Duration
8182
ServiceBannerRefreshInterval time.Duration
8283
BlockFileTransfer bool
84+
Execer agentexec.Execer
8385
}
8486

8587
type Client interface {
@@ -139,6 +141,10 @@ func New(options Options) Agent {
139141
prometheusRegistry = prometheus.NewRegistry()
140142
}
141143

144+
if options.Execer == nil {
145+
options.Execer = agentexec.DefaultExecer
146+
}
147+
142148
hardCtx, hardCancel := context.WithCancel(context.Background())
143149
gracefulCtx, gracefulCancel := context.WithCancel(hardCtx)
144150
a := &agent{
@@ -171,6 +177,7 @@ func New(options Options) Agent {
171177

172178
prometheusRegistry: prometheusRegistry,
173179
metrics: newAgentMetrics(prometheusRegistry),
180+
execer: options.Execer,
174181
}
175182
// Initially, we have a closed channel, reflecting the fact that we are not initially connected.
176183
// Each time we connect we replace the channel (while holding the closeMutex) with a new one
@@ -239,6 +246,7 @@ type agent struct {
239246
// metrics are prometheus registered metrics that will be collected and
240247
// labeled in Coder with the agent + workspace.
241248
metrics *agentMetrics
249+
execer agentexec.Execer
242250
}
243251

244252
func (a *agent) TailnetConn() *tailnet.Conn {
@@ -247,7 +255,7 @@ func (a *agent) TailnetConn() *tailnet.Conn {
247255

248256
func (a *agent) init() {
249257
// pass the "hard" context because we explicitly close the SSH server as part of graceful shutdown.
250-
sshSrv, err := agentssh.NewServer(a.hardCtx, a.logger.Named("ssh-server"), a.prometheusRegistry, a.filesystem, &agentssh.Config{
258+
sshSrv, err := agentssh.NewServer(a.hardCtx, a.logger.Named("ssh-server"), a.prometheusRegistry, a.filesystem, a.execer, &agentssh.Config{
251259
MaxTimeout: a.sshMaxTimeout,
252260
MOTDFile: func() string { return a.manifest.Load().MOTDFile },
253261
AnnouncementBanners: func() *[]codersdk.BannerConfig { return a.announcementBanners.Load() },

0 commit comments

Comments
 (0)