Repository navigation
feat(deploy): the installation registry in the control plane's Compose project (part of #215) - #530
Merged
Merged
Conversation
…t of #215) ADR 0030: Distribution's token authentication with the control plane as token service. A grant (pull, or pull and push for a build) is issued for an action until its deadline, its password stored hashed and the grant audited. GET /api/v1/registry/token answers a five-minute EdDSA token for the grant's repository only, signed with a new installation key whose public half is written as a JWKS for Distribution. Signed-off-by: samuel mbabhazi <[email protected]>
…e project (part of #215) ADR 0030: Distribution with token authentication, its key read from the JWKS the control plane writes, served under /v2/ on the control plane's name: by the Compose Caddy, and on a single machine by the server's Caddy through a route the agent keeps before the control plane's, to 127.0.0.1:5000 by default. Signed-off-by: samuel mbabhazi <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 50 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…vice Signed-off-by: samuel mbabhazi <[email protected]> # Conflicts: # apps/api/prisma/migrations/20261127120000_registry_grants/migration.sql # apps/api/prisma/schema.prisma # apps/api/src/modules/registries/application/ports.ts # apps/api/src/modules/registries/application/registry-grants.ts # apps/api/src/modules/registries/application/registry-tokens.ts # apps/api/src/modules/registries/domain/registry-token.spec.ts # apps/api/src/modules/registries/domain/registry-token.ts # apps/api/src/modules/registries/registry-distribution.integration.spec.ts # apps/api/src/modules/registries/registry-tokens-http.integration.spec.ts # docs/SPEC.md
samuelmbabhazi
added a commit
that referenced
this pull request
Nov 27, 2026
… then deploys the image (part of #215) (#537) Part of #215 (M3.3), per ADR 0030. This connects the pieces already merged: the registry and its grants (#529, #530), the agent's `BuildImage` (#533) and the build lane (#532). A Git application with a Dockerfile now builds when it deploys, and its replicas run the image that was built. ## What changed - **Configuration**: an application whose configuration is a repository's may use `build.type: dockerfile`. Railpack and Nixpacks are still refused with `unsupported_build_type` (new text, in the web UI and in French). An application created from an image still runs an image. - **Release**: - `releaseDraft(config, { repository })` plans a build. Its image is `<control plane host>/<organization>/<application>:<release number>` (`builtImage`), set once the store knows the number; - `repositoryPath` reads paths the way the agent does: `./api/` → `api`, `.` → the root; - the commit was already kept (#527). - **Planner** (`building` and `built` stages): the replicas are placed first, then `build_image` runs on the first one's server, at the commit, with the context, the Dockerfile and the args. Its digest becomes the release's (`record_build`). A failed build gives its cause in words: its output, its time limit, a server without a builder. - **Runner**: - the GitHub token is minted **outside any transaction** (`RepositorySource.buildAccess`): read access to that one repository, under its current name. If GitHub cannot be reached, the run waits and tries again; - the push grant (#529) is issued at enqueue time and lasts as long as the action; - `release.image_built` is audited with the digest and the commit; - every pull from the installation's registry carries a **pull-only grant**. - **Store**: an action's `buildImage.imageDigest` is read back, only if it is a valid `sha256:` digest. - **SPEC**: the build stage. Open question: the token is not revoked when the build ends yet (it expires within the hour). ## How it was tested - **Planner unit tests**: - the full order, from `queued` through `building` and `built` to `succeeded`; - the exact build step (first replica's node, normalized paths, the tag), with the default context and Dockerfile; - every replica pulls `<repository>@<built digest>`; - each failure cause and its text, with nothing deployed afterwards; - no digest, no commit, a release already built. - **Agent action**: `BuildImage` carries the URL, the commit, the token and the push grant, and round-trips through protobuf. A build without its access is refused. - **Integration** (`git-builds.integration.spec.ts`, PostgreSQL, fake GitHub, real pipeline and token endpoint): - the deploy creates `…/<app>:1`, and the build is the only action queued; - the token is scoped to `repositoryIds: [777]`, `contents: read`; - the push grant is accepted by the token endpoint for pull and push on that repository; - after the agent's answer, the digest is recorded and audited; - the pull goes to `<repo>@<digest>` with a grant that gets `pull` only; - both grants are audited, and the token never appears in the audit log. - **Suites**: - API: lint, typecheck, 411 unit tests; - integration, all suites run: only the known environment failures (PostgreSQL 18 error codes, specs that need a container runtime); - web: 398 tests. ## Security considerations - **The token** is minted for one repository and read access, travels only inside the encrypted action, and is never logged or audited. It is not revoked yet (open question). - **The grants**: pushing only for the build, only to the application's repository, until the action's deadline. Servers only pull. - **No GitHub call holds a database transaction.** Signed-off-by: samuel mbabhazi <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #215 (M3.3), following ADR 0030. This puts the installation's registry in the control plane's Compose project and serves it under
/v2/on the control plane's name. It builds on #529 (token endpoint and grants) and contains its commit until #529 merges. The base ismainso that merging #529 does not close this PR.What changed
registryservice indeploy/control-plane/compose.yml: CNCF Distribution 3.1.2, pinned by digest.registry.yml, with token authentication. Its realm (the control plane's/api/v1/registry/token) and its service (SHIPKEEP_DOMAIN) come from the environment.registry-datavolume, which is not in the instance backup.registry-authvolume, which the control plane writes (REGISTRY_JWKS_FILE) and the registry mounts read-only./v2and/v2/*to the registry uncompressed, and everything else to the API as before.compose.single-machine.ymlpublishes the registry on127.0.0.1:5000, in the control plane's slice, capped at 256 MiB;shipkeep-control-plane-registry, with host plus path/v2,/v2/*, tocontrol_plane.route.registry;127.0.0.1:5000, so existing agent configurations need no change, and a non-loopback value is refused. No action can name or remove the route (tested)./var/lib/shipkeep-registry, owned bynode, so that the new volume is writable.registry.yml;install_test.shchecks the merged Compose configuration.How it was tested
realmandservicefromregistry.yml. Tested against a realregistry:3.1.2with an EdDSA token: 401 with the right realm, then 202 for an allowed push.caddy adaptwith the pinned Caddy image confirms the routing (/v2and/v2/*to the registry, the rest compressed to the API)./v2,/v2/and/v2/org/app/blobs/uploads/reach the registry upstream;/,/api/v1/registry/token,/v2xand/web/v2/reach the control plane;docker compose configwith both files): realm, service, port127.0.0.1:5000,depends_onhealthy, the read-only volumes, the slice and the limit.go test ./agent/...andgolangci-lintare clean. New cases cover the route order and paths, default and named registry upstreams, non-loopback values refused, and the fixed routes out of reach ofRemoveRoute.Security considerations