When standardising artifact promotion across a company, would you use one repository per stage or one repository with promotion metadata, and why?
answer
- where enforcement lives
- permissions versus consumer filters
- repository count across formats
- per-repository retention and immutability
- boundary plus record
basics
~20 sPrefer a repository per stage as the enforcement boundary, because permissions, immutability and retention then attach to the repository; use metadata on top to record builds and approvals. Metadata-only promotion is lighter but depends on every consumer filtering correctly.
solid answer
~40 sIt turns on where you want enforcement to live. With **a repository per stage**, the boundary is enforced by repository permissions: CI cannot write release, immutability and retention are set per repository, and any client, of any format, is safe as long as it points at the release URL. The cost is more repositories (teams times formats times stages), copy operations and some aggregation work. With **one repository plus metadata**, promotion is a cheap property write and there are fewer repositories, but the repository still serves unapproved artifacts to anyone who does not filter, and package clients resolve by name and version without knowing about properties. I would standardise on staging and release repositories per format as the boundary, promote by copying the approved checksum or digest, and stamp properties for the record.
go deeper
Recall the two models: separate repositories per stage, or one repository where a property or label marks an artifact as released.
Explain how each model enforces release: repository write permission and URL, versus consumers filtering on metadata, and why ordinary package clients cannot filter on properties.
Point to the failure modes each model invites: repository sprawl and group misconfiguration on one side, weak annotate permissions, replication and cleanup mistakes on the other.
Choose a company standard, state where enforcement lives and who can bypass it, keep metadata as the record, and name the conditions that would change the decision.
## The decision Every team in the company needs a way to say "this artifact is released". A platform lead has to pick one model so tooling, permissions and audits work the same everywhere. There are two families: - **Repository per stage**: separate staging and release repositories (and sometimes more stages) for each format and team. Promotion **copies or moves** the artifact across. - **Single repository with promotion metadata**: one repository per format and team; promotion **sets a property or label** such as a status. Neither is wrong. They put the enforcement in different places, and that is what you are really choosing. ## Where enforcement lives | Concern | Repository per stage | Single repository plus metadata | |---|---|---| | Who can release | whoever can write the release repository | whoever can write the metadata | | What consumers see | release URL serves only released artifacts | everything, unless the consumer filters | | Immutability | set on the release repository | must apply to the whole repository or by path | | Retention | aggressive on staging, conservative on release | one policy that must read the status | | Works for every client | yes, clients only need a URL | only where the manager filters by metadata at that URL | | Repository count | higher | lower | | Promotion cost | a copy (cheap on checksum-addressed storage) or a move | a metadata write | The row that usually decides it is **what consumers see**. A Maven, npm, PyPI or Helm client asks a repository for a name and a version. It has no idea a property exists. In Artifactory, a consumer can require a property with a mandatory matrix parameter such as `;status+=prod`, but every consumer must be configured that way, and the plain form `;status=prod` also serves artifacts with no `status` at all. A release repository needs no such discipline: if it is there, it was promoted. ## Costs of the repository-per-stage model - **Repository sprawl.** Four formats, two stages and twenty teams is 160 repositories before proxies. Naming conventions help; Artifactory's guidance builds the stage into the name (`<team>-<tech>-<maturity>-<locator>`). - **Copy mechanics differ per format.** Some formats carry metadata the manager must recalculate when packages are added, moved or copied, as Artifactory does for NuGet, and structured artifacts such as an OCI image index have parts that must travel together. - **Aggregation.** Developers often want one URL. A group or virtual repository can combine release with proxies; including staging in a group that production uses would erase the boundary. ## Costs of the metadata model - **Weak gate.** Artifactory's Annotate permission or Harbor's Developer role is enough to set the metadata, and Artifactory documents property values as guidance, not strictly enforced. - **Replication surprises.** Some products do not treat a metadata change as a replication event; Harbor's event-based replication ignores label changes. - **Cleanup risk.** One repository means one retention policy that must never delete anything whose status is released, and a mistake there removes production artifacts. ## A defensible standard What I would put to the organisation, and the conditions that would change it: 1. **Staging and release repositories per format** (per team only where isolation is needed), with release as the trust boundary. 2. **Promotion by copy of the approved checksum or digest**, performed only by a promotion identity; CI writes staging only. 3. **Release immutability**: redeploy disabled for release versions, immutable version tags for images. 4. **Properties or labels as the record**, not the gate: build number, revision, approval reference, promoted-by. 5. **Retention split**: aggressive on staging, conservative on release, with anything still deployed excluded. I would reconsider in favour of metadata if the organisation runs one product whose consumers can all be forced to filter, has very many small teams where sprawl is the bigger risk, and accepts that the annotate permission is the release permission. For OCI images, the per-stage model maps naturally onto projects or repositories and tag immutability; for npm, a `package@version` once used can never be published again in the public npm registry, even after an unpublish, and the `latest` dist-tag is the format's own moving pointer, which sits beside, not instead of, a release repository. ## How to judge the answer in an interview - A strong answer names where enforcement lives and who can bypass it. - It mentions clients that cannot filter by metadata. - It treats metadata as a record even when it is not the gate. - It states what would change the decision.
- Can a group or virtual repository that includes both staging and release be used by production builds?Not safely. A group resolves across its members, so production would see staging candidates whenever release lacks a version or the order puts staging first. Production should resolve from release (optionally aggregated with proxies) and test environments from a group that adds staging.
- What would make you choose metadata-based promotion despite its weaker gate?A single product whose consumers can all be made to filter on a mandatory property, very many small teams where repository sprawl is the larger risk, and an explicit decision that the annotate permission is held as tightly as release write access would be.
- Package clients automatically skip artifacts lacking a released property.
- Metadata promotion is just as strict as repository permissions.
- Adding staging to production's group repository keeps the boundary intact.
- One retention policy suits staging and release alike.
- More repositories is always worse than more metadata.