Skip to content

Commit 774e4d5

Browse files
committed
Merge branch 'main' into mes/table-user-groups
2 parents c642ef8 + 21f8731 commit 774e4d5

File tree

121 files changed

+3078
-1869
lines changed

Some content is hidden

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

121 files changed

+3078
-1869
lines changed

.github/actions/setup-sqlc/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ runs:
55
using: "composite"
66
steps:
77
- name: Setup sqlc
8-
uses: sqlc-dev/setup-sqlc@v3
8+
uses: sqlc-dev/setup-sqlc@v4
99
with:
1010
sqlc-version: "1.20.0"

.github/pr-deployments/template/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
22
required_providers {
33
coder = {
4-
source = "coder/coder"
4+
source = "coder/coder"
55
}
66
kubernetes = {
7-
source = "hashicorp/kubernetes"
7+
source = "hashicorp/kubernetes"
88
}
99
}
1010
}
@@ -235,6 +235,9 @@ resource "kubernetes_deployment" "main" {
235235
"app.kubernetes.io/name" = "coder-workspace"
236236
}
237237
}
238+
strategy {
239+
type = "Recreate"
240+
}
238241

239242
template {
240243
metadata {

.github/workflows/ci.yaml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,9 @@ jobs:
291291
gotestsum --junitfile="gotests.xml" --jsonfile="gotests.json" \
292292
--packages="./..." -- $PARALLEL_FLAG -short -failfast $COVERAGE_FLAGS
293293
294-
- name: Print test stats
295-
if: success() || failure()
296-
run: |
297-
# Artifacts are not available after rerunning a job,
298-
# so we need to print the test stats to the log.
299-
go run ./scripts/ci-report/main.go gotests.json | tee gotests_stats.json
300-
301294
- name: Upload test stats to Datadog
295+
timeout-minutes: 1
296+
continue-on-error: true
302297
uses: ./.github/actions/upload-datadog
303298
if: success() || failure()
304299
with:
@@ -343,14 +338,9 @@ jobs:
343338
export TS_DEBUG_DISCO=true
344339
make test-postgres
345340
346-
- name: Print test stats
347-
if: success() || failure()
348-
run: |
349-
# Artifacts are not available after rerunning a job,
350-
# so we need to print the test stats to the log.
351-
go run ./scripts/ci-report/main.go gotests.json | tee gotests_stats.json
352-
353341
- name: Upload test stats to Datadog
342+
timeout-minutes: 1
343+
continue-on-error: true
354344
uses: ./.github/actions/upload-datadog
355345
if: success() || failure()
356346
with:
@@ -391,6 +381,8 @@ jobs:
391381
gotestsum --junitfile="gotests.xml" -- -race ./...
392382
393383
- name: Upload test stats to Datadog
384+
timeout-minutes: 1
385+
continue-on-error: true
394386
uses: ./.github/actions/upload-datadog
395387
if: always()
396388
with:

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@ lint: lint/shellcheck lint/go lint/ts lint/helm lint/site-icons
419419

420420
lint/site-icons:
421421
./scripts/check_site_icons.sh
422-
423422
.PHONY: lint/site-icons
424423

425424
lint/ts:
@@ -517,6 +516,8 @@ coderd/database/dump.sql: coderd/database/gen/dump/main.go $(wildcard coderd/dat
517516
go run ./coderd/database/gen/dump/main.go
518517

519518
# Generates Go code for querying the database.
519+
# coderd/database/queries.sql.go
520+
# coderd/database/models.go
520521
coderd/database/querier.go: coderd/database/sqlc.yaml coderd/database/dump.sql $(wildcard coderd/database/queries/*.sql)
521522
./coderd/database/generate.sh
522523

@@ -539,19 +540,18 @@ provisionerd/proto/provisionerd.pb.go: provisionerd/proto/provisionerd.proto
539540
--go-drpc_opt=paths=source_relative \
540541
./provisionerd/proto/provisionerd.proto
541542

542-
site/src/api/typesGenerated.ts: scripts/apitypings/main.go $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
543-
go run ./scripts/apitypings/ > site/src/api/typesGenerated.ts
544-
cd site
545-
pnpm run format:types ./src/api/typesGenerated.ts
543+
site/src/api/typesGenerated.ts: $(wildcard scripts/apitypings/*) $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
544+
go run ./scripts/apitypings/ > $@
545+
pnpm run format:write:only "$@"
546546

547547
site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
548548
cd site
549549
../scripts/pnpm_install.sh
550550
pnpm run gen:provisioner
551551

552-
site/src/theme/icons.json: $(wildcard site/static/icon/*)
553-
go run ./scripts/gensite/ -icons $@
554-
pnpm run format:write:only $@
552+
site/src/theme/icons.json: $(wildcard scripts/gensite/*) $(wildcard site/static/icon/*)
553+
go run ./scripts/gensite/ -icons "$@"
554+
pnpm run format:write:only "$@"
555555

556556
examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(shell find ./examples/templates)
557557
go run ./scripts/examplegen/main.go > examples/examples.gen.json

cli/server.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ import (
4141
"github.com/prometheus/client_golang/prometheus"
4242
"github.com/prometheus/client_golang/prometheus/collectors"
4343
"github.com/prometheus/client_golang/prometheus/promhttp"
44+
"go.opentelemetry.io/otel"
45+
"go.opentelemetry.io/otel/propagation"
4446
"go.opentelemetry.io/otel/trace"
4547
"golang.org/x/mod/semver"
4648
"golang.org/x/oauth2"
@@ -78,6 +80,7 @@ import (
7880
"github.com/coder/coder/v2/coderd/httpmw"
7981
"github.com/coder/coder/v2/coderd/oauthpki"
8082
"github.com/coder/coder/v2/coderd/prometheusmetrics"
83+
"github.com/coder/coder/v2/coderd/prometheusmetrics/insights"
8184
"github.com/coder/coder/v2/coderd/schedule"
8285
"github.com/coder/coder/v2/coderd/telemetry"
8386
"github.com/coder/coder/v2/coderd/tracing"
@@ -198,6 +201,21 @@ func enablePrometheus(
198201
}
199202
afterCtx(ctx, closeWorkspacesFunc)
200203

204+
insightsMetricsCollector, err := insights.NewMetricsCollector(options.Database, options.Logger, 0, 0)
205+
if err != nil {
206+
return nil, xerrors.Errorf("unable to initialize insights metrics collector: %w", err)
207+
}
208+
err = options.PrometheusRegistry.Register(insightsMetricsCollector)
209+
if err != nil {
210+
return nil, xerrors.Errorf("unable to register insights metrics collector: %w", err)
211+
}
212+
213+
closeInsightsMetricsCollector, err := insightsMetricsCollector.Run(ctx)
214+
if err != nil {
215+
return nil, xerrors.Errorf("unable to run insights metrics collector: %w", err)
216+
}
217+
afterCtx(ctx, closeInsightsMetricsCollector)
218+
201219
if vals.Prometheus.CollectAgentStats {
202220
closeAgentStatsFunc, err := prometheusmetrics.AgentStats(ctx, logger, options.PrometheusRegistry, options.Database, time.Now(), 0)
203221
if err != nil {
@@ -938,7 +956,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
938956
autobuildTicker := time.NewTicker(vals.AutobuildPollInterval.Value())
939957
defer autobuildTicker.Stop()
940958
autobuildExecutor := autobuild.NewExecutor(
941-
ctx, options.Database, options.Pubsub, coderAPI.TemplateScheduleStore, &coderAPI.Auditor, logger, autobuildTicker.C)
959+
ctx, options.Database, options.Pubsub, coderAPI.TemplateScheduleStore, &coderAPI.Auditor, coderAPI.AccessControlStore, logger, autobuildTicker.C)
942960
autobuildExecutor.Run()
943961

944962
hangDetectorTicker := time.NewTicker(vals.JobHangDetectorInterval.Value())
@@ -2020,6 +2038,13 @@ func ConfigureTraceProvider(
20202038
sqlDriver = "postgres"
20212039
)
20222040

2041+
otel.SetTextMapPropagator(
2042+
propagation.NewCompositeTextMapPropagator(
2043+
propagation.TraceContext{},
2044+
propagation.Baggage{},
2045+
),
2046+
)
2047+
20232048
if cfg.Trace.Enable.Value() || cfg.Trace.DataDog.Value() || cfg.Trace.HoneycombAPIKey != "" {
20242049
sdkTracerProvider, _closeTracing, err := tracing.TracerProvider(ctx, "coderd", tracing.TracerOpts{
20252050
Default: cfg.Trace.Enable.Value(),

cli/templates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ package cli
33
import (
44
"time"
55

6-
"github.com/coder/pretty"
76
"github.com/google/uuid"
87
"golang.org/x/xerrors"
98

109
"github.com/coder/coder/v2/cli/clibase"
1110
"github.com/coder/coder/v2/cli/cliui"
1211
"github.com/coder/coder/v2/codersdk"
12+
"github.com/coder/pretty"
1313
)
1414

1515
func (r *RootCmd) templates() *clibase.Cmd {

cli/templateversionarchive.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import (
66
"strings"
77
"time"
88

9-
"github.com/coder/pretty"
109
"golang.org/x/xerrors"
1110

1211
"github.com/coder/coder/v2/cli/clibase"
1312
"github.com/coder/coder/v2/cli/cliui"
1413
"github.com/coder/coder/v2/codersdk"
14+
"github.com/coder/pretty"
1515
)
1616

1717
func (r *RootCmd) unarchiveTemplateVersion() *clibase.Cmd {

cli/templateversions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import (
55
"strings"
66
"time"
77

8-
"github.com/coder/pretty"
98
"github.com/google/uuid"
109
"golang.org/x/xerrors"
1110

1211
"github.com/coder/coder/v2/cli/clibase"
1312
"github.com/coder/coder/v2/cli/cliui"
1413
"github.com/coder/coder/v2/codersdk"
14+
"github.com/coder/pretty"
1515
)
1616

1717
func (r *RootCmd) templateVersions() *clibase.Cmd {

cli/user_delete_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ func TestUserDelete(t *testing.T) {
121121
// pw, err := cryptorand.String(16)
122122
// require.NoError(t, err)
123123

124-
// fmt.Println(aUser.OrganizationID)
125124
// toDelete, err := client.CreateUser(ctx, codersdk.CreateUserRequest{
126125
// Email: "colin5@coder.com",
127126
// Username: "coolin",

coderd/apidoc/docs.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)