Skip to content

Commit 038138d

Browse files
committed
Merge remote-tracking branch 'origin/audit-login-logout/kira-pilot' into audit-logout/kira-pilot
2 parents d164467 + b19ae71 commit 038138d

File tree

278 files changed

+7528
-2627
lines changed

Some content is hidden

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

278 files changed

+7528
-2627
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ RUN mkdir -p /etc/apt/keyrings \
5757
&& echo '{"cgroup-parent":"/actions_job","storage-driver":"vfs"}' >> /etc/docker/daemon.json
5858

5959
# install golang and language tooling
60-
ENV GO_VERSION=1.19
60+
ENV GO_VERSION=1.20
6161
ENV GOPATH=$HOME/go-packages
6262
ENV GOROOT=$HOME/go
6363
ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH

.github/workflows/ci.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ concurrency:
2929

3030
jobs:
3131
lint:
32-
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
32+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
3333
steps:
3434
- name: Checkout
3535
uses: actions/checkout@v3
3636

3737
# Install Go!
3838
- uses: actions/setup-go@v3
3939
with:
40-
go-version: "~1.19"
40+
go-version: "~1.20"
4141

4242
# Check for any typos!
4343
- name: Check for typos
@@ -55,10 +55,10 @@ jobs:
5555
- name: Lint Go
5656
uses: golangci/golangci-lint-action@v3.3.1
5757
with:
58-
version: v1.48.0
58+
version: v1.51.0
5959

6060
- name: Lint shell scripts
61-
uses: ludeeus/action-shellcheck@1.1.0
61+
uses: ludeeus/action-shellcheck@2.0.0
6262
env:
6363
SHELLCHECK_OPTS: --external-sources
6464
with:
@@ -129,7 +129,7 @@ jobs:
129129
130130
gen:
131131
timeout-minutes: 8
132-
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
132+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
133133
needs: changes
134134
if: needs.changes.outputs.docs-only == 'false'
135135
steps:
@@ -151,7 +151,7 @@ jobs:
151151

152152
- uses: actions/setup-go@v3
153153
with:
154-
go-version: "~1.19"
154+
go-version: "~1.20"
155155

156156
- name: Echo Go Cache Paths
157157
id: go-cache-paths
@@ -237,7 +237,7 @@ jobs:
237237
run: ./scripts/check_unstaged.sh
238238

239239
test-go:
240-
runs-on: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'windows-latest-8-cores'|| matrix.os }}
240+
runs-on: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'windows-latest-8-cores'|| matrix.os }}
241241
timeout-minutes: 20
242242
strategy:
243243
matrix:
@@ -250,7 +250,7 @@ jobs:
250250

251251
- uses: actions/setup-go@v3
252252
with:
253-
go-version: "~1.19"
253+
go-version: "~1.20"
254254

255255
# Sadly the new "set output" syntax (of writing env vars to
256256
# $GITHUB_OUTPUT) does not work on both powershell and bash so we use the
@@ -322,7 +322,7 @@ jobs:
322322
flags: unittest-go-${{ matrix.os }}
323323

324324
test-go-psql:
325-
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
325+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
326326
# This timeout must be greater than the timeout set by `go test` in
327327
# `make test-postgres` to ensure we receive a trace of running
328328
# goroutines. Setting this to the timeout +5m should work quite well
@@ -333,7 +333,7 @@ jobs:
333333

334334
- uses: actions/setup-go@v3
335335
with:
336-
go-version: "~1.19"
336+
go-version: "~1.20"
337337

338338
- name: Echo Go Cache Paths
339339
id: go-cache-paths
@@ -391,7 +391,7 @@ jobs:
391391

392392
deploy:
393393
name: "deploy"
394-
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
394+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
395395
timeout-minutes: 30
396396
needs: changes
397397
if: |
@@ -416,7 +416,7 @@ jobs:
416416

417417
- uses: actions/setup-go@v3
418418
with:
419-
go-version: "~1.19"
419+
go-version: "~1.20"
420420

