mirror of
https://github.com/juanfont/headscale.git
synced 2026-11-24 22:26:29 +09:00
all: add nested AGENTS.md for db, integration, bump and .github
Agents load them only when working in that directory.
This commit is contained in:
1 parent
c0390cb657
commit
4608e29a02
4 files changed
+67
No files matched your search
@@ -0,0 +1,9 @@
|
||||
# .github
|
||||
|
||||
Actions are named by release tag; the commit lives in
|
||||
`.github/workflows/actions.lock`. After changing any `uses:` (workflows or
|
||||
`.github/actions/`), run `gh-actions-lock` (dev shell) and commit the lockfile
|
||||
with it; GitHub runs the locked commit and `check-generated` fails a stale
|
||||
lockfile. Same-repo actions are written `$/.github/actions/...`, not `./`, so the
|
||||
lockfile covers what they use. Never pass `--accept-moved`: a moved release tag
|
||||
needs a human.
|
||||
@@ -0,0 +1,17 @@
|
||||
# hscontrol/db
|
||||
|
||||
## Migrations
|
||||
|
||||
Violating these corrupts production databases. Migrations start at 0.29.0;
|
||||
`checkMinimumMigration` (`versioncheck.go`) refuses older databases.
|
||||
|
||||
1. Never reorder or edit committed migrations. Append new ones to the end.
|
||||
2. Never disable foreign keys.
|
||||
3. ID format `YYYYMMDDHHMM-short-description`, e.g.
|
||||
`202607241200-clear-tagged-node-expiry`.
|
||||
4. Never `AutoMigrate` in a migration; write explicit DDL.
|
||||
5. Run multi-statement migrations in `tx.Transaction` so a failure leaves the
|
||||
database retryable.
|
||||
|
||||
Some races surface only on SQLite or only on PostgreSQL; run integration tests
|
||||
with `--postgres` too.
|
||||
@@ -0,0 +1,10 @@
|
||||
# integration
|
||||
|
||||
Read `README.md` here before writing a test and `../cmd/hi/README.md` before
|
||||
running one. Never guess `hi` flags.
|
||||
|
||||
- Every test function starts with `IntegrationSkip(t)`.
|
||||
- External calls (`client.Status`, `headscale.ListNodes`, …) go inside
|
||||
`EventuallyWithT`; state-mutating commands (`tailscale set`) never do.
|
||||
- Prefer `hscontrol/servertest/` when a test does not need Docker.
|
||||
- A run writes ~100 MB of logs under `control_logs/{runID}/`; prune old runs.
|
||||
@@ -0,0 +1,31 @@
|
||||
# tools/bump
|
||||
|
||||
`go run ./tools/bump plan` reports stale pins and changes nothing;
|
||||
`go run ./tools/bump verify` exits non-zero when pins disagree. A hand-written
|
||||
bump follows the same rules:
|
||||
|
||||
1. `modernc.org/libc` moves only to the version `modernc.org/sqlite` requires;
|
||||
`gvisor.dev/gvisor` only to the version `tailscale.com` requires. Read both
|
||||
off the owner's `go.mod` via `proxy.golang.org`, never guess. If the partner
|
||||
cannot be resolved, neither half moves. `go mod tidy` can detach the `go.mod`
|
||||
NOTE comments explaining this; check they are still attached.
|
||||
2. Any `go.mod`/`go.sum` change needs `go run ./cmd/vendorhash update`.
|
||||
3. `go.mod`'s `go` directive must not exceed nixpkgs' Go. `go get` raises it
|
||||
silently and local builds download a toolchain; nix builds use
|
||||
`GOTOOLCHAIN=local` and fail. `bump verify` reports it; the tool never
|
||||
edits the directive.
|
||||
4. Actions: see `.github/AGENTS.md`.
|
||||
|
||||
Not encoded in the tool: `github.com/libdns/*` providers and
|
||||
`github.com/caddyserver/certmagic` must share the `github.com/libdns/libdns`
|
||||
major version. One provider instance serves both, so a provider on another
|
||||
major waits until certmagic moves.
|
||||
|
||||
Servertest Terraform tests run the newest three `tailscale/tailscale` provider
|
||||
releases from `terraformProviderVersions` (`hscontrol/servertest/apiv2_test.go`).
|
||||
The list is committed, so new releases arrive as bump PRs. A test of a provider
|
||||
feature calls `requireProvider` with the first release that has it.
|
||||
|
||||
`Dockerfile.tailscale-HEAD` and `Dockerfile.derper` build an unpinned tailscale
|
||||
branch: their builder image is a floor (≥ upstream's `go` directive), and
|
||||
`GOTOOLCHAIN=auto` turns an upstream bump into a slower build, not a broken one.
|
||||
Reference in new issue
Block a user