Skip to content

feat(targetrollout): add targetRollout subject and queued/started/finished events - #328

Open
xibz wants to merge 4 commits into
cdevents:mainfrom
xibz:target-rollout
Open

xibz wants to merge 4 commits into
cdevents:mainfrom
xibz:target-rollout

Conversation

@xibz

@xibz xibz commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #319 (deployment.queued/started/finished), per @afrittoli's review: landing deployment on its own first, with targetRollout proposed separately here now that there's a concrete use case and one open PR of implementation experience to point to.

What this adds

targetRollout — the act of deploying a release unit against a single destination within a tier (for example the us-east-1 cluster within production, or a named blue/green slot), as one part of a deployment. It has the standard queued/started/finished lifecycle, a required deploymentId back-reference to its parent deployment, and failureType on finished for per-destination failure detail.

Each targetRollout carries:

Why tier and not environment

The environment subject is defined as "a platform which may run a service", and in practice it is widely used to mean a specific cluster. Using it for the logical environment made "target is a location within the environment" read as "a cluster within a cluster". Rather than redefine an existing subject, the logical concept gets its own name, and the environment subject section points to tier for anyone looking for it.

Why this isn't a new execution model

The concern raised on #319 was that giving targetRollout its own independent lifecycle "encodes one execution model." But this is the same shape the spec already has for pipelineRun/taskRun: a parent orchestration entity fans out to child execution units, each with its own queued/started/finished. targetRollout under deployment is that same pattern, not a new one. A producer that genuinely fans a deployment out to multiple destinations already has to track per-destination timing to coordinate the rollout in the first place — this just gives that internal fact a standard external shape. A producer that deploys to exactly one destination, or that calls a single atomic multi-region API with no per-destination visibility, simply doesn't emit targetRollout — same as any other optional CDEvents subject.

Together, tier and target also make "what was rolled out to production, and where" a direct query over targetRollout events. Today it has to be inferred from service events, whose environment reference points the other way: from the running entity back to whatever platform it happens to run on.

Depends on #319 — this diff will be just the targetRollout additions once that merges.

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

xibz added 2 commits August 13, 2026 11:33
…events

Deployments today are only visible as a side effect of a service state
change (service.deployed/service.upgraded), with no way to observe the
orchestration act itself: when a rollout started, when it finished, or
how long it took. This adds deployment as its own subject with the
standard queued/started/finished lifecycle, giving DORA-style tooling
an explicit deployment-duration/outcome fact independent of the
resulting service entity.

service.deployed/service.upgraded are unchanged; whether to deprecate
them is a separate decision left for a follow-up once deployment.* has
implementation experience.

The original proposal also included a targetRollout subject to model
fan-out to multiple destinations within one deployment; that's split
into a separate follow-up PR pending more implementation experience.

Signed-off-by: xibz <bjp@apple.com>
…ished events

Follow-up to the deployment subject: targetRollout models a single
destination within a deployment's environment (a region, canary slot,
or named blue/green slot), giving environment a first-class inbound
link to what was rolled out into it, and giving consumers per-
destination outcome/failureType detail when a deployment fans out to
more than one target.

This mirrors the pipelineRun/taskRun split already in the spec: a
parent orchestration entity (deployment/pipelineRun) fans out to child
execution units (targetRollout/taskRun), each with the standard
queued/started/finished lifecycle.

Stacked on the deployment subject (see the deployment branch/PR) since
targetRollout's deploymentId reference and docs build on it.

Signed-off-by: xibz <bjp@apple.com>
Comment thread schemas/_defs/targetrollout.json Outdated
{
"$id": "cdevents/_defs/targetrollout",
"term": "TargetRollout",
"definition": "A TargetRollout is a specific destination within an environment to which a release unit may be deployed and made available. A TargetRollout is always contained within an environment. Multiple TargetRollouts may exist within a single environment.",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused here. I thought a TargetRollout was an activity that can be queued, started and finished . In here it is defined as a destination, which seems inconsistent. Can you clarify?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! The definition was wrong, not the model. A targetRollout is the activity: rolling a deployment out to one target within an environment. The destination itself is already captured by target and environment. I've reworded the definition, examples, and counterExamples accordingly (and moved "a canary slot" to counterExamples, since that's the place, not the rollout). I'd rather not rename to targetRolloutRun: unlike pipeline, there's no static "rollout" definition entity for the Run to distinguish from, "rollout", like "deployment", already names the act.

Comment on lines +109 to +114
"required": [
"name",
"target",
"environment",
"artifactId"
]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was expecting the deploymentId to be required. Could you describe a use case where it would not be set?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I couldn't come up with a solid case for a rollout without a parent deployment. A producer with a single destination and no aggregate can just emit deployment events. deploymentId is now required on queued, started and finished.

