fix(setup-sourcebot): mount Vertex service-account credentials

Draft
MS
2mo ago
+117-11

Summary

  • Validate Google Vertex service-account paths before writing setup output.
  • Generate a single read-only bind mount at /run/secrets/sourcebot-google-application-credentials.json and use that container path in .env for both Google Vertex providers.
  • Emit long-form, JSON-quoted bind mounts so local repository and credential paths with spaces, quotes, and YAML syntax remain valid.
  • Add focused credential validation and mount-contract tests plus an Unreleased changelog entry.

Validation

  • yarn workspace setup-sourcebot test
  • yarn workspace @sourcebot/schemas build
  • yarn workspace setup-sourcebot build
  • Packed CLI installed successfully into an isolated npm prefix.
  • Isolated Compose project sb-vertex-e2e generated and parsed config with both Google Vertex providers, a local repository, and a synthetic service-account JSON path containing spaces, #, and quotes.
  • Docker verification confirmed credential contents were readable at the container path, both repo and credential mounts had RW=false, writes to the credential mount were rejected, and the credential hash/read-only state persisted after Sourcebot restart.
  • Missing and unreadable credential paths were rejected by the packed CLI.

No live Vertex API inference, production credentials, or license activation were used.


[!NOTE]
Low Risk
Changes are limited to the setup wizard CLI and generated Compose/.env output; no runtime Sourcebot auth logic is modified.

Overview
Fixes setup-sourcebot so Google Vertex service-account JSON works when Sourcebot runs in Docker.

When users opt out of Application Default Credentials, the wizard now validates that the credentials path is a readable file (including ~ expansion), keeps the host path only for Compose bind mounts, and writes GOOGLE_APPLICATION_CREDENTIALS in .env as the fixed in-container path /run/secrets/sourcebot-google-application-credentials.json.

docker-compose.override.yml is generated whenever Vertex file credentials or local repos need mounts. Repo and credential volumes use long-form read-only bind mounts with JSON-quoted sources so awkward host paths stay valid YAML.

Adds a test script and unit tests for path validation and mount YAML, plus an Unreleased changelog entry.

Reviewed by Cursor Bugbot for commit a4b3234f127721f7c0342b30c4546df93108e034. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Fixes Google Vertex provider credentials in setup-sourcebot so service-account files actually work when Sourcebot runs in Docker. The host path was previously written directly to .env, which doesn't resolve inside the container; the CLI now validates the file, mounts it read-only at /run/secrets/sourcebot-google-application-credentials.json, and writes that container path to .env.

  • Validates the credential file exists and is readable, and expands ~ and relative paths.
  • Emits long-form, JSON-quoted bind mounts so paths with spaces, quotes, or YAML syntax stay valid.
  • Adds unit tests for path validation and bind mount output, plus an Unreleased changelog entry.

Summary by CodeRabbit

  • New Features

    • Setup wizard now supports Google Vertex AI service-account credentials.
    • Credential paths are validated and configured automatically in generated Docker Compose settings.
    • Credentials are mounted into containers as read-only files for improved reliability and security.
  • Bug Fixes

    • Fixed Google Vertex provider credential configuration when using setup-sourcebot.
  • Tests

    • Added coverage for credential path validation and read-only mount generation.