Skip to content

Commit 4ab2314

Browse files
committed
Merge remote-tracking branch 'origin/main' into cj/workspacetraffic-prometheus
2 parents 6734521 + b6604e8 commit 4ab2314

File tree

195 files changed

+9113
-2951
lines changed

Some content is hidden

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

195 files changed

+9113
-2951
lines changed

.github/workflows/ci.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
- main
77

88
pull_request:
9-
109
workflow_dispatch:
1110

1211
permissions:
@@ -27,6 +26,9 @@ concurrency:
2726
group: ${{ github.workflow }}-${{ github.ref }}
2827
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2928

29+
env:
30+
CODER_GO_VERSION: "~1.20"
31+
3032
jobs:
3133
lint:
3234
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
@@ -37,11 +39,11 @@ jobs:
3739
# Install Go!
3840
- uses: actions/setup-go@v4
3941
with:
40-
go-version: "~1.20"
42+
go-version: ${{ env.CODER_GO_VERSION }}
4143

4244
# Check for any typos!
4345
- name: Check for typos
44-
uses: crate-ci/typos@v1.14.8
46+
uses: crate-ci/typos@v1.14.10
4547
with:
4648
config: .github/workflows/typos.toml
4749
- name: Fix the typos
@@ -153,7 +155,7 @@ jobs:
153155
- uses: actions/setup-go@v4
154156
with:
155157
cache: false
156-
go-version: "~1.20"
158+
go-version: ${{ env.CODER_GO_VERSION }}
157159

158160
- name: Echo Go Cache Paths
159161
id: go-cache-paths
@@ -184,6 +186,8 @@ jobs:
184186
run: go install golang.org/x/tools/cmd/goimports@latest
185187
- name: Install yq
186188
run: go run github.com/mikefarah/yq/v4@v4.30.6
189+
- name: Install mockgen
190+
run: go install github.com/golang/mock/mockgen@v1.6.0
187191

188192
- name: Install Protoc
189193
run: |
@@ -254,7 +258,7 @@ jobs:
254258
- uses: actions/setup-go@v4
255259
with:
256260
cache: false
257-
go-version: "~1.20"
261+
go-version: ${{ env.CODER_GO_VERSION }}
258262

259263
- name: Echo Go Cache Paths
260264
id: go-cache-paths
@@ -343,7 +347,7 @@ jobs:
343347
- uses: actions/setup-go@v4
344348
with:
345349
cache: false
346-
go-version: "~1.20"
350+
go-version: ${{ env.CODER_GO_VERSION }}
347351

348352
- name: Echo Go Cache Paths
349353
id: go-cache-paths
@@ -435,7 +439,7 @@ jobs:
435439
- uses: actions/setup-go@v4
436440
with:
437441
cache: false
438-
go-version: "~1.20"
442+
go-version: ${{ env.CODER_GO_VERSION }}
439443

440444
- name: Echo Go Cache Paths
441445
id: go-cache-paths
@@ -587,7 +591,7 @@ jobs:
587591
- uses: actions/setup-go@v4
588592
with:
589593
cache: false
590-
go-version: "~1.20"
594+
go-version: ${{ env.CODER_GO_VERSION }}
591595

592596
- uses: hashicorp/setup-terraform@v2
593597
with:

.github/workflows/release.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ on:
66
- "v*"
77
workflow_dispatch:
88
inputs:
9+
# For some reason, setup-go won't actually pick up a new patch version if
10+
# it has an old one cached. We need to manually specify the versions so we
11+
# can get the latest release. Never use "~1.xx" here!
12+
go_version:
13+
description: "Go version to use for building."
14+
required: false
15+
default: "1.20.4"
916
dry_run:
1017
description: Perform a dry-run release (devel). Note that ref must be an annotated tag when run without dry-run.
1118
type: boolean
@@ -92,7 +99,7 @@ jobs:
9299

93100
- uses: actions/setup-go@v4
94101
with:
95-
go-version: "~1.20"
102+
go-version: ${{ inputs.go_version }}
96103

97104
- name: Cache Node
98105
id: cache-node

.github/workflows/security.yaml

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ concurrency:
1818
group: ${{ github.workflow }}-${{ github.ref }}-security
1919
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2020

21+
env:
22+
CODER_GO_VERSION: "1.20.4"
23+
2124
jobs:
2225
codeql:
2326
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
@@ -32,18 +35,7 @@ jobs:
3235
- name: Setup Go
3336
uses: actions/setup-go@v4
3437
with:
35-
go-version: "~1.20"
36-
37-
- name: Go Cache Paths
38-
id: go-cache-paths
39-
run: |
40-
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
41-
42-
- name: Go Mod Cache
43-
uses: actions/cache@v3
44-
with:
45-
path: ${{ steps.go-cache-paths.outputs.GOMODCACHE }}
46-
key: ${{ runner.os }}-release-go-mod-${{ hashFiles('**/go.sum') }}
38+
go-version: ${{ env.CODER_GO_VERSION }}
4739