421421
- name: Echo Go Cache Paths
422422
id: go-cache-paths
@@ -487,7 +487,7 @@ jobs:
487487
retention-days: 7
488488

489489
test-js:
490-
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
490+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
491491
timeout-minutes: 20
492492
steps:
493493
- uses: actions/checkout@v3
@@ -529,7 +529,7 @@ jobs:
529529
needs:
530530
- changes
531531
if: needs.changes.outputs.docs-only == 'false'
532-
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
532+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
533533
timeout-minutes: 20
534534
steps:
535535
- uses: actions/checkout@v3
@@ -545,7 +545,7 @@ jobs:
545545

546546
- uses: actions/setup-go@v3
547547
with:
548-
go-version: "~1.19"
548+
go-version: "~1.20"
549549

550550
- uses: hashicorp/setup-terraform@v2
551551
with:

.github/workflows/dogfood.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
password: ${{ secrets.DOCKERHUB_PASSWORD }}
4141

4242
- name: Build and push
43-
uses: docker/build-push-action@v3
43+
uses: docker/build-push-action@v4
4444
with:
4545
context: "{{defaultContext}}:dogfood"
4646
push: true

.github/workflows/release.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ env:
3232
jobs:
3333
release:
3434
name: Build and publish
35-
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
35+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
3636
env:
3737
# Necessary for Docker manifest
3838
DOCKER_CLI_EXPERIMENTAL: "enabled"
@@ -91,7 +91,7 @@ jobs:
9191

9292
- uses: actions/setup-go@v3
9393
with:
94-
go-version: "~1.19"
94+
go-version: "~1.20"
9595