Comment on lines +128 to +133
"required": [
"name",
"target",
"environment",
"artifactId",
"outcome"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: this could be:

  "required": ["name", "target", "environment", "artifactId", "outcome"],
  "if":   { "properties": { "outcome": { "const": "failure" } } },
  "then": { "required": ["failureType"] },
  "else": { "not": { "required": ["failureType"] } }

to enforce that failureType must be there in case of failure and must not be there in case of success.
That said, we don't have that in other schemas, although it would be nice to add.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it, but since no other schema uses conditional validation yet, I'd rather not make this one the odd one out. I'll open a follow-up that applies it across all outcome-bearing schemas together. That follow-up also needs to settle whether failureType should be allowed with outcome: error (your else branch would reject it).

Comment thread conformance/targetrollout_started.json Outdated
"id": "test123"
},
"artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427",
"deploymentId": "mySubject123"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be different from the subject.id? I think having the same value is confusing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, that made the example read as if the rollout were the deployment. The parent now has its own id (myDeployment123) in all three targetrollout_* conformance examples.

- Redefine targetRollout as the act of deploying a release unit to a
  single destination, not the destination itself. The destination is
  already identified by the target and environment fields, and the
  queued/started/finished lifecycle only makes sense for an activity.
  Examples and counterExamples updated to match.
- Make deploymentId required on queued/started/finished: a target
  rollout is always part of a deployment.
- Give the parent deployment a distinct id in the targetRollout
  conformance examples so it no longer reads as the subject itself.

Signed-off-by: xibz <bjp@apple.com>
@xibz
xibz requested a review from afrittoli October 13, 2026 17:13
@xibz

xibz commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

@afrittoli - thanks Andreaa! Can you take a look again?

@afrittoli afrittoli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates, I still have some questions, I'm sorry I missed this in the initial review.

Comment thread continuous-deployment.md Outdated
|-------|------|-------------|----------|
| id | `String` | See [id](spec.md#id-subject)| `rt-us-east-1-8f3a2c` |
| source | `URI-Reference` | See [source](spec.md#source-subject) | `/cd/deploy-controller` |
| name | `String` | Name of the target rollout | `canary`, `us-east-1`, `blue-slot` |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name here still seems to refer to the targetRollout as being a place rather than an activity

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, name was a leftover. The rollout is identified by subject.id, the same way deployment is, and the destination by target. I've removed name from the subject, all three predicates and the conformance examples.

Comment thread schemas/_defs/targetrollout.json Outdated
{
"$id": "cdevents/_defs/targetrollout",
"term": "TargetRollout",
"definition": "A TargetRollout is the act of deploying a release unit to a single destination within an environment, as one part of a Deployment. The destination itself is identified by the TargetRollout's target and environment.",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say the deployment is performed against a destination environment, or a destination in an environment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That reads better, thanks. I've adopted it, with one change explained in the next thread: it now reads "the act of deploying a release unit against a destination in a tier, as one part of a Deployment."

Comment thread continuous-deployment.md Outdated
Comment on lines +68 to +69
| target | `URI-Reference` | Location identifier of where the artifact is being deployed to | `cdevents:v0:argo::my-org:prod-cluster:environment:us-east-1` |
| environment | `Object` ([`environment`](#environment)) | Reference to the containing environment | `{"id": "production"}` |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The relationship between target and environment is a bit unclear to me.
The latter is a reference to an environment, the subject in CDEvents, which is clear.
The target I guess represents a specific location within that environment, is that correct?
Is there any connection between the data in the URI-reference and that in the environment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've put your finger on the real problem. The field was meant to be the logical environment (production), because it's what consumers key on to compute lead time to deploy. But the environment subject is defined as "a platform which may run a service", and in practice it's widely used to mean a specific cluster. So "target is a location within the environment" reasonably reads as "a cluster within a cluster".

Rather than redefine environment, I've given the logical concept its own name: tier (a string, e.g. production, staging), defined in schemas/_defs/tier.json. target is the concrete destination within that tier, e.g. the us-east-1 cluster that's part of production. One tier contains many targets, and a deployment to production fans out into one targetRollout per target. target is opaque to CDEvents, but it must identify a destination belonging to the tier.

The same rename applies to deployment in #319, and the environment subject section now points to tier for anyone looking for the logical environment. The example is consistent too: "tier": "production" with target: cdevents:v0:argo::my-org:production:cluster:prod-us-east-1.

- Remove name: the rollout is identified by subject.id, like
  deployment, and the destination by target.
- Replace the environment reference with tier (the logical
  environment, used to compute lead time to deploy); target is the
  concrete destination within it, typically a cluster.
- Reword the definition: the act of deploying an artifact against a
  destination in a tier.
- Version the new targetRollout events 0.1.0-draft and replace
  "release unit" with "artifact", matching the deployment review.

Signed-off-by: xibz <bjp@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants