Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of CloudEvents "subject" #11

Closed
afrittoli opened this issue Jan 25, 2022 · 5 comments
Closed

Usage of CloudEvents "subject" #11

afrittoli opened this issue Jan 25, 2022 · 5 comments
Assignees
Labels
cloudevents Specification - CloudEvents Binding spec Specification - Core CDEvents
Milestone

Comments

@afrittoli
Copy link
Contributor

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"
        }
    }
}
@afrittoli afrittoli added the cloudevents Specification - CloudEvents Binding label Jan 25, 2022
@afrittoli afrittoli added this to the v0.1 milestone Jan 25, 2022
@erkist
Copy link

erkist commented Jan 26, 2022

Your proposal makes a lot of sense to me. The type field would say what we are doing, and the subject field would say what we are doing it on/with/for.

I think we might need to provide a clear table in the spec stating for each event type what exactly the subject should be, just for clarity.

@afrittoli
Copy link
Contributor Author

Your proposal makes a lot of sense to me. The type field would say what we are doing, and the subject field would say what we are doing it on/with/for.

I think we might need to provide a clear table in the spec stating for each event type what exactly the subject should be, just for clarity.

Yeah, that's a great idea.
The setup that I'm forming in my mind is, for each event a few elements will go in the CloudEvents context.
We could consider id and source as general cdevents context, mapped to CloudEvents context.
subject instead would map to a different event field based on the event type i.e. PIpelineRun ID, Environment ID etc..

afrittoli added a commit to afrittoli/cdevents-spec that referenced this issue Feb 11, 2022
Restructure a the spec root page, add more sections and introduce
the initial terminology, including subjects and actions.

This provides the basis for restructuring the vocabulary and
defining the schemas that will be used to build the SDKs.

Partially addresses: cdevents#12
Related to: cdevents#11

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
afrittoli added a commit to afrittoli/cdevents-spec that referenced this issue Feb 11, 2022
Restructure a the spec root page, add more sections and introduce
the initial terminology, including subjects and actions.

This provides the basis for restructuring the vocabulary and
defining the schemas that will be used to build the SDKs.

Partially addresses: cdevents#12
Related to: cdevents#11

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
afrittoli added a commit to afrittoli/cdevents-spec that referenced this issue Feb 14, 2022
Restructure a the spec root page, add more sections and introduce
the initial terminology, including subjects and actions.

This provides the basis for restructuring the vocabulary and
defining the schemas that will be used to build the SDKs.

Partially addresses: cdevents#12
Related to: cdevents#11

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
afrittoli added a commit to afrittoli/cdevents-spec that referenced this issue Feb 15, 2022
Restructure a the spec root page, add more sections and introduce
the initial terminology, including subjects and actions.

This provides the basis for restructuring the vocabulary and
defining the schemas that will be used to build the SDKs.

Partially addresses: cdevents#12
Related to: cdevents#11

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
afrittoli added a commit to afrittoli/cdevents-spec that referenced this issue Feb 15, 2022
Restructure a the spec root page, add more sections and introduce
the initial terminology, including subjects and actions.

This provides the basis for restructuring the vocabulary and
defining the schemas that will be used to build the SDKs.

Partially addresses: cdevents#12
Related to: cdevents#11

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
afrittoli added a commit to afrittoli/cdevents-spec that referenced this issue Feb 15, 2022
Restructure a the spec root page, add more sections and introduce
the initial terminology, including subjects and predicates.

This provides the basis for restructuring the vocabulary and
defining the schemas that will be used to build the SDKs.

Partially addresses: cdevents#12
Related to: cdevents#11

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
afrittoli added a commit to afrittoli/cdevents-spec that referenced this issue Feb 16, 2022
Restructure a the spec root page, add more sections and introduce
the initial terminology, including subjects and predicates.

This provides the basis for restructuring the vocabulary and
defining the schemas that will be used to build the SDKs.

Partially addresses: cdevents#12
Related to: cdevents#11

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
afrittoli added a commit to afrittoli/cdevents-spec that referenced this issue Feb 16, 2022
Restructure a the spec root page, add more sections and introduce
the initial terminology, including subjects and predicates.

This provides the basis for restructuring the vocabulary and
defining the schemas that will be used to build the SDKs.

Partially addresses: cdevents#12
Related to: cdevents#11

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
afrittoli added a commit that referenced this issue Feb 16, 2022
Restructure a the spec root page, add more sections and introduce
the initial terminology, including subjects and predicates.

This provides the basis for restructuring the vocabulary and
defining the schemas that will be used to build the SDKs.

Partially addresses: #12
Related to: #11

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
@m-linner-ericsson
Copy link
Contributor

With https://github.com/cdevents/spec/blob/main/spec.md#subject in mind: What would the subject look like in cloud events?

@afrittoli
Copy link
Contributor Author

With https://github.com/cdevents/spec/blob/main/spec.md#subject in mind: What would the subject look like in cloud events?

Since CloudEvents include the source in the headers, subject should be the ID of the CDEvents subject, which is unique within the source.

@afrittoli afrittoli added the spec Specification - Core CDEvents label Feb 21, 2022
@afrittoli afrittoli self-assigned this Jun 14, 2022
@afrittoli
Copy link
Contributor Author

Adressed by #35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cloudevents Specification - CloudEvents Binding spec Specification - Core CDEvents
Projects
Status: Done
Development

No branches or pull requests

3 participants