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

Add outcome to buildfinished event #179

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion continuous-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ This event represents a Build task that has been started; this build process usu

### [`build finished`](examples/build_finished.json)

This event represents a Build task that has finished. This event will eventually contain the finished status, success, error or failure
This event represents a Build task that has finished and will contain the outcome of the given build.

- Event Type: __`dev.cdevents.build.finished.0.1.1`__
- Predicate: finished
Expand All @@ -92,6 +92,7 @@ This event represents a Build task that has finished. This event will eventually
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
| type | `String` | See [type](spec.md#type-subject) | |
| artifactId | `Purl` | Identifier of the artifact produced by the build | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427`, `pkg:golang/mygit.com/myorg/myapp@234fd47e07d1004f0aed9c` | `build` | |
| outcome | `String` | Represents the finished state of a build. | `succeeded`, `failed`, `cancelled` | |

### [`artifact packaged`](examples/artifact_packaged.json)

Expand Down
5 changes: 3 additions & 2 deletions examples/build_finished.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
"version": "0.4.0-draft",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.build.finished.0.1.1",
"type": "dev.cdevents.build.finished.0.1.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

-draft is needed here too

"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "mySubject123",
"source": "/event/source/123",
"type": "build",
"content": {
"artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427"
"artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427",
"outcome": "succeeded"
}
}
}
15 changes: 12 additions & 3 deletions schemas/buildfinished.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"type": {
"type": "string",
"enum": [
"dev.cdevents.build.finished.0.1.1"
"dev.cdevents.build.finished.0.1.2"
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be -draft

],
"default": "dev.cdevents.build.finished.0.1.1"
"default": "dev.cdevents.build.finished.0.1.2"
},
"timestamp": {
"type": "string",
Expand Down Expand Up @@ -62,6 +62,15 @@
"properties": {
"artifactId": {
"type": "string"
},
"outcome": {
"type": "string",
"minLength": 1,
"enum": [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The biggest difference here between outcome in taskRun.finished is this. I really think we should be utilizing enums to provide at least some consistent defaults for users.

Copy link
Contributor

Choose a reason for hiding this comment

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

Absolutely! And that is also stated for the taskRun.finished and pipelineRun.finished in their md doc (core.md). The json schemas for those events lack those enum definitions, and there is an issue to fix that - #159 . I believe the outcome enums for the build.finished event should have similar values as the enum for the outcomes of taskRun.finished and pipelineRun.finished.

"succeeded",
"failed",
"cancelled"
]
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -97,4 +106,4 @@
"context",
"subject"
]
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unsure why we want this non-newline for files? Newlines at the ending character is pretty standard, e.g. vim, emacs, all defaults to this (and IDEs). So this may have been due to this being code generated and forgetting the newline? Im unsure.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, all files should end with an empty line I believe