From e3caf3408853e3208fb7e3d24a168d1104c90d78 Mon Sep 17 00:00:00 2001 From: Travis Lyons Date: Thu, 25 Jun 2026 17:47:07 +0000 Subject: [PATCH 1/4] docs: add missing AGENTS.md (and README where missing) --- AGENTS.md | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..171cdc667 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,74 @@ +# AGENTS.md + +Guidance for coding agents working in this repository. + +## What this repo is + +This is the **deployment reference for Sourcegraph with Docker Compose** (`github.com/sourcegraph/deploy-sourcegraph-docker`). It is primarily configuration (Docker Compose YAML, service configs, dashboards) plus small Go and shell tooling for testing and releases — not an application codebase. + +The `main` branch tracks development. Versioned branches (e.g. `3.19`) correspond to released Sourcegraph versions. + +## Where the main code/config lives + +- `docker-compose/` — the deployment reference; `docker-compose/docker-compose.yaml` is the primary entrypoint, with `dev/`, `examples/`, `executors/`, and `jaeger/` variants. +- Service config directories: `caddy/`, `nginx/`, `pgsql/`, `codeintel-db/`, `codeinsights-db/`, `grafana/`, `prometheus/`, `otel-collector/`. +- `test/` — smoke and upgrade tests (`smoke-test.sh`, `upgrade-test.go`, `Vagrantfile`, `servers.yaml`). +- `tools/` — Go-pinned CLIs (`update-docker-tags`) and `migrate.sh`. +- `.buildkite/` — CI scripts and pipeline. + +## Toolchain versions + +Defined in `.tool-versions` (asdf/mise): Go `1.19.8`, Node `16.7.0`, Yarn `1.22.4`, shellcheck `0.7.1`, github-cli `2.46.0`, checkov. + +## Setup, build, and checks + +These mirror what CI (`.buildkite/pipeline.yaml`) actually runs. + +Install JS dev dependencies (for prettier): + +```bash +yarn +``` + +Validate the Docker Compose config: + +```bash +cd docker-compose +docker-compose -f docker-compose.yaml config -q +``` + +Or via the CI wrapper from the repo root: + +```bash +.buildkite/validate-docker-compose.sh +``` + +Format / check formatting (prettier, config in `prettier.config.js`): + +```bash +yarn run prettier # write +yarn run prettier-check # check only +``` + +Run the Terraform/IaC security scan (Checkov): + +```bash +.buildkite/ci-checkov.sh +``` + +## Testing + +Smoke and upgrade tests run on GCP via Vagrant (see `TESTING.md`): + +```bash +.buildkite/vagrant-run.sh docker-test # TEST_TYPE=docker-compose-test +``` + +This starts a GCP instance, uploads the repo, and runs the docker-compose smoke test. Expected output: `docker-test: ALL TESTS PASSED`. + +## Conventions + +- Keep changes minimal and config-focused; this is a deployment reference consumed by customers. +- All `*.{js,json,ts,tsx,graphql,md,scss}` files are formatted with prettier — run `yarn run prettier` before committing. +- Shell scripts should pass shellcheck. +- Releases are driven by `release.yaml` and the `sg release` steps in `.buildkite/pipeline.yaml`; release branches use `internal/release-*` and `promote/release-*` naming. From 8aa02b807c1d9dcf93c3cba2ee2a08010612c39f Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Tue, 10 Nov 2026 15:21:09 -0600 Subject: [PATCH 2/4] docs: Correct AGENTS.md for the current repository The file described the repository as of June. Since then the Go tooling, Checkov, shellcheck, TESTING.md, tools/, and nginx/ were removed. - Drop statements about files and tools that no longer exist - Prettier skips Markdown and YAML; say so - The smoke test reads CI secrets and creates a GCP VM; point agents at the pull request's Buildkite build instead of running it - Add the rules an agent cannot infer: keep db-only-migrate in sync, update expect_containers, leave image tags to the release process, backport labels, and the branches the release tooling owns --- AGENTS.md | 86 ++++++++++++++----------------------------------------- 1 file changed, 22 insertions(+), 64 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 171cdc667..a3a18fec3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,74 +1,32 @@ # AGENTS.md -Guidance for coding agents working in this repository. +This repository is the deployment reference for [Sourcegraph with Docker Compose](https://sourcegraph.com/docs/self-hosted/deploy/docker-compose). Customers merge each release tag into their own copy of this repository, run `docker-compose/docker-compose.yaml`, and keep their changes in a `docker-compose.override.yaml` file. The repository holds configuration and a few shell scripts, no application code. -## What this repo is +## Layout -This is the **deployment reference for Sourcegraph with Docker Compose** (`github.com/sourcegraph/deploy-sourcegraph-docker`). It is primarily configuration (Docker Compose YAML, service configs, dashboards) plus small Go and shell tooling for testing and releases — not an application codebase. +- `docker-compose/docker-compose.yaml`: the base file every customer runs. It mounts the service configuration in `caddy/`, `pgsql/`, `codeintel-db/`, `codeinsights-db/`, `grafana/`, `prometheus/`, and `otel-collector/`. +- `docker-compose/db-only-migrate.docker-compose.yaml`: a copy of the `pgsql` and `codeintel-db` services for backup and restore. Make every change to those two services in both files. +- `docker-compose/examples/`: example override files. `docker-compose/executors/` and `docker-compose/jaeger/` are optional extra compose files. `docker-compose/dev/` is an overlay for developing this repository. +- `test/` and `.buildkite/`: the smoke test and the CI pipeline. +- `release.yaml`: the release steps that `sg release` runs. -The `main` branch tracks development. Versioned branches (e.g. `3.19`) correspond to released Sourcegraph versions. +## Checks -## Where the main code/config lives +- `.tool-versions` pins Node, Yarn, and the GitHub CLI; CI installs them with mise. +- Validate the base file with `docker compose -f docker-compose/docker-compose.yaml config -q`. CI runs the same check in `.buildkite/validate-docker-compose.sh` with the standalone `docker-compose` binary, so the base file must stay valid for that binary. CI validates no other compose file. +- Check formatting with `yarn && yarn run prettier-check`; `yarn run prettier` rewrites the files. Prettier covers only JavaScript and JSON files. `.prettierignore` excludes Markdown and `.github/`, and no formatter runs on YAML, so match the surrounding YAML style by hand. +- The `docker-compose-test` step in `.buildkite/pipeline.yaml` starts the base file on a GCP VM and runs `test/smoke-test.sh`. It reads CI secrets and creates a billed VM, so take its result from the pull request's Buildkite build; run `.buildkite/vagrant-run.sh docker-test` yourself only when a person asks. +- `test/smoke-test.sh` compares the number of running containers with `expect_containers`. Update that number in the same pull request that adds or removes a service. +- CI does not run `test/executor-smoke-test.sh`. Run it against a running deployment when you change `docker-compose/executors/`. -- `docker-compose/` — the deployment reference; `docker-compose/docker-compose.yaml` is the primary entrypoint, with `dev/`, `examples/`, `executors/`, and `jaeger/` variants. -- Service config directories: `caddy/`, `nginx/`, `pgsql/`, `codeintel-db/`, `codeinsights-db/`, `grafana/`, `prometheus/`, `otel-collector/`. -- `test/` — smoke and upgrade tests (`smoke-test.sh`, `upgrade-test.go`, `Vagrantfile`, `servers.yaml`). -- `tools/` — Go-pinned CLIs (`update-docker-tags`) and `migrate.sh`. -- `.buildkite/` — CI scripts and pipeline. - -## Toolchain versions - -Defined in `.tool-versions` (asdf/mise): Go `1.19.8`, Node `16.7.0`, Yarn `1.22.4`, shellcheck `0.7.1`, github-cli `2.46.0`, checkov. - -## Setup, build, and checks - -These mirror what CI (`.buildkite/pipeline.yaml`) actually runs. - -Install JS dev dependencies (for prettier): - -```bash -yarn -``` - -Validate the Docker Compose config: - -```bash -cd docker-compose -docker-compose -f docker-compose.yaml config -q -``` - -Or via the CI wrapper from the repo root: - -```bash -.buildkite/validate-docker-compose.sh -``` - -Format / check formatting (prettier, config in `prettier.config.js`): - -```bash -yarn run prettier # write -yarn run prettier-check # check only -``` - -Run the Terraform/IaC security scan (Checkov): - -```bash -.buildkite/ci-checkov.sh -``` - -## Testing - -Smoke and upgrade tests run on GCP via Vagrant (see `TESTING.md`): - -```bash -.buildkite/vagrant-run.sh docker-test # TEST_TYPE=docker-compose-test -``` +## Conventions -This starts a GCP instance, uploads the repo, and runs the docker-compose smoke test. Expected output: `docker-test: ALL TESTS PASSED`. +- Customer override files refer to the base file's service names, volume names, published ports, and environment variable names. Describe every rename or removal of one in the pull request description. +- Every `image:` has the form `index.docker.io/sourcegraph/:@sha256:`. The release process sets the versions and digests (`sg ops update-images` in `release.yaml`) and brings them to `main` in "Update main: build v…" pull requests. Leave them unchanged; Renovate is turned off for these images for the same reason. +- `.github/PULL_REQUEST_TEMPLATE.md` requires a "Test plan" section in every pull request description. -## Conventions +## Branches and releases -- Keep changes minimal and config-focused; this is a deployment reference consumed by customers. -- All `*.{js,json,ts,tsx,graphql,md,scss}` files are formatted with prettier — run `yarn run prettier` before committing. -- Shell scripts should pass shellcheck. -- Releases are driven by `release.yaml` and the `sg release` steps in `.buildkite/pipeline.yaml`; release branches use `internal/release-*` and `promote/release-*` naming. +- `main` tracks development. Each release is a tag such as `v8.1.0`. +- To copy a pull request to a release branch such as `8.1.x`, add the label `backport 8.1.x` to it. `.github/workflows/backport.yml` opens the backport pull request once the original merges. +- The release tooling owns the branches named `internal/release-*`, `promote/release-*`, and `release-v*`, and the `v*` tags. Do not create, push to, or delete them: CI runs the release steps on a branch whose name starts with `internal/release-` or `promote/release-`, and each `release-v*` branch holds the commit of a tag that customers deploy. From ebbe65d5471c9d7a743117003e87898a969ffda0 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Tue, 10 Nov 2026 15:50:55 -0600 Subject: [PATCH 3/4] docs: Cover both clones and forks in the AGENTS.md upgrade sentence Customers who clone this repository check out the release tag; only customers who fork it merge the tag into their own branch. --- AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index a3a18fec3..0284a673b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,6 @@ # AGENTS.md -This repository is the deployment reference for [Sourcegraph with Docker Compose](https://sourcegraph.com/docs/self-hosted/deploy/docker-compose). Customers merge each release tag into their own copy of this repository, run `docker-compose/docker-compose.yaml`, and keep their changes in a `docker-compose.override.yaml` file. The repository holds configuration and a few shell scripts, no application code. +This repository is the deployment reference for [Sourcegraph with Docker Compose](https://sourcegraph.com/docs/self-hosted/deploy/docker-compose). Customers run `docker-compose/docker-compose.yaml` at a release tag: they check the tag out in a clone of this repository, or merge it into their own fork. We recommend they keep their changes in a `docker-compose.override.yaml` file. The repository holds configuration and a few shell scripts, no application code. ## Layout From ac9d1dc83add5615fbb074c1cad4552e9e427e7d Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Thu, 12 Nov 2026 19:45:55 -0600 Subject: [PATCH 4/4] docs: Update AGENTS.md for npm and the 8.2.x release branch Amp-Thread-ID: https://ampcode.com/threads/T-01a1d288-089c-7039-b388-2670e1428282 Co-authored-by: Amp #1460 replaced Yarn with npm, and 8.2.x is now the newest release branch. --- AGENTS.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 0284a673b..e6ccfebd3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -12,9 +12,9 @@ This repository is the deployment reference for [Sourcegraph with Docker Compose ## Checks -- `.tool-versions` pins Node, Yarn, and the GitHub CLI; CI installs them with mise. +- `.tool-versions` pins Node and the GitHub CLI; CI installs them with mise. - Validate the base file with `docker compose -f docker-compose/docker-compose.yaml config -q`. CI runs the same check in `.buildkite/validate-docker-compose.sh` with the standalone `docker-compose` binary, so the base file must stay valid for that binary. CI validates no other compose file. -- Check formatting with `yarn && yarn run prettier-check`; `yarn run prettier` rewrites the files. Prettier covers only JavaScript and JSON files. `.prettierignore` excludes Markdown and `.github/`, and no formatter runs on YAML, so match the surrounding YAML style by hand. +- Check formatting with `npm ci && npm run prettier-check`; `npm run prettier` rewrites the files. Prettier covers only JavaScript and JSON files. `.prettierignore` excludes Markdown and `.github/`, and no formatter runs on YAML, so match the surrounding YAML style by hand. - The `docker-compose-test` step in `.buildkite/pipeline.yaml` starts the base file on a GCP VM and runs `test/smoke-test.sh`. It reads CI secrets and creates a billed VM, so take its result from the pull request's Buildkite build; run `.buildkite/vagrant-run.sh docker-test` yourself only when a person asks. - `test/smoke-test.sh` compares the number of running containers with `expect_containers`. Update that number in the same pull request that adds or removes a service. - CI does not run `test/executor-smoke-test.sh`. Run it against a running deployment when you change `docker-compose/executors/`. @@ -28,5 +28,5 @@ This repository is the deployment reference for [Sourcegraph with Docker Compose ## Branches and releases - `main` tracks development. Each release is a tag such as `v8.1.0`. -- To copy a pull request to a release branch such as `8.1.x`, add the label `backport 8.1.x` to it. `.github/workflows/backport.yml` opens the backport pull request once the original merges. +- To copy a pull request to a release branch such as `8.2.x`, add the label `backport 8.2.x` to it. `.github/workflows/backport.yml` opens the backport pull request once the original merges. - The release tooling owns the branches named `internal/release-*`, `promote/release-*`, and `release-v*`, and the `v*` tags. Do not create, push to, or delete them: CI runs the release steps on a branch whose name starts with `internal/release-` or `promote/release-`, and each `release-v*` branch holds the commit of a tag that customers deploy.