Skip to content

ADR-0044: The Git origin of an OCI source is declared, and the artifact is only a cross-check

  • Status: Accepted
  • Date: 2026-11-23

Context

Issue #935. The source mapping of ADR-0012 follows a Flux Kustomization to its GitRepository and refuses every other source: the request ends NeedsIntervention with UnsupportedSource. Many clusters deliver through OCI artifacts instead. CI builds an artifact from a Git repository (flux push artifact) and pushes it to a registry, and Flux pulls it through an OCIRepository. The desired state still lives in Git, but an OCIRepository says where the artifact is, not which repository, branch and path it was built from. Those clusters get diagnoses and issues, never a pull request.

Today's code, so the change is read against it:

  • A Kustomization whose spec.sourceRef.kind is not GitRepository stops the mapping with UnsupportedSource (checkKustomization in internal/gitops/sourcemap/fluxrules/flux.go; the reason is ReasonUnsupportedSource in fluxrules/result.go).
  • Flux objects are read as unstructured objects, and only the fields the rules name are used (the comment on KustomizationGVK and GitRepositoryGVK in fluxrules/flux.go).
  • A GitRepository passes only when it sets none of suspend, ignore, recurseSubmodules or sparseCheckout (gitRepositoryOptions in fluxrules/flux.go), and tracks one branch (CheckGitRepository); the Kustomization must have applied the revision the source last fetched (checkRevision in fluxrules/flux.go, fluxstatus.AppliedFetched in internal/fluxstatus/fluxstatus.go).
  • The source URL must equal exactly one repository of the settings, that repository must be the policy's gitOps.repositoryRef, and the branch must equal its targetBranch (matchRepository in internal/gitops/sourcemap/sourcemap.go). The URL is never put in a message (the comment on matchRepository).
  • The base commit of the pull request is the head of that branch, read from the Git provider at mapping time (git.BranchHead in Resolver.declaration and BaseCommit in Resolver.scan, sourcemap.go). The freshness check runs the mapping again with the settings' repositories and compares repository, branch, path and build directory, not the base commit (Checker.checkSource in internal/policy/freshness/freshness.go).
  • The executor's cluster-wide role has get on kustomizations and gitrepositories and nothing on ocirepositories (config/rbac/executor/role.yaml, from the +kubebuilder:rbac markers in internal/controller/cache.go; the chart's dist/chart/templates/rbac/executor-role.clusterrole.yaml).
  • After the merge, the delivery check reads a commit out of the Kustomization's lastAppliedRevision only when its source is a GitRepository (statusOf in internal/providers/delivery/flux/flux.go, which fills AppliedRef, AppliedCommit, AttemptedRef and AttemptedCommit for that source only). The unit is Applied when that commit equals the merge commit, or descends from it by the ancestry answer (DeliveryStatus.Outcome and DeliveryStatus.Verify in internal/providers/delivery.go).
  • delivered (internal/controller/rollout.go) reads the target and asks the Flux adapter twice, and reports applied only when both answers are Applied for the same commit. Both checks after the merge call it, the one with --verify-outcomes (deliveryStep, internal/controller/phases.go) and the one without (waitForDelivery, rollout.go). In the first, an applied answer records the applied time (recordApplied, internal/controller/merge.go), the target's generation and template hash and the applied commit (the block after recordApplied in deliveryStep), and the request moves to Verifying with its deadline measured from the applied time (enterVerifying, phases.go).
  • Until then the request waits: it is requeued at the poll interval inside the delivery window, one hour from the move to Merged plus the time writes were paused (deliveryStep, phases.go; deliveryWindow and deliveryWindowEnd, rollout.go). Past the window a read that worked and showed no applied commit ends the request by its last outcome: Failed with DeliveryFailed when the merge commit itself failed to apply, Inconclusive with DeliveryBlocked when a later commit that holds it failed, DeliverySuspended for a suspended unit, otherwise Inconclusive with DeliveryNotObserved (deliveryStep calling endDelivery, phases.go). This is the path with --verify-outcomes. Without it, the rollout check ends at the window with RolledOut False and DeliveryNotObserved whatever the outcome (waitForDelivery calling deliveryNotObserved, rollout.go), which takes only the target, not the delivery. A read that kept failing ends Inconclusive with DeliveryNotChecked once the window and its grace of ten minutes have passed (deliveryStep calling endDeliveryNotChecked; finalGrace, rollout.go).
  • A read of a Flux object that the API server refuses (403 or 401) comes back from the adapter as providers.ErrForbidden (readError in flux.go). lastingCause does not list it (phases.go), so it is retried with backoff like any failed read (deliveryRetry, phases.go) and shows no cause on the request (deliveryReadFailed, phases.go).
  • Once the request is Verifying, the verification reads the live field and ends the request Inconclusive with ValueChanged at once when it differs from the desired value (verifyStep calling configured, phases.go). The text says "a later commit or change overwrote it, so this change never ran as merged" (the why text of configured, phases.go).
  • Verifier.Verify (flux.go) is the executor's path; StatusReader.Status (flux.go) is the read the analyzer's delivery status tool uses, and stays as it is.

The last two points matter most. For an OCI source the Kustomization applies <tag>@sha256:<digest> of the artifact (upstream: the revision of an OCIRepository artifact is the tag and the digest of the OCI artifact, source-controller spec, "Artifact"). It names no Git commit, and the cluster applies an artifact CI built after the merge, never the merge commit itself.

This ADR widens a read (the executor reads OCIRepository objects) and the places a pull request can come from (a workload delivered through a declared artifact). ADR-0021 says an amendment never widens on its own authority, so it is decided here and ADR-0012 gets only a pointer after acceptance. ADR-0043 is the model: say what is widened, say what never happens, state the limits.

What the upstream Flux API gives

