docs(specs): specify Debian hosted (S36)

Summary

  • Problem: Artifact Registry has no Debian format. Teams that ship .deb packages must stay on the monolith's Debian registry, which is an experiment with known gaps, or on JFrog or Nexus.
  • Impact: Debian and Ubuntu engineers cannot publish or install packages through Artifact Registry. Platform engineers cannot bring Debian under the same access model and audit trail.
  • Change: this adds spec S36 for Debian hosted repositories and its index row. It also adds the Debian rows to S08 (Basic auth), S09 (route permissions, the Debian denial renderer with its denial-table row and criterion, and the key routes on ADR-021's namespace permissions, each with its criterion) and S23 (usage events). S17 has no net growth, because it is over the doc-size limit: its read set, settings column, PATCH sentence and strict-body rules no longer exclude a Debian hosted settings object, its create refusal names a non-hosted debian, and three criteria change: the create refusal, the GET detail settings key and the settings 400. S36 carries the Debian management routes, statistics, delete rule, settings branch and create refusal, as S37 does for Go. A package delete tombstones the package and each of its versions. dput and a single-file PUT publish binary .deb packages. A background job rebuilds and signs each suite's indexes, and apt update shows a new package within 60 seconds at the 99th percentile, when the package indexes a rebuild changes hold up to 50 MB in all. Every client read follows the namespace delivery mode, and S36 lists no ADR-005 metadata document, because apt never checks a response's media type. The Valid-Until re-sign is a sign_only build that reads no pending pair, so it keeps signing a suite the backoff waits on or has stopped, and a suite in a namespace that does not serve writes, where S33 holds the upload rebuild and the recovery job. A stopped suite leaves the unpublished-age gauge, and a stopped-suites gauge counts it. The management API accepts a debian create only once the OpenAPI management contract, the monolith and the Snowplow context support it. A Deferred table records key import, private-key export, a KMS or HSM backend, anonymous reads and an upload rate limit. S36 also defines the Debian signing-key resource from ADR-030: the debian_signing_keys table, its routes under /debian/signing_keys and its cap. Namespace re-enable refuses while the namespace holds a Debian repository, because a selected key's row cannot be deleted. A suspended, limit-blocked, disabled or blocked namespace answers a Debian write with S33's reason code and message, and a disabled or blocked one answers a read 403 the same way. A rebuild takes one gate unit per blob session, one at a time, and rebuilds clamp to half the gate, as S38's do. A 206 moves no counter and emits no pull event. A single-file upload accepts any .deb file name, such as GoReleaser's. A commit that adds an all package gives its suite debian.default_architectures. The .changes commit takes its blob rows first, locks the staged rows it matched again, and counts its caps after the locked identity read. A rebuild takes Date from the database clock and fails with keys_changed when the repository's keys change under it. A download stamps every live version that holds the digest. Every control-file refusal answers 422 invalid_package. An out-of-range valid_until_days answers 400 with bad_request. The periodic-job indexes end in namespace_id, id, purge indexes cover tombstoned packages and versions, the Index table lists the unique keys the prose relies on and a non-partial index for each NO ACTION foreign key, and only the Debian repository, suite and changed-pair rows cascade, the S04-A key reference takes RESTRICT, and every other foreign key takes NO ACTION. The admission_source set gains debian_upload and debian_rebuild, which !3798 (merged)'s Steps 37 and 52 add to the cardinality lists in docs/dev/storage.md and docs/dev/observability.md. Metrics and the debian.* limits are in S36's Metrics and Configuration, and the two alerts are in its Failure, limits and recovery table. RPM gets its own table in its own spec.
  • Downsides: binary packages only: a source upload and a .udeb answer 422, and a .ddeb is staged and discarded, so an upload needs a binary-only build (-b). Suites appear on first upload and cannot be deleted. apt needs a token from the token exchange in auth.conf, and that token expires within 12 hours. No key import and no private-key export at GA. The setup snippet is for dput-ng: classic dput cannot authenticate an upload whose first file is over 256 KiB (review thread). With no process cache for InRelease, each ephemeral CI job costs one index-file read per suite. The index is served as Packages.gz only: the Go xz encoder saved 5% of the bytes for about 13 times the CPU and 100 times the memory, measured on Debian 12's main amd64 index. A rebuild whose changed pairs hold over 50 MB publishes later than 60 seconds, and never once it needs more than debian.rebuild_timeout (10 minutes) (Open question 2). A deploy that kills an in-flight rebuild delays that suite's publish by up to 11 minutes 25 seconds after a first failure, and longer after repeated failures, which the 60-second target excludes. Two uploads of one name, version and architecture with different bytes answer 409, even across suites, so a per-distribution build needs its own version. An xz or zstd .deb takes 2 gate units in one acquire before its session opens, one for the session and one for a compressed copy of the control member, then takes ceil(charge / unit) more without waiting once the member has arrived, so it never holds a unit while it waits. The charge is the dictionary or window the control member declares, and a unit is 1.2 × chunk_size + 1 MiB, 7 MiB at the default. A declared xz dictionary over 64 MiB or zstd window over 128 MiB answers 422 invalid_package before anything is allocated. It releases the decoder's units and the copy's when the decode ends, so a slow sender holds at most 2 units for up to debian.upload_read_timeout. When the decoder's units aren't free at that moment, the upload answers 503 at once, so a 128 MiB zstd upload sheds whenever 19 units aren't free. A 200 or 409 removes its staged files, and a staged file waits at most debian.staged_file_max_age (24 hours), so a dput that runs longer answers 422 staged_file_mismatch. A multi-unit acquire queues every later acquire of every format behind it, for at most storage.upload_session_wait_timeout (5 seconds by default). A request for more units than the whole gate answers 413 at once, as S38's oversized header does, books no shed, logs a WARN with the namespace, repository, units asked and gate capacity, and no retry clears it. An xz control member is one stream with one block and at most 32 LZMA2 chunks at the default, and a zstd member is one frame with no skippable frame; anything else answers 422 invalid_package. A .deb whose first two ar members are not debian-binary and control.tar, or whose control member's compression header lies beyond the first 2 KiB of the body, answers 422 invalid_package. No spec says how a namespace removes its Debian or RPM repositories before it re-enables, so Open question 3 records the gap for S04-A and S20-A, and the rollout gate does not wait for it.

Checklist

  • Gaps: remote and virtual Debian repositories get their own specs. An unknown suite answers 404, so apt update fails until the first upload to that suite. Audit events wait for S21. Anonymous reads wait for public visibility. None of these blocks the work item's hosted acceptance criteria. Passages in S01, S04-B, S09, S17, S20-A and S23 and docs/dev/column-encryption.md that already lag RPM or Go now lag Debian too; #1930 carries them, with the S04-A namespace re-enable refusal. S33's list of passages that lack its reason codes does not name S36, and S38, S37 and S30 still answer a suspended write forbidden; #1823 carries that. S36 follows S33's write-serving rule: the upload rebuild and the recovery job wait while a namespace does not serve writes, and the re-sign, which completes no client write, keeps signing. The staged-file sweep skips such a namespace, as S20-A's purger does. Two points differ from the work item's text: it says re-publishing an existing name, version and architecture is rejected, where S36 answers 200 for byte-identical bytes and 409 for different bytes or for an all build that meets another architecture's build of the same name and version; and it says "version-level deletes only", where S36 adds package delete and package bulk delete.
  • Least sure: a settings PATCH that nulls signing_key_id, or sets it to the current secondary, and a repository create in a namespace with no key, answer 422 invalid_signing_key. The error code is my choice, not a spec precedent. A create never generates a key, as in S38. The other doubt is the rotation's overlap step. It signs InRelease with two keys, and ADR-030 Open question 1 asks whether apt accepts that when it trusts one key. The Debian archive signs with several keys, so I expect yes. If one supported release rejects it, Debian rotates as RPM does, as ADR-030 decides. The one-block and one-frame rule for control.tar assumes dpkg-deb writes one block for a tiny control file, which is unconfirmed (xz --list -vv on a -z9 package should read Blocks: 1).
  • Compatibility: nothing breaks. Debian is a new format. Monolith users move through a new repository URL and add its key.
  • Agreement: ADR-030 (https://gitlab.com/gitlab-org/ops/artifact-registry/-/blob/main/docs/adr/030_repository_signing_keys.md) gives each format its own key table, and is amended there so key selection is a repository setting authorized on the namespace, as S36 and S38 have it. ADR-004, ADR-007, ADR-009 and ADR-021 hold rules only, so S36 states the Debian format value 6, tables, limits and routes itself, and no handbook amendment is pending (handbook!21653 is closed). AppSec accepted the opt-in Valid-Until on three conditions that the spec records: a scheduled re-sign, an expiry alert and user documentation. The monolith UI and the Snowplow context schema need a debian value before launch, and the UI's repository create must handle invalid_signing_key: the S36 plan (!3798 (merged)) opens the monolith issue at Step 61 and gates creation on both at Step 76. !3863 (merged) (RPM key routes) merged first, and this branch's merge of main resolves its conflicts in S09's namespace binding row, per-endpoint permission sentence and namespace-scope criterion, and in S17's read set; S36 now matches S38's key create, key-generation bound, key-delete race, key-field PATCH denial and settings fingerprints. The release that adds format 6 to the repository read path ships before the release that accepts a debian create.
  • Simplicity: I rejected operator-managed distributions, a synchronous rebuild and source uploads. Suites created on upload need no settings form, Debian keys sit in their own table as ADR-030 sets, and an async rebuild keeps uploads fast.

Depends on !3768 (merged) (ADR-030), merged.

Related to gitlab-org/gitlab#605698

🤖 Generated with Claude Code

Edited by Radamanthus Batnag

Merge request reports

Loading
Loading