8000 Merge branch 'main' into main · coder/coder@d21ef3d · GitHub
[go: up one dir, main page]

Skip to content

Commit d21ef3d

Browse files
authored
Merge branch 'main' into main
2 parents 7e0fcb6 + 949ab4b commit d21ef3d

File tree

198 files changed

+8219
-2634
lines changed
  • theme
  • static/icon
  • tailnet
  • vpn
  • Some content is hidden

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

    198 files changed

    +8219
    -2634
    lines changed

    .editorconfig

    Lines changed: 4 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -11,6 +11,10 @@ indent_style = tab
    1111
    indent_style = space
    1212
    indent_size = 2
    1313

    14+
    [*.proto]
    15+
    indent_style = space
    16+
    indent_size = 2
    17+
    1418
    [coderd/database/dump.sql]
    1519
    indent_style = space
    1620
    indent_size = 4

    .github/workflows/ci.yaml

    Lines changed: 8 additions & 8 deletions
    Original file line numberDiff line numberDiff line change
    @@ -187,7 +187,7 @@ jobs:
    187187
    188188
    # Check for any typos
    189189
    - name: Check for typos
    190-
    uses: crate-ci/typos@0f0ccba9ed1df83948f0c15026e4f5ccfce46109 # v1.32.0
    190+
    uses: crate-ci/typos@b1ae8d918b6e85bd611117d3d9a3be4f903ee5e4 # v1.33.1
    191191
    with:
    192192
    config: .github/workflows/typos.toml
    193193

    @@ -582,7 +582,7 @@ jobs:
    582582
    # NOTE: this could instead be defined as a matrix strategy, but we want to
    583583
    # only block merging if tests on postgres 13 fail. Using a matrix strategy
    584584
    # here makes the check in the above `required` job rather complicated.
    585-
    test-go-pg-16:
    585+
    test-go-pg-17:
    586586
    runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
    587587
    needs:
    588588
    - changes
    @@ -613,11 +613,11 @@ jobs:
    613613
    id: download-cache
    614614
    uses: ./.github/actions/test-cache/download
    615615
    with:
    616-
    key-prefix: test-go-pg-16-${{ runner.os }}-${{ runner.arch }}
    616+
    key-prefix: test-go-pg-17-${{ runner.os }}-${{ runner.arch }}
    617617

    618618
    - name: Test with PostgreSQL Database
    619619
    env:
    620-
    POSTGRES_VERSION: "16"
    620+
    POSTGRES_VERSION: "17"
    621621
    TS_DEBUG_DISCO: "true"
    622622
    TEST_RETRIES: 2
    623623
    run: |
    @@ -719,7 +719,7 @@ jobs:
    719719
    # c.f. discussion on https://github.com/coder/coder/pull/15106
    720720
    - name: Run Tests
    721721
    env:
    722-
    POSTGRES_VERSION: "16"
    722+
    POSTGRES_VERSION: "17"
    723723
    run: |
    724724
    make test-postgres-docker
    725725
    DB=ci gotestsum --junitfile="gotests.xml" --packages="./..." --rerun-fails=2 --rerun-fails-abort-on-data-race -- -race -parallel 4 -p 4
    @@ -902,7 +902,7 @@ jobs:
    902902
    # the check to pass. This is desired in PRs, but not in mainline.
    903903
    - name: Publish to Chromatic (non-mainline)
    904904
    if: github.ref != 'refs/heads/main' && github.repository_owner == 'coder'
    905-
    uses: chromaui/action@d7afd50124cf4f337bcd943e7f45cfa85a5e4476 # v12.0.0
    905+
    uses: chromaui/action@8536229ee904071f8edce292596f6dbe0da96b9b # v12.1.1
    906906
    env:
    907907
    NODE_OPTIONS: "--max_old_space_size=4096"
    908908
    STORYBOOK: true
    @@ -934,7 +934,7 @@ jobs:
    934934
    # infinitely "in progress" in mainline unless we re-review each build.
    935935
    - name: Publish to Chromatic (mainline)
    936936
    if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder'
    937-
    uses: chromaui/action@d7afd50124cf4f337bcd943e7f45cfa85a5e4476 # v12.0.0
    937+
    uses: chromaui/action@8536229ee904071f8edce292596f6dbe0da96b9b # v12.1.1
    938938
    env:
    939939
    NODE_OPTIONS: "--max_old_space_size=4096"
    940940
    STORYBOOK: true
    @@ -1526,7 +1526,7 @@ jobs:
    15261526
    uses: google-github-actions/setup-gcloud@77e7a554d41e2ee56fc945c52dfd3f33d12def9a # v2.1.4
    15271527

    15281528
    - name: Set up Flux CLI
    1529-
    uses: fluxcd/flux2/action@8d5f40dca5aa5d3c0fc3414457dda15a0ac92fa4 # v2.5.1
    1529+
    uses: fluxcd/flux2/action@b73c7f7191086ca7629840e680e71873349787f8 # v2.6.1
    15301530
    with:
    15311531
    # Keep this and the github action up to date with the version of flux installed in dogfood cluster
    15321532
    version: "2.5.1"

    .github/workflows/docs-ci.yaml

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -28,7 +28,7 @@ jobs:
    2828
    - name: Setup Node
    2929
    uses: ./.github/actions/setup-node
    3030

    31-
    - uses: tj-actions/changed-files@3981e4f74104e7a4c67a835e1e5dd5d9eb0f0a57 # v45.0.7
    31+
    - uses: tj-actions/changed-files@115870536a85eaf050e369291c7895748ff12aea # v45.0.7
    3232
    id: changed-files
    3333
    with:
    3434
    files: |

    .github/workflows/scorecard.yml

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -30,7 +30,7 @@ jobs:
    3030
    persist-credentials: false
    3131

    3232
    - name: "Run analysis"
    33-
    uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
    33+
    uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
    3434
    with:
    3535
    results_file: results.sarif
    3636
    results_format: sarif
    @@ -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@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
    50+
    uses: github/codeql-action/upload-sarif@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
    5151
    with:
    5252
    sarif_file: results.sarif

    .github/workflows/security.yaml

    Lines changed: 4 additions & 4 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@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
    41+
    uses: github/codeql-action/init@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
    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@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
    51+
    uses: github/codeql-action/analyze@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
    5252

    5353
    - name: Send Slack notification on failure
    5454
    if: ${{ failure() }}
    @@ -142,15 +142,15 @@ jobs:
    142142
    echo "image=$(cat "$image_job")" >> $GITHUB_OUTPUT
    143143
    144144
    - name: Run Trivy vulnerability scanner
    145-
    uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5
    145+
    uses: aquasecurity/trivy-action@76071ef0d7ec797419534a183b498b4d6366cf37
    146146
    with:
    147147
    image-ref: ${{ steps.build.outputs.image }}
    148148
    format: sarif
    149149
    output: trivy-results.sarif
    150150
    severity: "CRITICAL,HIGH"
    151151

    152152
    - name: Upload Trivy scan results to GitHub Security tab
    153-
    uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
    153+
    uses: github/codeql-action/upload-sarif@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
    154154
    with:
    155155
    sarif_file: trivy-results.sarif
    156156
    category: "Trivy"

    CLAUDE.md

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -101,4 +101,4 @@ Read [cursor rules](.cursorrules).
    101101

    102102
    ## Frontend
    103103

    104-
    For building Frontend refer to [this document](docs/contributing/frontend.md)
    104+
    For building Frontend refer to [this document](docs/about/contributing/frontend.md)

    CODE_OF_CONDUCT.md

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -1,2 +1,2 @@
    11
    <!-- markdownlint-disable MD041 -->
    2-
    [https://coder.com/docs/contributing/CODE_OF_CONDUCT](https://coder.com/docs/contributing/CODE_OF_CONDUCT)
    2+
    [https://coder.com/docs/about/contributing/CODE_OF_CONDUCT](https://coder.com/docs/about/contributing/CODE_OF_CONDUCT)

    Makefile

    Lines changed: 6 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -36,7 +36,9 @@ GOOS := $(shell go env GOOS)
    3636
    GOARCH := $(shell go env GOARCH)
    3737
    GOOS_BIN_EXT := $(if $(filter windows, $(GOOS)),.exe,)
    3838
    VERSION := $(shell ./scripts/version.sh)
    39-
    POSTGRES_VERSION ?= 16
    39+
    40+
    POSTGRES_VERSION ?= 17
    41+
    POSTGRES_IMAGE ?= us-docker.pkg.dev/coder-v2-images-public/public/postgres:$(POSTGRES_VERSION)
    4042

    4143
    # Use the highest ZSTD compression level in CI.
    4244
    ifdef CI
    @@ -949,12 +951,12 @@ test-postgres-docker:
    949951
    docker rm -f test-postgres-docker-${POSTGRES_VERSION} || true
    950952

    951953
    # Try pulling up to three times to avoid CI flakes.
    952-
    docker pull gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION} || {
    954+
    docker pull ${POSTGRES_IMAGE} || {
    953955
    retries=2
    954956
    for try in $(seq 1 ${retries}); do
    955957
    echo "Failed to pull image, retrying (${try}/${retries})..."
    956958
    sleep 1
    957-
    if docker pull gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION}; then
    959+
    if docker pull ${POSTGRES_IMAGE}; then
    958960
    break
    959961
    fi
    960962
    done
    @@ -982,7 +984,7 @@ test-postgres-docker:
    982984
    --restart no \
    983985
    --detach \
    984986
    --memory 16GB \
    985-
    gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION} \
    987+
    ${POSTGRES_IMAGE} \
    986988
    -c shared_buffers=2GB \
    987989
    -c effective_cache_size=1GB \
    988990
    -c work_mem=8MB \

    agent/agent.go

    Lines changed: 31 additions & 17 deletions
    Original file line numberDiff line numberDiff line change
    @@ -456,7 +456,7 @@ func (t *trySingleflight) Do(key string, fn func()) {
    456456
    fn()
    457457
    }
    458458

    459-
    func (a *agent) reportMetadata(ctx context.Context, aAPI proto.DRPCAgentClient24) error {
    459+
    func (a *agent) reportMetadata(ctx context.Context, aAPI proto.DRPCAgentClient26) error {
    460460
    tickerDone := make(chan struct{})
    461461
    collectDone := make(chan struct{})
    462462
    ctx, cancel := context.WithCancel(ctx)
    @@ -672,7 +672,7 @@ func (a *agent) reportMetadata(ctx context.Context, aAPI proto.DRPCAgentClient24
    672672

    673673
    // reportLifecycle reports the current lifecycle state once. All state
    674674
    // changes are reported in order.
    675-
    func (a *agent) reportLifecycle(ctx context.Context, aAPI proto.DRPCAgentClient24) error {
    675+
    func (a *agent) reportLifecycle(ctx context.Context, aAPI proto.DRPCAgentClient26) error {
    676676
    for {
    677677
    select {
    678678
    case <-a.lifecycleUpdate:
    @@ -752,7 +752,7 @@ func (a *agent) setLifecycle(state codersdk.WorkspaceAgentLifecycle) {
    752752
    }
    753753

    754754
    // reportConnectionsLoop reports connections to the agent for auditing.
    755-
    func (a *agent) reportConnectionsLoop(ctx context.Context, aAPI proto.DRPCAgentClient24) error {
    755+
    func (a *agent) reportConnectionsLoop(ctx context.Context, aAPI proto.DRPCAgentClient26) error {
    756756
    for {
    757757
    select {
    758758
    case <-a.reportConnectionsUpdate:
    @@ -872,7 +872,7 @@ func (a *agent) reportConnection(id uuid.UUID, connectionType proto.Connection_T
    872872
    // fetchServiceBannerLoop fetches the service banner on an interval. It will
    873873
    // not be fetched immediately; the expectation is that it is primed elsewhere
    874874
    // (and must be done before the session actually starts).
    875-
    func (a *agent) fetchServiceBannerLoop(ctx context.Context, aAPI proto.DRPCAgentClient24) error {
    875+
    func (a *agent) fetchServiceBannerLoop(ctx context.Context, aAPI proto.DRPCAgentClient26) error {
    876876
    ticker := time.NewTicker(a.announcementBannersRefreshInterval)
    877877
    defer ticker.Stop()
    878878
    for {
    @@ -925,7 +925,7 @@ func (a *agent) run() (retErr error) {
    925925
    connMan := newAPIConnRoutineManager(a.gracefulCtx, a.hardCtx, a.logger, aAPI, tAPI)
    926926

    927927
    connMan.startAgentAPI("init notification banners", gracefulShutdownBehaviorStop,
    928-
    func(ctx context.Context, aAPI proto.DRPCAgentClient24) error {
    928+
    func(ctx context.Context, aAPI proto.DRPCAgentClient26) error {
    929929
    bannersProto, err := aAPI.GetAnnouncementBanners(ctx, &proto.GetAnnouncementBannersRequest{})
    930930
    if err != nil {
    931931
    return xerrors.Errorf("fetch service banner: %w", err)
    @@ -942,7 +942,7 @@ func (a *agent) run() (retErr error) {
    942942
    // sending logs gets gracefulShutdownBehaviorRemain because we want to send logs generated by
    943943
    // shutdown scripts.
    944944
    connMan.startAgentAPI("send logs", gracefulShutdownBehaviorRemain,
    945-
    func(ctx context.Context, aAPI proto.DRPCAgentClient24) error {
    945+
    func(ctx context.Context, aAPI proto.DRPCAgentClient26) error {
    946946
    err := a.logSender.SendLoop(ctx, aAPI)
    947947
    if xerrors.Is(err, agentsdk.ErrLogLimitExceeded) {
    948948
    // we don't want this error to tear down the API connection and propagate to the
    @@ -961,7 +961,7 @@ func (a *agent) run() (retErr error) {
    961961
    connMan.startAgentAPI("report metadata", gracefulShutdownBehaviorStop, a.reportMetadata)
    962962

    963963
    // resources monitor can cease as soon as we start gracefully shutting down.
    964-
    connMan.startAgentAPI("resources monitor", gracefulShutdownBehaviorStop, func(ctx context.Context, aAPI proto.DRPCAgentClient24) error {
    964+
    connMan.startAgentAPI("resources monitor", gracefulShutdownBehaviorStop, func(ctx context.Context, aAPI proto.DRPCAgentClient26) error {
    965965
    logger := a.logger.Named("resources_monitor")
    966966
    clk := quartz.NewReal()
    967967
    config, err := aAPI.GetResourcesMonitoringConfiguration(ctx, &proto.GetResourcesMonitoringConfigurationRequest{})
    @@ -1008,7 +1008,7 @@ func (a *agent) run() (retErr error) {
    10081008
    connMan.startAgentAPI("handle manifest", gracefulShutdownBehaviorStop, a.handleManifest(manifestOK))
    10091009

    10101010
    connMan.startAgentAPI("app health reporter", gracefulShutdownBehaviorStop,
    1011-
    func(ctx context.Context, aAPI proto.DRPCAgentClient24) error {
    1011+
    func(ctx context.Context, aAPI proto.DRPCAgentClient26) error {
    10121012
    if err := manifestOK.wait(ctx); err != nil {
    10131013
    return xerrors.Errorf("no manifest: %w", err)
    10141014
    }
    @@ -1041,7 +1041,7 @@ func (a *agent) run() (retErr error) {
    10411041

    10421042
    connMan.startAgentAPI("fetch service banner loop", gracefulShutdownBehaviorStop, a.fetchServiceBannerLoop)
    10431043

    1044-
    connMan.startAgentAPI("stats report loop", gracefulShutdownBehaviorStop, func(ctx context.Context, aAPI proto.DRPCAgentClient24) error {
    1044+
    connMan.startAgentAPI("stats report loop", gracefulShutdownBehaviorStop, func(ctx context.Context, aAPI proto.DRPCAgentClient26) error {
    10451045
    if err := networkOK.wait(ctx); err != nil {
    10461046
    return xerrors.Errorf("no network: %w", err)
    10471047
    }
    @@ -1056,8 +1056,8 @@ func (a *agent) run() (retErr error) {
    10561056
    }
    10571057

    10581058
    // handleManifest returns a function that fetches and processes the manifest
    1059-
    func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context, aAPI proto.DRPCAgentClient24) error {
    1060-
    return func(ctx context.Context, aAPI proto.DRPCAgentClient24) error {
    1059+
    func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context, aAPI proto.DRPCAgentClient26) error {
    1060+
    return func(ctx context.Context, aAPI proto.DRPCAgentClient26) error {
    10611061
    var (
    10621062
    sentResult = false
    10631063
    err error
    @@ -1080,6 +1080,18 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
    10801080
    if manifest.AgentID == uuid.Nil {
    10811081
    return xerrors.New("nil agentID returned by manifest")
    10821082
    }
    1083+
    if manifest.ParentID != uuid.Nil {
    1084+
    // This is a sub agent, disable all the features that should not
    1085+
    // be used by sub agents.
    1086+
    a.logger.Debug(ctx, "sub agent detected, disabling features",
    1087+
    slog.F("parent_id", manifest.ParentID),
    1088+
    slog.F("agent_id", manifest.AgentID),
    1089+
    )
    1090+
    if a.experimentalDevcontainersEnabled {
    1091+
    a.logger.Info(ctx, "devcontainers are not supported on sub agents, disabling feature")
    1092+
    a.experimentalDevcontainersEnabled = false
    1093+
    }
    1094+
    }
    10831095
    a.client.RewriteDERPMap(manifest.DERPMap)
    10841096

    10851097
    // Expand the directory and send it back to coderd so external
    @@ -1187,8 +1199,8 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
    11871199

    11881200
    // createOrUpdateNetwork waits for the manifest to be set using manifestOK, then creates or updates
    11891201
    // the tailnet using the information in the manifest
    1190-
    func (a *agent) createOrUpdateNetwork(manifestOK, networkOK *checkpoint) func(context.Context, proto.DRPCAgentClient24) error {
    1191-
    return func(ctx context.Context, _ proto.DRPCAgentClient24) (retErr error) {
    1202+
    func (a *agent) createOrUpdateNetwork(manifestOK, networkOK *checkpoint) func(context.Context, proto.DRPCAgentClient26) error {
    1203+
    return func(ctx context.Context, aAPI proto.DRPCAgentClient26) (retErr error) {
    11921204
    if err := manifestOK.wait(ctx); err != nil {
    11931205
    return xerrors.Errorf("no manifest: %w", err)
    11941206
    }
    @@ -1208,6 +1220,7 @@ func (a *agent) createOrUpdateNetwork(manifestOK, networkOK *checkpoint) func(co
    12081220
    // agent API.
    12091221
    network, err = a.createTailnet(
    12101222
    a.gracefulCtx,
    1223+
    aAPI,
    12111224
    manifest.AgentID,
    12121225
    manifest.DERPMap,
    12131226
    manifest.DERPForceWebSockets,
    @@ -1355,6 +1368,7 @@ func (a *agent) trackGoroutine(fn func()) error {
    13551368

    13561369
    func (a *agent) createTailnet(
    13571370
    ctx context.Context,
    1371+
    aAPI proto.DRPCAgentClient26,
    13581372
    agentID uuid.UUID,
    13591373
    derpMap *tailcfg.DERPMap,
    13601374
    derpForceWebSockets, disableDirectConnections bool,
    @@ -1487,7 +1501,7 @@ func (a *agent) createTailnet(
    14871501
    }()
    14881502
    if err = a.trackGoroutine(func() {
    14891503
    defer apiListener.Close()
    1490-
    apiHandler, closeAPIHAndler := a.apiHandler()
    1504+
    apiHandler, closeAPIHAndler := a.apiHandler(aAPI)
    14911505
    defer func() {
    14921506
    _ = closeAPIHAndler()
    14931507
    }()
    @@ -1960,7 +1974,7 @@ const (
    19601974

    19611975
    type apiConnRoutineManager struct {
    19621976
    logger slog.Logger
    1963-
    aAPI proto.DRPCAgentClient24
    1977+
    aAPI proto.DRPCAgentClient26
    19641978
    tAPI tailnetproto.DRPCTailnetClient24
    19651979
    eg *errgroup.Group
    19661980
    stopCtx context.Context
    @@ -1969,7 +1983,7 @@ type apiConnRoutineManager struct {
    19691983

    19701984
    func newAPIConnRoutineManager(
    19711985
    gracefulCtx, hardCtx context.Context, logger slog.Logger,
    1972-
    aAPI proto.DRPCAgentClient24, tAPI tailnetproto.DRPCTailnetClient24,
    1986+
    aAPI proto.DRPCAgentClient26, tAPI tailnetproto.DRPCTailnetClient24,
    19731987
    ) *apiConnRoutineManager {
    19741988
    // routines that remain in operation during graceful shutdown use the remainCtx. They'll still
    19751989
    // exit if the errgroup hits an error, which usually means a problem with the conn.
    @@ -2002,7 +2016,7 @@ func newAPIConnRoutineManager(
    20022016
    // but for Tailnet.
    20032017
    func (a *apiConnRoutineManager) startAgentAPI(
    20042018
    name string, behavior gracefulShutdownBehavior,
    2005-
    f func(context.Context, proto.DRPCAgentClient24) error,
    2019+
    f func(context.Context, proto.DRPCAgentClient26) error,
    20062020
    ) {
    20072021
    logger := a.logger.With(slog.F("name", name))
    20082022
    var ctx context.Context

    0 commit comments

    Comments
     (0)
    0