9696
- name: Cache Node
9797
id: cache-node
@@ -214,7 +214,7 @@ jobs:
214214
./build/*.rpm
215215
env:
216216
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
217-
CODER_GPG_RELEASE_KEY_BASE64: ${{ secrets.CODER_GPG_RELEASE_KEY_BASE64 }}
217+
CODER_GPG_RELEASE_KEY_BASE64: ${{ secrets.GPG_RELEASE_KEY_BASE64 }}
218218

219219
- name: Authenticate to Google Cloud
220220
uses: google-github-actions/auth@v1
@@ -333,3 +333,11 @@ jobs:
333333
# For gh CLI. We need a real token since we're commenting on a PR in a
334334
# different repo.
335335
GH_TOKEN: ${{ secrets.CDRCI_GITHUB_TOKEN }}
336+
337+
- name: Start Packer builds
338+
uses: peter-evans/repository-dispatch@v2
339+
with:
340+
token: ${{ secrets.CDRCI_GITHUB_TOKEN }}
341+
repository: coder/packages
342+
event-type: coder-release
343+
client-payload: '{"coder_version": "${{ needs.release.outputs.version }}"}'

.github/workflows/security.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ concurrency:
2626

2727
jobs:
2828
codeql:
29-
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
29+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
3030
steps:
3131
- uses: actions/checkout@v3
3232

@@ -38,7 +38,7 @@ jobs:
3838
- name: Setup Go
3939
uses: actions/setup-go@v3
4040
with:
41-
go-version: "~1.19"
41+
go-version: "~1.20"
4242

4343
- name: Go Cache Paths
4444
id: go-cache-paths
@@ -60,15 +60,15 @@ jobs:
6060
uses: github/codeql-action/analyze@v2
6161

6262
trivy:
63-
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
63+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
6464
steps:
6565
- uses: actions/checkout@v3
6666
with:
6767
fetch-depth: 0
6868

6969
- uses: actions/setup-go@v3
7070
with:
71-
go-version: "~1.19"
71+
go-version: "~1.20"
7272

7373
- name: Go Cache Paths
7474
id: go-cache-paths
@@ -101,7 +101,7 @@ jobs:
101101
echo "image=$(cat "$image_job")" >> $GITHUB_OUTPUT
102102
103103
- name: Run Trivy vulnerability scanner
104-
uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe
104+
uses: aquasecurity/trivy-action@9ab158e8597f3b310480b9a69402b419bc03dbd5
105105
with:
106106
image-ref: ${{ steps.build.outputs.image }}
107107
format: sarif

.github/workflows/typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ MacOS = "macOS"
66
AKS = "AKS"
77

88
[default.extend-words]
9+
AKS = "AKS"
910
# do as sudo replacement
1011
doas = "doas"
1112
darcula = "darcula"

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,8 @@ test-postgres-docker:
610610
-c max_connections=1000 \
611611
-c fsync=off \
612612
-c synchronous_commit=off \
613-
-c full_page_writes=off
613+
-c full_page_writes=off \
614+
-c log_statement=all
614615
while ! pg_isready -h 127.0.0.1
615616
do
616617
echo "$(date) - waiting for database to start"

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
<div align="center">
2-
<img src="./docs/images/logo.png" style="width: 128px">
2+
<a href="https://coder.com#gh-light-mode-only">
3+
<img src="./docs/images/logo-black.png" style="width: 128px">
4+
</a>
5+
<a href="https://coder.com#gh-dark-mode-only">
6+
<img src="./docs/images/logo-white.png" style="width: 128px">
7+
</a>
38

49
<h1>
510
Self-Hosted Remote Development Environments
611
</h1>
712

8-
<img src="./docs/images/banner.png" style="width: 650px">
13+
<a href="https://coder.com#gh-light-mode-only">
14+
<img src="./docs/images/banner-black.png" style="width: 650px">
15+
</a>
16+
<a href="https://coder.com#gh-dark-mode-only">
17+
<img src="./docs/images/banner-white.png" style="width: 650px">
18+
</a>
919

1020
<br>
1121
<br>
@@ -14,7 +24,7 @@
1424

1525
[![discord](https://img.shields.io/discord/747933592273027093?label=discord)](https://discord.gg/coder)
1626
[![codecov](https://codecov.io/gh/coder/coder/branch/main/graph/badge.svg?token=TNLW3OAP6G)](https://codecov.io/gh/coder/coder)
17-
[![release](https://img.shields.io/github/v/release/coder/coder)](https://github.com/coder/coder/releases)
27+
[![release](https://img.shields.io/github/v/release/coder/coder)](https://github.com/coder/coder/releases/latest)
1828
[![godoc](https://pkg.go.dev/badge/github.com/coder/coder.svg)](https://pkg.go.dev/github.com/coder/coder)
1929
[![Go Report Card](https://goreportcard.com/badge/github.com/coder/coder)](https://goreportcard.com/report/github.com/coder/coder)
2030
[![license](https://img.shields.io/github/license/coder/coder)](./LICENSE)

agent/agent.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,13 @@ func (a *agent) run(ctx context.Context) error {
268268

269269
scriptDone := make(chan error, 1)
270270
scriptStart := time.Now()
271-
go func() {
271+
err := a.trackConnGoroutine(func() {
272272
defer close(scriptDone)
273273
scriptDone <- a.runStartupScript(ctx, metadata.StartupScript)
274-
}()
274+
})
275+
if err != nil {
276+
return xerrors.Errorf("track startup script: %w", err)
277+
}
275278
go func() {
276279
var timeout <-chan time.Time
277280
// If timeout is zero, an older version of the coder
@@ -526,23 +529,23 @@ func (a *agent) createTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) (_
526529
return nil, err
527530
}
528531

529-
statisticsListener, err := network.Listen("tcp", ":"+strconv.Itoa(codersdk.WorkspaceAgentStatisticsPort))
532+
apiListener, err := network.Listen("tcp", ":"+strconv.Itoa(codersdk.WorkspaceAgentHTTPAPIServerPort))
530533
if err != nil {
531-
return nil, xerrors.Errorf("listen for statistics: %w", err)
534+
return nil, xerrors.Errorf("api listener: %w", err)
532535
}
533536
defer func() {
534537
if err != nil {
535-
_ = statisticsListener.Close()
538+
_ = apiListener.Close()
536539
}
537540
}()
538541
if err = a.trackConnGoroutine(func() {
539-
defer statisticsListener.Close()
542+
defer apiListener.Close()
540543
server := &http.Server{
541-
Handler: a.statisticsHandler(),
544+
Handler: a.apiHandler(),
542545
ReadTimeout: 20 * time.Second,
543546
ReadHeaderTimeout: 20 * time.Second,
544547
WriteTimeout: 20 * time.Second,
545-
ErrorLog: slog.Stdlib(ctx, a.logger.Named("statistics_http_server"), slog.LevelInfo),
548+
ErrorLog: slog.Stdlib(ctx, a.logger.Named("http_api_server"), slog.LevelInfo),
546549
}
547550
go func() {
548551
select {
@@ -552,9 +555,9 @@ func (a *agent) createTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) (_
552555
_ = server.Close()
553556
}()
554557

555-
err := server.Serve(statisticsListener)
558+
err := server.Serve(apiListener)
556559
if err != nil && !xerrors.Is(err, http.ErrServerClosed) && !strings.Contains(err.Error(), "use of closed network connection") {
557-
a.logger.Critical(ctx, "serve statistics HTTP server", slog.Error(err))
560+
a.logger.Critical(ctx, "serve HTTP API server", slog.Error(err))
558561
}
559562
}); err != nil {
560563
return nil, err

agent/agent_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ func TestAgent_TCPLocalForwarding(t *testing.T) {
305305
}
306306
}()
307307

308-
cmd := setupSSHCommand(t, []string{"-L", fmt.Sprintf("%d:127.0.0.1:%d", randomPort, remotePort)}, []string{"sleep", "10"})
308+
cmd := setupSSHCommand(t, []string{"-L", fmt.Sprintf("%d:127.0.0.1:%d", randomPort, remotePort)}, []string{"sleep", "5"})
309309
err = cmd.Start()
310310
require.NoError(t, err)
311311

@@ -372,7 +372,7 @@ func TestAgent_TCPRemoteForwarding(t *testing.T) {
372372
}
373373
}()
374374

375-
cmd := setupSSHCommand(t, []string{"-R", fmt.Sprintf("127.0.0.1:%d:127.0.0.1:%d", randomPort, localPort)}, []string{"sleep", "10"})
375+
cmd := setupSSHCommand(t, []string{"-R", fmt.Sprintf("127.0.0.1:%d:127.0.0.1:%d", randomPort, localPort)}, []string{"sleep", "5"})
376376
err = cmd.Start()
377377
require.NoError(t, err)
378378

@@ -437,7 +437,7 @@ func TestAgent_UnixLocalForwarding(t *testing.T) {
437437
}
438438
}()
439439

440-
cmd := setupSSHCommand(t, []string{"-L", fmt.Sprintf("%s:%s", localSocketPath, remoteSocketPath)}, []string{"sleep", "10"})
440+
cmd := setupSSHCommand(t, []string{"-L", fmt.Sprintf("%s:%s", localSocketPath, remoteSocketPath)}, []string{"sleep", "5"})
441441
err = cmd.Start()
442442
require.NoError(t, err)
443443

@@ -495,7 +495,7 @@ func TestAgent_UnixRemoteForwarding(t *testing.T) {
495495
}
496496
}()
497497

498-
cmd := setupSSHCommand(t, []string{"-R", fmt.Sprintf("%s:%s", remoteSocketPath, localSocketPath)}, []string{"sleep", "10"})
498+
cmd := setupSSHCommand(t, []string{"-R", fmt.Sprintf("%s:%s", remoteSocketPath, localSocketPath)}, []string{"sleep", "5"})
499499
err = cmd.Start()
500500
require.NoError(t, err)
501501

@@ -703,7 +703,7 @@ func TestAgent_Lifecycle(t *testing.T) {
703703
t.Parallel()
704704

705705
_, client, _, _ := setupAgent(t, agentsdk.Metadata{
706-
StartupScript: "sleep 10",
706+
StartupScript: "sleep 5",
707707
StartupScriptTimeout: time.Nanosecond,
708708
}, 0)
709709

0 commit comments

Comments
 (0)