Skip to content

Usage of CloudEvents "subject" #11

@afrittoli

Description

@afrittoli

Feature

We should document in the CloudEvents binding document how the subject should be populated when sending CDEvents.

Proposal

All CDEvents are related to an activity and an entity - like taskrun started or artifact published.
Entities are identified by an ID which we could use to fill in the subject of the CloudEvents.
That would allow CloudEvents consumers to easily filter events based on the subject.

Example:

{
    "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" : {
        "taskrun" : {
            "id": "my-taskrun-123", <=====
            "task": "my-task",
            "status": "Running",
            "URL": "/apis/tekton.dev/v1beta1/namespaces/default/taskruns/curl-run-6gplk"
        }
    }
}

Metadata

Metadata

Assignees

Labels

cloudeventsSpecification - CloudEvents BindingspecSpecification - Core CDEvents

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions