Skip to content

Commit a9ac963

Browse files
committed
Merge branch 'main' of https://github.com/coder/coder into bq/implement-new-ws-header
2 parents ffacb9f + 7c4fbe5 commit a9ac963

File tree

234 files changed

+8940
-3867
lines changed

Some content is hidden

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

234 files changed

+8940
-3867
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144
145145
# Check for any typos
146146
- name: Check for typos
147-
uses: crate-ci/typos@v1.16.24
147+
uses: crate-ci/typos@v1.16.25
148148
with:
149149
config: .github/workflows/typos.toml
150150

@@ -478,15 +478,15 @@ jobs:
478478

479479
- name: Upload Playwright Failed Tests
480480
if: always() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
481-
uses: actions/upload-artifact@v3
481+
uses: actions/upload-artifact@v4
482482
with:
483483
name: failed-test-videos
484484
path: ./site/test-results/**/*.webm
485485
retention-days: 7
486486

487487
- name: Upload pprof dumps
488488
if: always() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
489-
uses: actions/upload-artifact@v3
489+
uses: actions/upload-artifact@v4
490490
with:
491491
name: debug-pprof-dumps
492492
path: ./site/test-results/**/debug-pprof-*.txt
@@ -734,7 +734,7 @@ jobs:
734734
prune-untagged: true
735735

736736
- name: Upload build artifacts
737-
uses: actions/upload-artifact@v3
737+
uses: actions/upload-artifact@v4
738738
with:
739739
name: coder
740740
path: |
@@ -775,7 +775,7 @@ jobs:
775775
uses: fluxcd/flux2/action@main
776776
with:
777777
# Keep this up to date with the version of flux installed in dogfood cluster
778-
version: "2.2.0"
778+
version: "2.2.1"
779779

780780
- name: Get Cluster Credentials
781781
uses: "google-github-actions/get-gke-credentials@v2"
@@ -853,7 +853,7 @@ jobs:
853853
uses: google-github-actions/setup-gcloud@v2
854854

855855
- name: Download build artifacts
856-
uses: actions/download-artifact@v3
856+
uses: actions/download-artifact@v4
857857
with:
858858
name: coder
859859
path: ./build

.github/workflows/pr-deploy.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ on:
99
- main
1010
workflow_dispatch:
1111
inputs:
12-
pr_number:
13-
description: "PR number"
14-
type: number
15-
required: true
1612
experiments:
1713
description: "Experiments to enable"
1814
required: false