4840
# Workaround to prevent CodeQL from building the dashboard.
4941
- name: Remove Makefile
@@ -73,18 +65,7 @@ jobs:
7365

7466
- uses: actions/setup-go@v4
7567
with:
76-
go-version: "~1.20"
77-
78-
- name: Go Cache Paths
79-
id: go-cache-paths
80-
run: |
81-
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
82-
83-
- name: Go Mod Cache
84-
uses: actions/cache@v3
85-
with:
86-
path: ${{ steps.go-cache-paths.outputs.GOMODCACHE }}
87-
key: ${{ runner.os }}-release-go-mod-${{ hashFiles('**/go.sum') }}
68+
go-version: ${{ env.CODER_GO_VERSION }}
8869

8970
- name: Cache Node
9071
id: cache-node
@@ -102,6 +83,8 @@ jobs:
10283
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
10384
- name: Install yq
10485
run: go run github.com/mikefarah/yq/v4@v4.30.6
86+
- name: Install mockgen
87+
run: go install github.com/golang/mock/mockgen@v1.6.0
10588
- name: Install protoc-gen-go
10689
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
10790
- name: Install protoc-gen-go-drpc

.github/workflows/stale.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Checkout repository
3939
uses: actions/checkout@v2
4040
- name: Run delete-old-branches-action
41-
uses: beatlabs/delete-old-branches-action@v0.0.9
41+
uses: beatlabs/delete-old-branches-action@v0.0.10
4242
with:
4343
repo_token: ${{ github.token }}
4444
date: "6 months ago"

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ lint/shellcheck: $(SHELL_SRC_FILES)
420420
gen: \
421421
coderd/database/dump.sql \
422422
coderd/database/querier.go \
423+
coderd/database/dbmock/store.go \
423424
provisionersdk/proto/provisioner.pb.go \
424425
provisionerd/proto/provisionerd.pb.go \
425426
site/src/api/typesGenerated.ts \
@@ -441,6 +442,7 @@ gen/mark-fresh:
441442
files="\
442443
coderd/database/dump.sql \
443444
coderd/database/querier.go \
445+
coderd/database/dbmock/store.go \
444446
provisionersdk/proto/provisioner.pb.go \
445447
provisionerd/proto/provisionerd.pb.go \
446448
site/src/api/typesGenerated.ts \
@@ -476,6 +478,10 @@ coderd/database/dump.sql: coderd/database/gen/dump/main.go $(wildcard coderd/dat
476478
coderd/database/querier.go: coderd/database/sqlc.yaml coderd/database/dump.sql $(wildcard coderd/database/queries/*.sql) coderd/database/gen/enum/main.go
477479
./coderd/database/generate.sh
478480

481+
482+
coderd/database/dbmock/store.go: coderd/database/db.go coderd/database/querier.go
483+
go generate ./coderd/database/dbmock/
484+
479485
provisionersdk/proto/provisioner.pb.go: provisionersdk/proto/provisioner.proto
480486
protoc \
481487
--go_out=. \

agent/agent.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ type Options struct {
6262
IgnorePorts map[int]string
6363
SSHMaxTimeout time.Duration
6464
TailnetListenPort uint16
65+
Subsystem codersdk.AgentSubsystem
6566
}
6667

6768
type Client interface {
@@ -119,6 +120,7 @@ func New(options Options) Agent {
119120
ignorePorts: options.IgnorePorts,
120121
connStatsChan: make(chan *agentsdk.Stats, 1),
121122
sshMaxTimeout: options.SSHMaxTimeout,
123+
subsystem: options.Subsystem,
122124
}
123125
a.init(ctx)
124126
return a
@@ -136,6 +138,7 @@ type agent struct {
136138
// listing all listening ports. This is helpful to hide ports that
137139
// are used by the agent, that the user does not care about.
138140
ignorePorts map[int]string
141+
subsystem codersdk.AgentSubsystem
139142

140143
reconnectingPTYs sync.Map
141144
reconnectingPTYTimeout time.Duration
@@ -488,6 +491,7 @@ func (a *agent) run(ctx context.Context) error {
488491
err = a.client.PostStartup(ctx, agentsdk.PostStartupRequest{
489492
Version: buildinfo.Version(),
490493
ExpandedDirectory: manifest.Directory,
494+
Subsystem: a.subsystem,
491495
})
492496
if err != nil {
493497
return xerrors.Errorf("update workspace agent version: %w", err)
@@ -1455,3 +1459,8 @@ func expandDirectory(dir string) (string, error) {
14551459
}
14561460
return dir, nil
14571461
}
1462+
1463+
// EnvAgentSubsystem is the environment variable used to denote the
1464+
// specialized environment in which the agent is running
1465+
// (e.g. envbox, envbuilder).
1466+
const EnvAgentSubsystem = "CODER_AGENT_SUBSYSTEM"

0 commit comments

Comments
 (0)