10000 Merge remote-tracking branch 'origin/main' into yevhenii/prebuilds-au… · coder/coder@99d76e5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 99d76e5

Browse files
Merge remote-tracking branch 'origin/main' into yevhenii/prebuilds-autoscaling-mechanism
2 parents 0565fb7 + acf7d86 commit 99d76e5
  • wsbuilder
  • codersdk
  • docs
  • dogfood/coder
  • enterprise
  • provisioner/terraform
  • provisionerd
  • provisionersdk
  • scaletest
  • site
  • tailnet/test/integration
  • Some content is hidden

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

    167 files changed

    +4907
    -1211
    lines changed

    .github/workflows/ci.yaml

    Lines changed: 4 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -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

    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/agentcontainers/acmock/acmock.go

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

    agent/agentcontainers/api.go

    Lines changed: 42 additions & 8 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1062,20 +1062,23 @@ func (api *API) injectSubAgentIntoContainerLocked(ctx context.Context, dc coders
    10621062

    10631063
    logger.Info(ctx, "copied agent binary to container")
    10641064

    1065-
    // Make sure the agent binary is executable so we can run it.
    1065+
    // Make sure the agent binary is executable so we can run it (the
    1066+
    // user doesn't matter since we're making it executable for all).
    10661067
    if _, err := api.ccli.ExecAs(ctx, container.ID, "root", "chmod", "0755", path.Dir(coderPathInsideContainer), coderPathInsideContainer); err != nil {
    10671068
    return xerrors.Errorf("set agent binary executable: %w", err)
    10681069
    }
    1069-
    // Set the owner of the agent binary to root:root (UID 0, GID 0).
    1070-
    if _, err := api.ccli.ExecAs(ctx, container.ID, "root", "chown", "0:0", path.Dir(coderPathInsideContainer), coderPathInsideContainer); err != nil {
    1071-
    return xerrors.Errorf("set agent binary owner: %w", err)
    1072-
    }
    10731070

    10741071
    // Attempt to add CAP_NET_ADMIN to the binary to improve network
    10751072
    // performance (optional, allow to fail). See `bootstrap_linux.sh`.
    1076-
    if _, err := api.ccli.ExecAs(ctx, container.ID, "root", "setcap", "cap_net_admin+ep", coderPathInsideContainer); err != nil {
    1077-
    logger.Warn(ctx, "set CAP_NET_ADMIN on agent binary failed", slog.Error(err))
    1078-
    }
    1073+
    // TODO(mafredri): Disable for now until we can figure out why this
    1074+
    // causes the following error on some images:
    1075+
    //
    1076+
    // Image: mcr.microsoft.com/devcontainers/base:ubuntu
    1077+
    // Error: /.coder-agent/coder: Operation not permitted
    1078+
    //
    1079+
    // if _, err := api.ccli.ExecAs(ctx, container.ID, "root", "setcap", "cap_net_admin+ep", coderPathInsideContainer); err != nil {
    1080+
    // logger.Warn(ctx, "set CAP_NET_ADMIN on agent binary failed", slog.Error(err))
    1081+
    // }
    10791082

    10801083
    // Detect workspace folder by executing `pwd` in the container.
    10811084
    // NOTE(mafredri): This is a quick and dirty way to detect the
    @@ -1096,13 +1099,44 @@ func (api *API) injectSubAgentIntoContainerLocked(ctx context.Context, dc coders
    10961099
    directory = DevcontainerDefaultContainerWorkspaceFolder
    10971100
    }
    10981101

    1102+
    displayAppsMap := map[codersdk.DisplayApp]bool{
    1103+
    // NOTE(DanielleMaywood):
    1104+
    // We use the same defaults here as set in terraform-provider-coder.
    1105+
    // https://github.com/coder/terraform-provider-coder/blob/c1c33f6d556532e75662c0ca373ed8fdea220eb5/provider/agent.go#L38-L51
    1106+
    codersdk.DisplayAppVSCodeDesktop: true,
    1107+
    codersdk.DisplayAppVSCodeInsiders: false,
    1108+
    codersdk.DisplayAppWebTerminal: true,
    1109+
    codersdk.DisplayAppSSH: true,
    1110+
    codersdk.DisplayAppPortForward: true,
    1111+
    }
    1112+
    1113+
    if config, err := api.dccli.ReadConfig(ctx, dc.WorkspaceFolder, dc.ConfigPath); err != nil {
    1114+
    api.logger.Error(ctx, "unable to read devcontainer config", slog.Error(err))
    1115+
    } else {
    1116+
    coderCustomization := config.MergedConfiguration.Customizations.Coder
    1117+
    1118+
    for _, customization := range coderCustomization {
    1119+
    for app, enabled := range customization.DisplayApps {
    1120+
    displayAppsMap[app] = enabled
    1121+
    }
    1122+
    }
    1123+
    }
    1124+
    1125+
    displayApps := make([]codersdk.DisplayApp, 0, len(displayAppsMap))
    1126+
    for app, enabled := range displayAppsMap {
    1127+
    if enabled {
    1128+
    displayApps = append(displayApps, app)
    1129+
    }
    1130+
    }
    1131+
    10991132
    // The preparation of the subagent is done, now we can create the
    11001133
    // subagent record in the database to receive the auth token.
    11011134
    createdAgent, err := api.subAgentClient.Create(ctx, SubAgent{
    11021135
    Name: dc.Name,
    11031136
    Directory: directory,
    11041137
    OperatingSystem: "linux", // Assuming Linux for dev containers.
    11051138
    Architecture: arch,
    1139+
    DisplayApps: displayApps,
    11061140
    })
    11071141
    if err != nil {
    11081142
    return xerrors.Errorf("create agent: %w", err)

    0 commit comments

    Comments
     (0)
    0