-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add syntax details for attributes in CDEvents #30
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loads of questions :)
|
||
- Constraints: | ||
- REQUIRED | ||
- MUST be a non-empty string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we have it some versions available, should we link to list of valid versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each version of the spec will refer to its own version only, link in L156.
Once we have more than one version, the docs website will include a dropdown with list of available versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 156 in this document?
Was your idea to have state the version as the only valid value?
My idea with a list was for to ease for the reader finding the valid range of version available
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list of valid version will be listed on top of the documentation, so it should be easy to discover.
The main reason for me is that if I'm browsing a specific version of the spec, I should only use that version in my events. Also I would not like to keep cross-version information in version specific pages.
I'd be happy to include the list of versions in the main README as long as we keep it independent of the versioned docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So your idea was to put the spec version as the only valid field?
Maybe add something like
MUST be the version of the event/spec used for producing the event
"taskrun" : { | ||
"id": "my-taskrun-123", | ||
"task": "my-task", | ||
"status": "Running", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we don't need to include this as the event type predicate already tells us this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly, or it could provide more insight. Again, this matches what we have in the vocabulary today - if we change the vocabulary we need to update these examples accordingly, but for this PR I would not go and touch the vocabulary part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then you need to help me. Were do we state in the vocabulary that the should have the status here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not include the status
field in subject object but only use it to define the subject itself as I guess it will be the same subject object in all events of the same subject disregarding the predicate. For example both taskrun.started
and taskrun.finished
would have the same subject object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then you need to help me. Were do we state in the vocabulary that the should have the status here?
It's in here https://cdevents.dev/docs/core/ but it's only defined for PipelineRun
, not for TaskRun
. I didn't realise that, it seems to be incomplete. I can use a PipelineRun
instead of a TaskRun
in the example if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not include the
status
field in subject object but only use it to define the subject itself as I guess it will be the same subject object in all events of the same subject disregarding the predicate. For example bothtaskrun.started
andtaskrun.finished
would have the same subject object.
Can we discuss the objects in the vocabulary in the next PR once I update those?
If we change the structure or add/remove fields, I will update this example accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so you want to include all the pipeline attributes in the subject object? From your comment above I got it that you didn't want to. I would still vote to not include it but if you want to proceed with the PR you can keep it 😄
spec.md
Outdated
- REQUIRED | ||
- MUST be a non-empty string | ||
|
||
### OPTIONAL Event Attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you feel this part drags out in time you could maybe move this part to an own PR as the previous items were quite straight forward.
- Considering the event type `dev.cdevents.taskrun.started`, an example of | ||
subject, serialised as JSON, is: | ||
|
||
```json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in Eiffel we have our two events:
- Activity Triggered giving the activity a name, including the possibility to give a category, and also describe how the activity was triggered
- Activity Started linking back to the Activity Triggered but containing the execution URI and links to logs to find more information.
In your example I guess the id
would be the same as name
in our Activity Triggered event. The URL
would be the executionUri
Activity Started event. I am trying to figure out how the task
would map. What would you use it for? The closest thing I can think of is the categories
filed in the Activity Triggered event. Would you say the task
would be used to group events together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ID
usually represents the unique identifier of the subject within the event source.
I think all subjects we define will have an ID
, but this is defined in the vocabulary really.
Subjects will have different attributes, task
is only valid for taskrun
for instance.
The task
is an identifier of the definition that is executed in the taskrun
.
Here I'm just including what we have in the vocabulary today.
In terms "triggered" vs "started" - in CDEvents, they would be predicates
and - at least for now - they vary event by event. There may be an opportunity to reduce the number of predicates and make them standard across events, but we'll have to see if it works well or not.
The separation of subjects
in "long running" and "run to completion" could help create a standard set of predicates
, one for each group... but it may turn out that it's not actually possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Eiffel as we have a triggered event and then link back to it so we don't need to worry about the uniqueness of an ID. So from my view we are talking about:
ID
: unique identifiertask
: A human friendly display name for the task instanceURL
: the link to the task instance
If I understand correctly it would be more logical if task
was Run of my-task #123
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The data model for PipelineRun
and TaskRun
was inspired by Tekton - here is what we have today: https://cdevents.dev/docs/core/
In Tekton, Task
and Pipeline
are the static definition of what a Task
and a Pipeline
should do.
TaskRun
and PipelineRun
are executions of a Task
and a Pipeline
respectively.
In CDEvents we only have the object TaskRun
and PipelineRun
and they include a few bits of data, including the name of the Task
/ Pipeline
. The URL is an optional field that points to the execution - it could be for instance a deep-link URL into the Tekton dashboard to show the specific PipelineRun
.
That said, I just wanted to provide an example based on the existing content of the vocabulary.
I didn't really mean to get into any vocabulary specific discussion for this PR 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think examples are vital for understanding as the subject object is a new concept and it wasn't that easy to follow your train of thoughts. If you want to keep the example here we could go back and change it later. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally agree that examples are vital! I'll try to make more of them in the next PRs and align these accordingly.
Expand the definition of mandatory attributes by adding syntax details and examples. Introduce the "version" as a mandatory attribute. Add the subject as an optional attribute as discussed in the WG. Signed-off-by: Andrea Frittoli <[email protected]>
Thank you @m-linner-ericsson for the thorough review! |
@afrittoli To ease the job of the reviewer it would be nice to have the complete history so you can see what has changed. A humble request would be that, if you want to force push could you force push the branch with all the commits? |
Yes, sure - I can do that. My usual workflow is to force-push because that keeps the git history clean. Unfortunately GitHub, unlike Gerrit, doesn't have a concept of patchsets, only commits, which means that to keep a readable git history one then has to squash the commits into one before merging the PR. Assuming that in most cases we will only have one commit per PR that works relatively well. |
`source` + `id` combination. | ||
- Constraints: | ||
- REQUIRED | ||
- MUST adhere to the format specified in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want to mention this, in case someone wonders:
In Eiffel we define the timestamp using UNIX Epoch time (in milliseconds), and the main reason to that is probably as that makes it easier for a machine to calculate the diff between two events, and since the Eiffel events are not primarily intended for human consumption. I guess the benefit of having human readable timestamps should overrule that though, for CDEvents, since it makes it a lot easier for a human to troubleshoot the events.
@@ -87,17 +87,129 @@ predicate are defined in the [vocabulary](#vocabulary). | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a mix of markup used in this PR, when it comes to referencing attributes and sections in the document. Some references are encapsulated within back-quotes and some are not. Some references render as active links and some do not. Please streamline that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I've addressed this now, let me know if that looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vocabulary section is in some places referenced with back-quotes and sometimes without back-quotes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed that
Co-authored-by: Emil Bäckmark <[email protected]>
Co-authored-by: Emil Bäckmark <[email protected]>
Co-authored-by: Emil Bäckmark <[email protected]>
Co-authored-by: Emil Bäckmark <[email protected]>
Co-authored-by: Emil Bäckmark <[email protected]>
Co-authored-by: Emil Bäckmark <[email protected]>
Signed-off-by: Andrea Frittoli <[email protected]>
Signed-off-by: Andrea Frittoli <[email protected]>
Expand the definition of mandatory attributes by adding syntax
details and examples.
Introduce the "version" as a mandatory attribute.
Add the subject as an optional attribute as discussed in the WG.
Signed-off-by: Andrea Frittoli [email protected]