Read from the current upstream documentation and source on 2026-11-19, not from memory (the repository vendors no Flux types, so there is no pinned version to read; the code reads source.toolkit.fluxcd.io/v1, internal/fluxstatus/fluxstatus.go):

  • OCIRepository status carries status.artifact with revision, digest, url, size, lastUpdateTime and metadata, a map of strings "such as OCI annotations".
  • When the artifact was created with flux push artifact, metadata holds org.opencontainers.image.created, org.opencontainers.image.source ("the URL of the Git repository containing the source files") and org.opencontainers.image.revision ("the Git branch and commit SHA1 of the source files"). The Flux CLI requires --source and --revision and documents --revision="$(git branch --show-current)@sha1:$(git rev-parse HEAD)" (cmd/flux/push_artifact.go in fluxcd/flux2). The CLI strips credentials from the source it records. An artifact pushed by another tool, or with another --revision, can carry any value or none.
  • The status has no field that says which Git repository, branch or path the content came from, other than those annotations. Registry access would be needed for anything else, and the executor has none.
  • spec.ignore, spec.layerSelector, spec.suspend, spec.verify and spec.secretRef or spec.serviceAccountName exist in the spec. Source-controller leaves out what its default exclusion rules and any .sourceignore file match when it archives the pulled contents, and spec.ignore overrides the defaults (source-controller spec, "Ignore"). CI has its own filter: flux push artifact takes --ignore-paths (default excludeOCI) and --add-ignore-paths (cmd/flux/push_artifact.go in fluxcd/flux2). A file either step leaves out is not in the artifact, whatever Git holds.
  • OCIRepository is served at source.toolkit.fluxcd.io/v1 from source-controller 1.6.0, which came with Flux 2.6 (its changelog: "The OCIRepository API has been promoted from v1beta2 to v1 (GA)", release date 2025-05-27; read 2026-11-23). Before that it was served at v1beta2 only, and the executor reads v1 (OCIRepositoryGVK is to sit next to GitRepositoryGVK in fluxrules/flux.go).
  • spec.verify is OCIRepositoryVerification (api/v1/ociverification_types.go:23-48 in fluxcd/source-controller at main): provider (cosign or notation), secretRef (cosign public keys or the notation trust policy), matchOIDCIdentity (a list of OIDCIdentityMatch, cosign keyless only, issuer and subject as Go regular expressions, ociverification_types.go:70-83) and trustedRootSecretRef (a Sigstore trusted_root.json, for a self-hosted Sigstore). Flux reports the result in the condition SourceVerified: True when the signature verified, False with reason VerificationError on a failure, which the controller retries with backoff. The condition exists only while spec.verify is set and carries the observedGeneration of the spec it judged (api/v1/condition_types.go:35-40, :74-76).
  • The signature covers the artifact's digest, and the digest covers the manifest, so the annotations of a verified artifact are what the signer pushed. The status holds the verdict, not the identity that matched.

Decision

The executor reads three things: the Kustomization and its OCIRepository status in the cluster, the declaration in RemediationSettings, and the Git repository through the Git App. The declaration says which repository and path the artifact is built from; the artifact's source and revision annotations are only compared with it. No declaration, a mismatch, an artifact without annotations, an artifact Flux did not verify (or verified with no identity named, unless the declaration says NotRequired) and an OCIRepository the executor may not read each end NeedsIntervention with their own reason and no Git write; an OCIRepository pinned by digest or semver ends SourceNotBranch. A verified artifact proves only that Flux accepted a signer the writer of the OCIRepository chose. After the merge, a refused OCIRepository read is retried and ends DeliveryNotChecked. After the merge an OCI unit counts as applied only while its current artifact passes the same verification check and the live value matches the desired one; the executor never reads the registry, the artifact's content or any secret.

This is option 3 of the issue, with two changes: the declaration has no branch field (decision 6 of 2026-11-19), and the artifact must be verified by Flux unless the origin says otherwise.

1. The declaration

RemediationSettings gets a new list, spec.ociSources, next to spec.repositories:

spec:
  repositories:
  - name: fleet
    url: https://github.com/example/fleet
    targetBranch: main
    provider: GitHub
    github: { ... }
  ociSources:
  - name: apps                  # Name, the list key
    ociRepository:
      namespace: flux-system    # DNS label
      name: apps                # DNS subdomain
    repositoryRef: fleet        # Name of an entry in spec.repositories
    path: clusters/prod         # GitDirPath, default "."
    verification: Required      # Required (default) or NotRequired
  • ociRepository is the Flux object, by namespace and name. A pair appears at most once (a CEL rule, as the URL rule of repositories).
  • repositoryRef must name an entry of spec.repositories (a CEL rule on the spec). The mapping checks it again and never relies on admission alone.
  • path is the directory of the repository that the artifact's root corresponds to, . when CI packs the repository root (flux push artifact --path=./clusters/prod is path: clusters/prod). The build directory of a request is the Kustomization's spec.path put under this path, in two steps (section 2, step 7).
  • There is no branch field. The branch is the targetBranch of the entry repositoryRef names, as for a GitRepository (ADR-0012 step 2). A second field could only repeat that value or disagree with it. The issue lists the branch among the fields; this is a deliberate departure.
  • verification is Required unless the entry says NotRequired. NotRequired makes the mapping accept an OCIRepository without spec.verify. Its risk is in the field's documentation and in limit (a). It is a decision of whoever writes RemediationSettings, per origin, and nothing in the artifact or the cluster can turn it on.
  • At most 16 entries, as repositories. Fields of the RemediationSettings status are never read for any decision, as before.

2. What the mapping does for a Kustomization whose sourceRef.kind is OCIRepository