.github/workflows/release.yaml

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ jobs:
306306
307307
- name: Upload artifacts to actions (if dry-run)
308308
if: ${{ inputs.dry_run }}
309-
uses: actions/upload-artifact@v3
309+
uses: actions/upload-artifact@v4
310310
with:
311311
name: release-artifacts
312312
path: |
@@ -479,66 +479,3 @@ jobs:
479479
# For gh CLI. We need a real token since we're commenting on a PR in a
480480
# different repo.
481481
GH_TOKEN: ${{ secrets.CDRCI_GITHUB_TOKEN }}
482-
483-
publish-chocolatey:
484-
name: Publish to Chocolatey
485-
runs-on: windows-latest
486-
needs: release
487-
if: ${{ !inputs.dry_run }}
488-
489-
steps:
490-
- name: Checkout
491-
uses: actions/checkout@v4
492-
with:
493-
fetch-depth: 0
494-
495-
# Same reason as for release.
496-
- name: Fetch git tags
497-
run: git fetch --tags --force
498-
499-
# From https://chocolatey.org
500-
- name: Install Chocolatey
501-
run: |
502-
Set-ExecutionPolicy Bypass -Scope Process -Force
503-
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
504-
505-
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
506-
507-
- name: Build chocolatey package
508-
run: |
509-
cd scripts/chocolatey
510-
511-
# The package version is the same as the tag minus the leading "v".
512-
# The version in this output already has the leading "v" removed but
513-
# we do it again to be safe.
514-
$version = "${{ needs.release.outputs.version }}".Trim('v')
515-
516-
$release_assets = gh release view --repo coder/coder "v${version}" --json assets | `
517-
ConvertFrom-Json
518-
519-
# Get the URL for the Windows ZIP from the release assets.
520-
$zip_url = $release_assets.assets | `
521-
Where-Object name -Match ".*_windows_amd64.zip$" | `
522-
Select -ExpandProperty url
523-
524-
echo "ZIP URL: ${zip_url}"
525-
echo "Package version: ${version}"
526-
527-
echo "Downloading ZIP..."
528-
Invoke-WebRequest $zip_url -OutFile assets.zip
529-
530-
echo "Extracting ZIP..."
531-
Expand-Archive assets.zip -DestinationPath assets/
532-
533-
# No need to specify nuspec if there's only one in the directory.
534-
choco pack --version=$version binary_path=assets/coder.exe
535-
536-
choco apikey --api-key $env:CHOCO_API_KEY --source https://push.chocolatey.org/
537-
538-
# No need to specify nupkg if there's only one in the directory.
539-
choco push --source https://push.chocolatey.org/
540-
541-
env:
542-
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }}
543-
# We need a GitHub token for the gh CLI to function under GitHub Actions
544-
GH_TOKEN: ${{ secrets.CDRCI_GITHUB_TOKEN }}

.github/workflows/security.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
uses: actions/checkout@v4
3030

3131
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@v2
32+
uses: github/codeql-action/init@v3
3333
with:
3434
languages: go, javascript
3535

@@ -42,7 +42,7 @@ jobs:
4242
rm Makefile
4343
4444
- name: Perform CodeQL Analysis
45-
uses: github/codeql-action/analyze@v2
45+
uses: github/codeql-action/analyze@v3
4646

4747
- name: Send Slack notification on failure
4848
if: ${{ failure() }}
@@ -130,13 +130,13 @@ jobs:
130130
severity: "CRITICAL,HIGH"
131131

132132
- name: Upload Trivy scan results to GitHub Security tab
133-
uses: github/codeql-action/upload-sarif@v2
133+
uses: github/codeql-action/upload-sarif@v3
134134
with:
135135
sarif_file: trivy-results.sarif
136136
category: "Trivy"
137137

138138
- name: Upload Trivy scan results as an artifact
139-
uses: actions/upload-artifact@v3
139+
uses: actions/upload-artifact@v4
140140
with:
141141
name: trivy
142142
path: trivy-results.sarif

.github/workflows/typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ extend-exclude = [
3030
"**/*_test.go",
3131
"**/*.test.tsx",
3232
"**/pnpm-lock.yaml",
33+
"tailnet/testdata/**",
3334
]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ docs/cli.md: scripts/clidocgen/main.go examples/examples.gen.json $(GO_SRC_FILES
588588
CI=true BASE_PATH="." go run ./scripts/clidocgen
589589
pnpm run format:write:only ./docs/cli.md ./docs/cli/*.md ./docs/manifest.json
590590

591-
docs/admin/audit-logs.md: scripts/auditdocgen/main.go enterprise/audit/table.go coderd/rbac/object_gen.go
591+
docs/admin/audit-logs.md: coderd/database/querier.go scripts/auditdocgen/main.go enterprise/audit/table.go coderd/rbac/object_gen.go
592592
go run scripts/auditdocgen/main.go
593593
pnpm run format:write:only ./docs/admin/audit-logs.md
594594

agent/agentscripts/agentscripts.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,18 @@ func (r *Runner) StartCron() {
129129
// has exited by the time the `cron.Stop()` context returns, so we need to
130130
// track it manually.
131131
err := r.trackCommandGoroutine(func() {
132-
r.cron.Run()
132+
// Since this is run async, in quick unit tests, it is possible the
133+
// Close() function gets called before we even start the cron.
134+
// In these cases, the Run() will never end.
135+
// So if we are closed, we just return, and skip the Run() entirely.
136+
select {
137+
case <-r.cronCtx.Done():
138+
// The cronCtx is canceled before cron.Close() happens. So if the ctx is
139+
// canceled, then Close() will be called, or it is about to be called.
140+
// So do nothing!
141+
default:
142+
r.cron.Run()
143+
}
133144
})
134145
if err != nil {
135146
r.Logger.Warn(context.Background(), "start cron failed", slog.Error(err))
@@ -315,6 +326,7 @@ func (r *Runner) Close() error {
315326
return nil
316327
}
317328
close(r.closed)
329+
// Must cancel the cron ctx BEFORE stopping the cron.
318330
r.cronCtxCancel()
319331
<-r.cron.Stop().Done()
320332
r.cmdCloseWait.Wait()

agent/agentscripts/agentscripts_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ func TestTimeout(t *testing.T) {
5353
require.ErrorIs(t, runner.Execute(context.Background(), nil), agentscripts.ErrTimeout)
5454
}
5555

56+
// TestCronClose exists because cron.Run() can happen after cron.Close().
57+
// If this happens, there used to be a deadlock.
58+
func TestCronClose(t *testing.T) {
59+
t.Parallel()
60+
runner := agentscripts.New(agentscripts.Options{})
61+
runner.StartCron()
62+
require.NoError(t, runner.Close(), "close runner")
63+
}
64+
5665
func setup(t *testing.T, patchLogs func(ctx context.Context, req agentsdk.PatchLogs) error) *agentscripts.Runner {
5766
t.Helper()
5867
if patchLogs == nil {

agent/agenttest/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func NewClient(t testing.TB,
2424
agentID uuid.UUID,
2525
manifest agentsdk.Manifest,
2626
statsChan chan *agentsdk.Stats,
27-
coordinator tailnet.Coordinator,
27+
coordinator tailnet.CoordinatorV1,
2828
) *Client {
2929
if manifest.AgentID == uuid.Nil {
3030
manifest.AgentID = agentID
@@ -47,7 +47,7 @@ type Client struct {
4747
manifest agentsdk.Manifest
4848
metadata map[string]agentsdk.Metadata
4949
statsChan chan *agentsdk.Stats
50-
coordinator tailnet.Coordinator
50+
coordinator tailnet.CoordinatorV1
5151
LastWorkspaceAgent func()
5252
PatchWorkspaceLogs func() error
5353
GetServiceBannerFunc func() (codersdk.ServiceBannerConfig, error)

0 commit comments

Comments
 (0)