-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Feature Description
The CDEvents specification should allow propagating identifiers from consumed events into produced events.
When an activity is directly started as a consequence of a consumed CDEvents, an identifier of the consumed event must be included in the produced events related to the activity.
When an activity is directly started as a consequence of a consumed event (non CDEvent), an identifier of the consumed event may be included in the produced events related to the activity.
Use Cases
Children Pipelines
When a pipeline runs, it generates events as different tasks are started and finished. Children pipelines may be triggered by these events (whether in the same CD system or a different one), and they will in turn send events.
As a DevOps engineer I want to be able to discover children pipelines from the events they generated.
Proposal
These are the spec fields that would be required for CDEvents.
Field Name | Type | Description | CloudEvents Binding | Notes |
---|---|---|---|---|
id | string | Event identifier | id | Unique for a source |
source | URI-reference | Producer of the event | source | May be globally unique? |
subject | string | Producer of the event | source | May be globally unique? |
cdevents_platform | string | Platform namespace for sources | <extension> | Only needed is source is not globally unique |
cdevents_source | URI | Globally unique source | <extension> | Only needed is source is not globally unique |
cdevents_source-event | string | Globally unique source event identified | <extension> | Serialised source + id / cdevents_platform + source + id / cdevents_source |
We already use id and source in our PoC, however we do not specify them in our spec, but we should add them.
The source-event
field is a globally unique identified of another event, which was the trigger to the activity identified by "source + subject".
CloudEvents have a Source and ID attached to them. Each instance of each platform is responsible for generating unique Source + IDs for its events, but it's not required for one platform to guarantee global uniqueness.
-
If we enforce global uniqueness, it would responsibility of the administrator of the overall system to ensure each source is configured with a globally unique value (e.g. a DNS name) that can be used to generated the various sources.
-
If we do not enforce global uniqueness, we could introduce the cdevents_platform extension or the cdevents_source extension to provide a globally unique value. Again it would be responsibility of the overall administrator to configure a globally unique seed. Alternatively platform could use some strategy to pick a name that is likely to be globally unique. Examples:
{
"specversion" : "1.0",
"type" : "cd.events.taskrun.started",
"source" : "/apis/tekton.dev/v1beta1/namespaces/default/taskruns/curl-run-6gplk",
"subject" : "my-taskrun-123",
"id" : "A234-1234-1234",
"time" : "2018-04-05T17:31:00Z",
"cdeventssource" : "tekton_ci_prod/apis/tekton.dev/v1beta1/namespaces/default/taskruns/curl-run-6gplk",
"cdeventsplatform" : "tekton_node123_clusterABC",
"cdeventssourceevent": "A123-5678-9012@jenkins_ci_prod/pipeline/my-source-pipeline",
"datacontenttype" : "text/json",
"data" : "{}"
}
Open Questions
It may not be possible for a platform to implement the source-event extension in all outgoing events, because of a few reason:
- if
cdevents
are implemented via an adaptation layer, the information about the source event may not be there at all - not all activities that require a cdevent may have a source-event associated. This happens typically with core events, where the end of a task run or pipeline run is not triggered by an event. In that case, when an activity is finished, there will be no source-event associated
This means that a consumer of events that would like to visualise the end to end workflow triggered by an initial event will have to use a combination of source-event, subject and event type to discover all relevant events.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status