In this order, each stop being NeedsIntervention unless said otherwise. A read that fails is returned for retry and is never one of these stops (the rule of Resolver.get, sourcemap.go); the one exception is a refused read (step 2).

  1. No ociSources entry names that namespace and name: stop, reason OCIOriginNotDeclared. The message names the object and the field to declare.
  2. Read the OCIRepository (get, by the Kustomization's spec.sourceRef, the namespace defaulting to the Kustomization's as for a GitRepository, checkKustomization in fluxrules/flux.go). Not found: SourceNotFound. A cluster whose Flux does not serve OCIRepository at v1 (before Flux 2.6) answers the get with a no-match error, which Resolver.get (sourcemap.go) turns into the not-found stop, so the message says the object does not exist while it does. The build gives this case its own message, naming the kind and the version the executor reads, with the same reason (limit (k)). A 403 or 401 on the read (the grant of section 3 is off): OCISourceNotReadable, since a retry could never succeed and would run without end and without a signal.
  3. The object must not set spec.suspend, spec.ignore or spec.layerSelector: reason SourceOptions, as for the gitRepositoryOptions of fluxrules/flux.go. Each can make the artifact differ from the files in Git. spec.ref must not set digest, semver or semverFilter (the fields of OCIRepositoryRef besides tag, api/v1/ocirepository_types.go in fluxcd/source-controller at main, read 2026-11-23): reason SourceNotBranch, the one the Git rule gives a GitRepository whose spec.ref sets a field that takes precedence over the branch (gitRefBranch and gitRefOthers, fluxrules/flux.go). A digest pins one artifact and a semver range picks a tag by version, so neither follows the next artifact the pipeline pushes, which section 5 needs to see the merge arrive. A tag, or no spec.ref (upstream: the tag "defaults to latest"), passes. The executor cannot tell a tag the pipeline moves from one it never moves (limit (m)). The message names the field, as the Git rule's does, and the build widens the doc comment of ReasonSourceNotBranch (fluxrules/result.go) to the OCI case.
  4. It must be Ready for its current generation (SourceNotReady), verified, and applied:
  5. Verified. spec.verify must be set, and the condition SourceVerified must be True with an observedGeneration equal to the object's generation. A keyless cosign verification (provider: cosign and no secretRef) must also name at least one identity: matchOIDCIdentity must have an entry. Otherwise: OCISourceUnverified. The reason for the identity rule is upstream: with no entry source-controller passes an empty identity list to cosign (ocirepository_controller.go in fluxcd/source-controller at main, the keyless branch of the verification), and cosign checks identities only when the list is not empty (pkg/cosign/verify.go in sigstore/cosign, the len(co.Identities) > 0 test; both read 2026-11-23). A certificate that public Sigstore issued to any GitHub or Google account then verifies and SourceVerified is True, so Required would mean nothing. The executor reads whether spec.verify is set, the condition, provider, whether secretRef is set and whether matchOIDCIdentity is empty, nothing else of it: no key, no identity pattern (it does not judge whether a pattern is narrow; a pattern such as .* passes, limit (a)), no registry call. A failed verification is a stop, not a wait: Flux retries it with backoff, and a person re-triggers the request when it verifies. With verification: NotRequired this bullet is skipped and the cross-check of step 6 is the only guard (limit (a)).
  6. The Kustomization's status.lastAppliedRevision must equal status.artifact.revision (RevisionMismatch; the equality is of two strings from the cluster, as fluxstatus.AppliedFetched, with no tag parsing, since the OCI revision is not a Git revision).
  7. The artifact must carry org.opencontainers.image.source and org.opencontainers.image.revision in status.artifact.metadata, and the revision must parse as <ref>@sha1:<40 hex> or <ref>@sha256:<64 hex> (fluxstatus.ParseRevision, internal/fluxstatus/fluxstatus.go). Otherwise: OCIOriginUnrecorded. Only a SHA-1 commit can be checked in step 6 while GitHub is the only ancestry provider; a SHA-256 one ends OCIOriginUnrecorded there.
  8. The cross-check against the declaration:
  9. The annotated source must equal the URL of the declared repository, or equal it with .git appended (the form git config --get remote.origin.url gives). For a GitHub repository the owner and repository names are compared with ASCII case folded, because GitHub treats them as case-insensitive and the settings hold them in lower case (the XValidation rule on GitRepository in api/v1alpha1/remediationsettings_types.go); the scheme and host must still match exactly. No other rewriting: not ssh://, not git@host:.
  10. The ref must be the target branch. The ref of the annotated revision must equal the repository's targetBranch byte for byte. Refused with OCIOriginMismatch: a tag (an artifact published from a tag records the tag), another spelling of the branch such as refs/heads/<branch>, another branch. There is no list of accepted refs and no field to add one: a declared list would need its own threat note. A pipeline that publishes from tags is refused for now, and the message says that the ref differs, without showing it.
  11. The annotated commit must be the head of that branch or one of its ancestors (AncestryChecker.IsAncestor, internal/providers/delivery.go, implemented for GitHub by Provider.IsAncestor in internal/providers/github/ancestry.go, a read through the Git App the mapping already opens in Resolver.declaration, sourcemap.go). The call is made as the operation read the ancestry of the artifact's commit. It starts with read, so it joins the bounded Git read wait (gitReadFailure takes any sourcemap.RefusedError and a sourcemap.TransientError whose operation starts with read, list or open repository, gitReadFailure in internal/controller/gitread.go). The error classes are named, and each has its own test. They are decided before the error reaches the resolver's transient() (transient in sourcemap/errors.go), which keeps a refusal as a RefusedError and turns every other error into a retry:
    • ErrInvalidCommit (the GitHub adapter compares SHA-1 only and refuses a SHA-256 or malformed ID for good, Provider.IsAncestor): OCIOriginUnrecorded, the commit cannot be compared.
    • ErrNotFound (a 404 or 410 of the compare call, statusError in internal/providers/github/client.go): OCIOriginMismatch, the repository does not have the commit.
    • ErrForbidden (403) and ErrRejected (422) (statusError): a refusal. It stops the request as a refusal of any other Git read does: the resolver returns a RefusedError (transient, errors.go) and the controller reads its class with refusal (internal/controller/pullrequest.go), with the reasons GitForbidden and GitRejected. No OCIOrigin* reason, no retry.
    • Every other error (a network error, a rate limit, a 5xx): a retry, inside the bounded Git read wait. A failed read is never a verdict.
  12. Any difference: stop, reason OCIOriginMismatch, no Git write. The message names which comparison differed and shows no URL. The OCIRepository is recorded with the other Flux objects the mapping reads (d.seen in Resolver.Resolve, sourcemap.go) and read again after the Git scan, so an artifact pushed during the scan makes the mapping a retry. It is part of Result.Observed too. At the merge the freshness check maps the target again (Checker.checkSource, freshness.go), which reads the OCIRepository as it is then and runs the same mapping, steps 1 to 7, on the current object and artifact, not only this cross-check: if it still resolves to the plan's repository, branch, path and build directory, the plan is fresh; a mapping that now stops (a verification removed, for one) or resolves elsewhere makes it stale with SourceChanged (Checker.checkSource). An OCIRepository that changes during that check makes it a retry (Checker.recheckInputs, freshness.go).
  13. The build directory is made in two steps, never as one join. First spec.path is checked as for a Git source, with repopath.Join(".", spec.path) (Resolver.scan, sourcemap.go), which refuses a leading .. and returns the clean path inside the artifact root. Then that result is put under the declared path. repopath.Join(declared, spec.path) is never called: it resolves .. inside the declared prefix (Join("clusters/prod", "../../other") returns "other"), while Flux's kustomize-controller clamps spec.path inside the artifact root, so the mapping would scan and patch other/ outside the declared path. A spec.path of ../x or ../../x ends InvalidPath, as for a Git source.
  14. Then the rules of ADR-0012 go on as for a Git source: exactly one settings repository (the declared one), the policy's repositoryRef, the targetBranch, the build directory, the declaration found by the scan in it, the live value equal to the value in Git, allowedPaths. The base commit is the head of the branch, as today.

Reason names are the proposal; the builder may change a spelling in the code review, not the cases.

What a verified source proves

An OCIRepository is cluster input (invariant 4). It is written by whoever the cluster's RBAC lets create or update the object, and spec.verify is whatever that writer put in it. A verified source therefore means one thing: Flux accepted a signature from a signer that the writer of the OCIRepository chose. It does not mean the artifact was built from the declared repository, for any provider (cosign with a key, cosign keyless, Notation):

  • a key or an identity proves who signed, not which repository the files came from;
  • the executor cannot read a signer's identity, only the verdict, and does not try to (see "Tie a keyless signature to the declared repository" under Alternatives).

Verification is kept as the default for defence in depth and nothing more: with a key, a Notation trust policy or a list of identities, it stops an artifact that nobody the writer trusts signed from supplying annotations, and a forger needs a signer the writer accepts as well as a registry write. A keyless cosign setup with no identity list accepts any Sigstore identity, which is why step 4 refuses it. What bounds a forged artifact is the value check against Git, the render check and the review of the pull request.

3. What is read, written and granted, and what never is

Read Written Granted Never
Executor, cluster get on ocirepositories of the group source.toolkit.fluxcd.io: the spec fields above, whether spec.verify is set and, for it, provider, whether secretRef is set and whether matchOIDCIdentity is empty, status.artifact.revision and status.artifact.metadata, the conditions Ready and SourceVerified nothing new one new get rule in its own ClusterRole, opt-in (below) list, watch, any write on the object; Secrets, ServiceAccounts, or the object's secretRef, serviceAccountName and the spec.verify secret or identity patterns followed or judged; a signature, a key or a certificate read or checked by the executor itself; the artifact's tarball or status.artifact.url (an HTTP call to source-controller); the registry, with or without credentials
Executor, Git the head of the declared branch, the ancestry of the annotated commit, files in the declared path, through the GitHub App of that repository the pull request, in a repository of the settings, as today no new App permission any repository not in spec.repositories; a path or branch taken from an annotation
Settings the declaration is written by whoever may write RemediationSettings, a cluster administrator read from the status
Analyzer, verifier nothing ocirepositories. The OCIRepository read and the comparison with the plan's repository live only on the executor's path (Verifier.Verify, not StatusReader.Status, flux.go); the analyzer's delivery status tool (get_delivery_status) is unchanged

The grant is opt-in. The chart gets the value executor.ociSources.enabled, default false, which renders a separate ClusterRole and ClusterRoleBinding with the one rule; kustomize gets the same as a separate component, as the analyzer's module grants (analyzer.modules in dist/chart/values.yaml, config/rbac/analyzer/modules/flux/kustomization.yaml). The default install stays as narrow as today. The rules are pinned by the RBAC test tables (test/rbac/rbac_test.go, the rows of gitrepositories are the model: executor get on ocirepositories allowed; executor list, watch and every write refused; analyzer and verifier refused on every verb) and by the chart tests (test/chart/chart_test.go, the table that holds the gitrepositories rows): the ClusterRole and its binding render only with the value on, and the default render has no rule on ocirepositories for any identity. With the value off and an entry declared, the mapping ends with OCISourceNotReadable, and the lookup page tells the operator to turn it on.

4. How the invariants hold

  1. Model output is never authorization. The declaration is settings written by an administrator, and the annotations are compared, not obeyed. Nothing from the artifact reaches the policy or the model. The plan digest covers repository, branch, path and build directory (the source.* fields in internal/policy/digest/digest.go, source.buildPath among them), and the freshness check compares them with the mapping it runs again (Checker.checkSource, freshness.go), so a declaration edited between the plan and the merge makes the plan stale (SourceChanged). This does not work yet: the call in Checker.checkSource passes only settings.Spec.Repositories. The build adds OCISources to sourcemap.Input and has freshness pass settings.Spec.OCISources. Without it every OCI request would go stale at the merge (it fails closed, so it is not a hole, but it is a failure).
  2. Closed catalog. No new action, parameter or patcher. The action still changes one declared field of one manifest in Git.
  3. Git only. The only write is the pull request the executor opens today, in a repository of spec.repositories, to the entry's targetBranch, in a file allowedPaths allows. The pipeline that builds the artifact is never touched.
  4. Cluster input is untrusted. The OCIRepository and the two annotations are input from whoever can write them. The annotations are only compared for equality with values the administrator declared, and a difference stops the request. They are never used as a repository, a ref, a path or a URL, never put in a message in full, and never shown to the model. Branch and commit are parsed with the parser that also parses Git revisions. Verification is a check on what the writer of the object chose, not on the origin (section 2, "What a verified source proves").
  5. Idempotent. The mapping adds no state. A restart maps again and gets the same answer or, after a new artifact, a fresh one.
  6. Separate identities. One new get for the executor only, cluster-wide like its gitrepositories rule (opt-in, off by default). The analyzer and the verifier get nothing. No registry credential, no Secret read, no new App permission. AGENTS.md invariant 6 is amended in the pull request that builds this, to list the grant and its chart value.

5. The merge commit, the delivery check and the verification

Three commits are in play:

  • The base commit of the pull request is the head of the declared branch when the request is mapped. It is not the artifact's commit. The artifact may be older than the head, so the mapping checks that the artifact's commit is the head or an ancestor of it, and relies on the existing value check (live value equals the value in Git at the head). A change between the artifact's commit and the head that touches the field makes the values differ and stops with ValueMismatch; one that does not is harmless.
  • The merge commit is recorded in the merge receipt as today (MergeReceipt in api/v1alpha1/remediationrequest_types.go, ADR-0030 section 1). Nothing about the receipt depends on the source kind.
  • The applied commit for an OCI unit is the commit in the revision annotation of the artifact the Kustomization applied. The adapter computes it only when lastAppliedRevision equals the current status.artifact.revision of the OCIRepository the Kustomization names, only when the annotated source names the plan's repository, and only when the OCIRepository passes, as it is at that read, the verification check of step 4: spec.verify set, SourceVerified True for the current generation, and a keyless cosign verification with at least one matchOIDCIdentity entry (skipped for an origin with verification: NotRequired; Verifier.Verify in flux.go takes the unit, the merge commit and the branch today, so the build passes it the plan's repository and the origin's verification value). An unverified source reads as Pending, like any other read that shows no applied commit, so a source whose verification was removed or stopped passing after the merge cannot report the change as applied (invariant 4). It fills AppliedRef and AppliedCommit from the annotation, as it does from lastAppliedRevision for a GitRepository (statusOf, flux.go). The attempted commit follows the same rule. AttemptedRef and AttemptedCommit are filled from the same annotation when status.lastAttemptedRevision equals the current status.artifact.revision (and the annotated source names the plan's repository, and the source passes the same verification check). statusOf fills them today for a GitRepository source only, and DeliveryStatus.Outcome ends Failed only when AttemptedCommit is the merge commit, so without this a failed apply of the merge's artifact could never end DeliveryFailed or DeliveryBlocked on the path with --verify-outcomes (endDelivery, phases.go; the path without it has no such ending). Then the existing comparison runs unchanged (DeliveryStatus.Outcome and Verify, delivery.go, ADR-0030 section 2). Otherwise the status is Pending: the executor never reads an older artifact's metadata (it is gone from the status) and never reads the registry. A failed attempt of an artifact that was replaced before it was read is not seen (limit (l)).

What protects the outcome is not the annotation. An artifact that names the merge commit early would make the delivery look applied before the merged change has arrived. Today that would let recordApplied and the move to Verifying happen, and the verification would read the old value and end Inconclusive with ValueChanged at once (verifyStep, phases.go), with a text that says a later commit overwrote the field (configured, phases.go), which is false there. The change that arrives later would never be verified.

For an OCI unit nothing is recorded as applied until the live value matches. In delivered, after the second answer is Applied (in delivered, rollout.go), an OCI unit counts as applied only when the target the function just read holds the desired value, by the comparison the verification uses (configured, phases.go). It reads nothing new. What differs from today:

  • While the value differs, delivered returns not applied, as it does for Pending. The request stays WaitingForDelivery and is requeued at the poll interval inside the window (deliveryStep, waitForDelivery), so a value that arrives late is seen. Nothing is recorded: no applied time, no generation, no template hash, no applied commit, and Verifying is not entered (deliveryStep, enterVerifying). This holds with and without --verify-outcomes, since both call delivered.
  • The request shows what any waiting delivery shows: phase WaitingForDelivery, Delivered Unknown with the reason DeliveryPending, and status.deadline at the end of the window (enterDelivery, phases.go). It shows no reason of its own: the wait is the delivery wait.
  • When the value matches, the applied time and the other fields are recorded in that write, the request moves to Verifying, and the verification reads the field again. A later difference then is a real later change, so ValueChanged and its text (configured, phases.go) stay true. Nothing in the verification or its deadline changes, and no second wait exists.
  • When the window has passed with the value still different and no read failing, the request ends as a delivery that was not seen, on each path as it does today:
  • With --verify-outcomes, endDelivery (phases.go) picks the ending from the last outcome: Failed for the merge commit ends Failed with DeliveryFailed, Failed for a later commit ends Inconclusive with DeliveryBlocked, a suspended unit DeliverySuspended, anything else Inconclusive with DeliveryNotObserved. These three other endings exist only on this path.
  • Without it, the rollout check ends with RolledOut False and DeliveryNotObserved whatever the outcome (waitForDelivery calling deliveryNotObserved, rollout.go). deliveryNotObserved takes the target only today; the build passes it the delivery (d), so it can see the last outcome.
  • The built-in DeliveryNotObserved message says the Kustomization was not seen applying the commit, which is not what happened here. So for an OCI unit whose last delivery outcome was Applied (d.outcome, in endDelivery and in deliveryNotObserved), the message says instead that an artifact naming the merge commit was applied and the field never held the desired value within the window. With any other outcome the existing messages stand.
  • The change is not verified and the ending is final.
  • If configured cannot read the field (it returns an error), that is a failed read: retried, and past the window and its grace DeliveryNotChecked (deliveryStep), never a verdict on the value.
  • The window is the existing one: deliveryWindowEnd (rollout.go) from the executor's own time of the move to Merged (MergeReceipt.MergedAt, set with the move to Merged in internal/controller/limits.go), plus the time writes were paused. Both ends of the comparison are the executor's clock, so no two clocks are compared. CI must build and Flux must pull within the hour (limit (d)).
  • A Git unit is unchanged.

The rollout status says where "applied" came from. The rollout status (status.rollout) gets a field appliedFrom, an enum recorded in the write that records appliedRevision (in deliveryStep; the same for the check without --verify-outcomes, in waitForDelivery):

  • GitRevision: the applied commit is the one in the Kustomization's lastAppliedRevision, a GitRepository source (today's only case);
  • OCIAnnotation: the applied commit is the one in the revision annotation of the artifact the Kustomization applied.

It is shown to the reader and read by no decision. Absent on a request recorded before the field existed. ADR-0030 gets a one-line pointer after acceptance, as ADR-0012 does.

A forbidden read of the OCIRepository during the delivery check (the opt-in grant is off, or was removed) is retried like any failed delivery read today (deliveryRetry, phases.go) and ends DeliveryNotChecked when the window and its grace have passed (deliveryStep). The one thing this ADR adds is that the cause is shown while it retries. The adapter marks the refused OCIRepository read as a lasting cause (providers.ErrForbidden from readError in flux.go is shared with the Kustomization read, so the build gives this read its own error, which names the grant), and lastingCause gets one case for it (phases.go). deliveryReadFailed then writes it into Delivered Unknown, and the final message names it (deliveryStep). The grant can be turned on meanwhile: each retry reads the object again. No new end path and no early end. Only Verifier.Verify makes this read; StatusReader.Status is unchanged and gets no grant on the kind.

6. Behaviour at the edges

Case End state Reason Why
No declaration for the OCIRepository NeedsIntervention, no Git write OCIOriginNotDeclared the repository and path cannot be known from the cluster; the message says what to declare
Declared, source, ref or commit not in the branch differs from the declaration NeedsIntervention, no Git write OCIOriginMismatch the declaration and the artifact disagree about where the files live; a person decides which is right. A tag ref is refused the same way
Declared, artifact has no source or revision annotation, or one that does not parse NeedsIntervention, no Git write OCIOriginUnrecorded see below
Declared, the executor may not read ocirepositories (at the mapping) NeedsIntervention, no Git write OCISourceNotReadable permanent until the grant exists
The delivery check may not read the OCIRepository (403 or 401) retried; shows the cause on Delivered; ends Inconclusive when the window and its grace pass DeliveryNotChecked the existing path for a failed read (deliveryStep); the grant can be turned on meanwhile
spec.verify unset, SourceVerified not True for the current generation, or a keyless cosign verification with no matchOIDCIdentity entry (and verification is Required) NeedsIntervention, no Git write OCISourceUnverified Flux did not accept the artifact, or accepted any Sigstore identity
An applied artifact, live value differs, window not passed (OCI unit) stays WaitingForDelivery, requeued Delivered Unknown, DeliveryPending the artifact may claim the merge commit early; nothing is recorded as applied
An applied artifact, live value differs, window passed (OCI unit) Inconclusive DeliveryNotObserved final; the change was not seen to arrive
Object missing, not Ready, suspended, with ignore or layerSelector, applied revision differs as for a GitRepository SourceNotFound, SourceNotReady, SourceOptions, RevisionMismatch the same rules, same reasons, same waits for a reconciling Kustomization
Ancestry call (operation read the ancestry of the artifact's commit): SHA-256 or malformed commit (ErrInvalidCommit), or commit unknown to the host (ErrNotFound) NeedsIntervention, no Git write OCIOriginUnrecorded, OCIOriginMismatch permanent answers, never retried
Ancestry call: 403 or 422 (ErrForbidden, ErrRejected) stops as any refused Git read GitForbidden, GitRejected a refusal is final (transient in sourcemap/errors.go, refusal in pullrequest.go)
Any other read or ancestry call fails (network, rate limit, 5xx) retried inside the bounded Git read wait, no stop none a failed read is never a verdict; the operation starts with read, so gitReadFailure counts it (gitReadFailure, gitread.go)
The Kustomization failed to apply the artifact of the merge commit (lastAttemptedRevision equals the current, verified artifact revision, OCI unit), window passed as for a GitRepository. With --verify-outcomes: Failed when the artifact's commit is the merge commit, Inconclusive when it is a later commit that holds it. Without it: RolledOut False DeliveryFailed, DeliveryBlocked (endDelivery, phases.go); without --verify-outcomes DeliveryNotObserved with the built-in text (deliveryNotObserved, rollout.go) the adapter fills AttemptedRef and AttemptedCommit from the annotation (section 5); the OCI message of DeliveryNotObserved is used only after an Applied outcome, so not here
An OCIRepository whose spec.ref sets digest, semver or semverFilter NeedsIntervention, no Git write SourceNotBranch it does not follow the pipeline's next artifact; the Git rule refuses the same pins
Delivery read after the merge: the current artifact fails the verification check of step 4 (verification: Required) read as Pending; past the window as any unseen delivery DeliveryPending, then DeliveryNotObserved a source whose verification was removed after the merge cannot report the change as applied
Other source kinds (Bucket, ExternalArtifact, HelmChart) NeedsIntervention UnsupportedSource unchanged

An artifact without annotations is refused, not accepted on the declaration alone. With the declaration alone the executor would have no evidence that the artifact has anything to do with the declared repository, so a wrong declaration (a mistyped path, a repository CI no longer builds from) would open pull requests that deliver nothing. It also could not tell a delivered merge from an undelivered one, since the artifact's revision names no commit: every request would wait the full hour and end DeliveryNotObserved. A pipeline records the annotations by adding --source and --revision to flux push artifact, which the CLI requires anyway.

Consequences

Clusters that deliver through OCI artifacts can get pull requests. The cost is an explicit declaration per OCIRepository, an artifact pipeline that records its source from the target branch and is verified by Flux, and one more opt-in grant.

Known limits:

  • (a) A verified source proves that Flux accepted a signer the writer of the OCIRepository chose, not that the artifact was built from the declared repository (section 2, "What a verified source proves"). Whoever holds the accepted key or identity can sign annotations that match any declaration; with verification: NotRequired, anyone who can write to the registry can set them. Step 4 refuses a keyless cosign setup with an empty identity list, but it counts entries and does not read patterns: a list whose pattern matches every identity (.*) passes and accepts any Sigstore identity, so for Required to mean something the patterns must name the pipeline. Step 4 only establishes that a verification is set and reported, not which keys or identities it accepts, so a key swapped or an identity pattern widened by whoever writes the object is not seen. In every case the annotations are a cross-check against mistakes and drift, not authentication.
  • (b) CI may change the files between Git and the artifact (a substitution step, a generated overlay). The mapping compares only the one field it will change. So is a file CI leaves out with --ignore-paths or --add-ignore-paths, or that source-controller leaves out: a declaration in such a file is found in Git by the scan and does not exist in what the cluster applies.
  • © The commit an OCI unit shows as applied comes from an annotation, cluster-side input, where for Git it comes from Flux. The wait of section 5 limits what that can do: nothing is recorded as applied until the live value matches, so an early claim cannot start the verification on the old value. What remains: a live value that matches the desired one for another reason while the merged change is still in transit records the request as applied, and a later overwrite by an older artifact ends it ValueChanged. That reason is a person who set the value by hand, or whoever can produce an artifact the OCIRepository accepts at the delivery read: the delivery read applies the verification check of step 4 to the current artifact (section 5), so an OCIRepository whose spec.verify was removed, or whose verification fails, after the merge reports nothing as applied. That check counts identity entries and reads no key or pattern, so it does not see a secretRef pointed at another key or a pattern widened to .*. So the producer is the signer the OCIRepository accepts at that read, any signer when the identity list is wide (limit (a)), or any registry writer under verification: NotRequired. That producer can push an artifact that holds the desired value and names the merge commit before CI builds the real one, so delivered records the applied time, the request moves to Verifying and the verifier can report Cleared for a value that never came from the merged commit. The value is the desired one, so a wrong value does not clear; what is wrong is the attribution: the outcome is credited to the pull request although the merged change did not cause it. For an OCI unit, appliedFrom OCIAnnotation therefore means the outcome is only as trustworthy as the signer the OCIRepository accepts when the change is read as applied, and the verification page says so where it explains appliedFrom. A change that never arrives costs the whole window and ends DeliveryNotObserved instead of an earlier end. A forged annotation can also delay or deny that end.
  • (d) The artifact is built after the merge, so the one-hour window includes the CI run and Flux's poll interval. A slower pipeline ends DeliveryNotObserved with the change possibly delivered later.
  • (e) The delivery is read only while the applied artifact is the current one. Two artifacts in quick succession can leave no moment where the merge commit's artifact is both applied and current. The later one descends from the merge commit and counts. A Kustomization that applied an artifact that is then replaced and never applies another one shows Pending.
  • (f) The source annotation is compared as a string. A pipeline that records an ssh:// or git@ form never matches until it records the HTTPS form. Case is folded for GitHub names only.
  • (g) A wrong path that still finds one declaration with the right live value opens a pull request in the wrong directory. The render check runs on the build directory the path implies, so it fails when that directory does not build to the same objects; it does not prove the path is the right one.
  • (h) kubectl shadewright doctor and the analyzer's get_delivery_status compare only with a GitRepository (CompareSource in fluxrules/flux.go). They keep reporting an OCI source as not compared until a follow-up teaches them, and the analyzer's Flux grant is not widened here.
  • (i) The list the mapping copies (fluxExcludes in internal/gitops/repopath/generate.go) is source-controller's list for a GitRepository. Source-controller's OCI exclusions and the excludeOCI default of flux push artifact are separate lists upstream. The builder compares them with the copied one before it reuses it for an OCI source; a difference is a bug in the build, not a decision.
  • (j) A declared OCIRepository whose spec.url is later pointed at another artifact keeps its declaration. The annotations are still compared on every mapping, so another origin ends OCIOriginMismatch, but a pipeline that copies the annotations and is accepted by spec.verify passes. The trust in spec.url, spec.ref and spec.verify rests with whoever may write the OCIRepository object.
  • (k) The executor reads OCIRepository at source.toolkit.fluxcd.io/v1, served from Flux 2.6 (source-controller 1.6.0, section "What the upstream Flux API gives"). On an older Flux the get returns a no-match error, the mapping ends SourceNotFound and the message says the object does not exist. The build words that case as "the kind is not served at v1". This follows the standing rule: Flux kinds are read at v1 only and beta versions are not read (docs/design/2-architecture.md, section 2.5.2, "beta versions are not read"; the compatibility page's Flux row says the same). v1beta2 is not read, so an OCI source needs Flux 2.6 while the rest of the mapping works from Flux 2.3; the design line and the compatibility page say so when this is built (build item 5).
  • (m) A spec.ref.tag that the pipeline never moves passes step 3: the executor cannot tell a moving tag from a fixed one without the registry. The merged change then never arrives in the cluster, and the request ends DeliveryNotObserved after the window. The cost is one pull request, merged for nothing, that a person has to undo or follow up, and the hour of the window.
  • (l) The attempted commit is read only while the failed artifact is the current one (limit (e) for the applied one). A failed apply of the merge's artifact that is replaced by another artifact that has not been tried yet shows Pending, and the request can end DeliveryNotObserved instead of DeliveryFailed.

Alternatives considered

  • Option 1, the declaration alone. Explicit, and no trust in the artifact. But nothing ties the artifact to the declared repository, and the delivery check could not work: the revision of the artifact is no commit, so every request would end DeliveryNotObserved or need a second mechanism to tell a delivered merge. Refused for the reasons of section 6.
  • Option 2, the annotations alone. The annotations do not say the path, so the path would have to be guessed. They are also set by whoever writes to the registry, so a registry writer would choose where a pull request goes, within the repositories of the settings. That is invariant 4 turned around: input from outside decides a destination. Adding a verification requirement on top is adopted (section 2, step 4) as defence in depth only.
  • Tie a keyless signature to the declared repository (an identity rule). An earlier draft required, for keyless cosign on GitHub, that matchOIDCIdentity be an exact literal naming the declared repository. Rejected, for two reasons. The signing identity of a GitHub workflow names the called workflow (job_workflow_ref is "for jobs using a reusable workflow, the ref path to the reusable workflow", GitHub's OIDC reference, read 2026-11-19), so a run in another repository that calls a reusable workflow of the declared one gets the same subject. And trustedRootSecretRef lets the writer of the OCIRepository supply a trusted root that can mint any subject. The rule would claim a tie it does not provide, and it needs the executor to parse patterns written by someone else.
  • A GitRepository kept next to the OCIRepository, used only for the mapping. The mapper could then reuse every Git rule. But the Kustomization does not deliver from that GitRepository, so its lastAppliedRevision and Ready say nothing about it, and nothing would tie it to the artifact that is applied. The cluster would also fetch a repository only to give the executor a URL, with credentials for it. It trades a declaration in the settings for an object in the cluster that proves less.
  • Require the OCIRepository object to be delivered from Git. Not adopted here, and left for an ADR of its own. It would put spec.url, spec.ref and spec.verify through review in Git, but two reasons keep it out. First, for an object whose author controls it, the requirement can be met in two ways unless it also names the delivering Kustomization: a path in any listed repository, and a Kustomization in another namespace that points at another reviewed directory. Second, checking it at the delivery read needs a read of Git files that the verifier does not have.
  • Declaring a branch, or a list of refs. See section 1 and section 2, step 6: a branch field can only repeat or contradict targetBranch, and a list of refs needs its own threat note.
  • Reading the artifact's content from source-controller. It would let the mapping read the files that Flux applies. It needs a network path and a grant to source-controller's artifact server, widens the executor's reach much further, and gives content that is again from the cluster side. Not taken.

What is to be built

  1. API: spec.ociSources with its CEL rules (including verification, default Required), generated manifests and CRD docs; the settings reference page; the rollout status field appliedFrom (GitRevision, OCIAnnotation).
  2. Mapping: fluxrules rules for an OCIRepository source, the new reasons (among them OCISourceUnverified), the declaration, the verification check (step 4) and the ancestry check in sourcemap, the spec.ref rule of step 3 (SourceNotBranch, with the doc comment of ReasonSourceNotBranch widened), the ref rule of step 6, the freshness check with the new input (sourcemap.Input.OCISources, passed from settings.Spec.OCISources), with the OCIRepository recorded in Observed, read again after the scan and rechecked by freshness; the reasons added to the metrics list (denialReasons in internal/controller/metrics.go) and to the explain table (cmd/kubectl-shadewright/explain.go).
  3. Delivery: AppliedRef, AppliedCommit, AttemptedRef and AttemptedCommit from the annotation of the current artifact (lastAppliedRevision and lastAttemptedRevision each equal to its revision), the plan repository check, the verification check of step 4 and (with the plan's repository and the origin's verification passed to Verifier.Verify), Pending otherwise; the OCI message of DeliveryNotObserved only after an Applied outcome, in endDelivery and in deliveryNotObserved, which is given the delivery; the read of the OCIRepository only in Verifier.Verify; the lasting cause of a refused read; in delivered, an OCI unit applied only while the live value matches, with the OCI message at the end of the window; appliedFrom recorded.
  4. RBAC: the opt-in ClusterRole in the chart and as a kustomize component, with the RBAC and chart test tables of section 3; AGENTS.md invariant 6 and the design document updated with the grant; the threat model (docs/threat-model.md) gets the grant and the new actors the decision relies on, which its trusted computing base and actor lists do not name today: the writer of an OCIRepository (who chooses the source, the verification and its signer; limits (a) and (j)), the registry writer (limit (a) with verification: NotRequired), the accepted signer (limits (a) and ©) and the CI pipeline that builds the artifact (limit (b)). Each gets its Can and Cannot lines from those limits, and the executor's entry lists the OCIRepository read.
  5. Docs: the reasons page (docs/reasons.md), the delivery table of docs/troubleshooting.md (its UnsupportedSource row says "Use a Git source"), the how-it-works source mapping page, a how-to for declaring an OCI source and for flux push artifact --source --revision; the settings reference and the how-to say that a keyless cosign verification needs matchOIDCIdentity and that the patterns must name the pipeline; the page that explains appliedFrom says what limit © says; the Flux line of the design (docs/design/2-architecture.md, section 2.5.2, today "Flux 2.3 and later; beta versions are not read") and the Flux row of docs/reference/compatibility.md say that an OCI source needs Flux 2.6 (limit (k)).
  6. Tests that fail without the change: one per reason, the 403 case, the retry cases, a forged annotation that names another repository, and a lab run with an artifact pipeline. Also, each failing without its change:
  7. Path: a spec.path of ../x and of ../../x under a declared path ends InvalidPath (it fails against Join(declared, spec.path)); a mixed-case annotation of a GitHub repository matches; the OCIRepository changing resourceVersion mid-scan is a retry.
  8. Verification: a keyless cosign verification (no secretRef) with an empty matchOIDCIdentity ends OCISourceUnverified although SourceVerified is True, and maps with one entry; a cosign verification with a secretRef and an empty list maps; an OCIRepository without spec.verify, one with SourceVerified False (VerificationError) and one whose condition has an old observedGeneration each end OCISourceUnverified; with verification: NotRequired the first maps. A key-based and a Notation verification map.
  9. spec.ref: an OCIRepository with spec.ref.digest, one with spec.ref.semver and one with spec.ref.semverFilter each end SourceNotBranch; one with spec.ref.tag and one without spec.ref map.
  10. Ref: an annotation with a tag, with refs/heads/<branch> and with another branch each end OCIOriginMismatch.
  11. Ancestry, one test per class: ErrInvalidCommit gives OCIOriginUnrecorded; ErrNotFound gives OCIOriginMismatch; a 403 and a 422 stop with GitForbidden and GitRejected; a 5xx, a rate limit and a network error retry, and a failed attempt counts toward the bounded Git read wait.
  12. Freshness: an artifact replaced between the plan and the merge by one that matches the declaration leaves the plan fresh; one that does not makes it stale with SourceChanged; one replaced while the check runs makes it a retry; an OCI request stays fresh across an unrelated merge and goes stale when the declaration's path or repositoryRef changes (envtest); spec.verify removed from the OCIRepository, or SourceVerified set False for its current generation, between the plan and the merge makes the plan stale with SourceChanged (the whole mapping runs again, so step 4 stops it).
  13. Delivery: a 403 on the OCIRepository is retried, shows its cause on Delivered and ends DeliveryNotChecked when the window and grace pass, where a 403 on a GitRepository shows no cause as today; the analyzer's delivery status tool reads no OCIRepository and the analyzer has no grant on the kind.
  14. Failed apply, per path. The adapter: a Kustomization with a failing condition whose lastAttemptedRevision is the current, verified artifact, annotated with the merge commit, gives the outcome Failed (it gives Pending against the adapter of main); with a lastAttemptedRevision of an older artifact, or an unverified current one, Pending. With --verify-outcomes, at the end of the window: the merge commit ends Failed with DeliveryFailed, a later commit that descends from it Inconclusive with DeliveryBlocked, each with its existing message, never the OCI one. Without --verify-outcomes: the same states end with RolledOut False, DeliveryNotObserved and the built-in text, never the OCI one.
  15. Delivery verification: an OCIRepository whose spec.verify is removed, or whose SourceVerified turns False, after the merge while its artifact names the merge commit reads as Pending, records nothing as applied and ends DeliveryNotObserved at the end of the window; with verification: NotRequired it records applied.
  16. Early artifact: an OCI unit whose Kustomization reports the merge commit applied while the field holds the old value records nothing and stays WaitingForDelivery; it records the applied time and moves to Verifying when the value arrives; when the window passes it ends Inconclusive with DeliveryNotObserved and the OCI message with --verify-outcomes, and RolledOut False with DeliveryNotObserved and the OCI message without it; a Git unit in the same state still records applied at once. appliedFrom is GitRevision for the Git unit and OCIAnnotation for the OCI unit.
  17. RBAC: the executor get on ocirepositories only, with the value on; no rule for any identity with it off; nothing for the analyzer and the verifier either way.

Amendments

None.