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 all commits
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-draft"
],
"default": "dev.cdevents.build.finished.0.1.1"
"default": "dev.cdevents.build.finished.0.1.2-draft"
},
"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"
]
}
}
10 changes: 8 additions & 2 deletions schemas/pipelinerunfinished.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@
"type": "string"
},
"outcome": {
"type": "string"
"type": "string",
"minLength": 1,
"enum": [
"passed",
Copy link
Contributor

Choose a reason for hiding this comment

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

These enums don't match the core.md doc on pipelineRun.finished. Same for taskRun.finished.

"failed",
"cancelled"
Copy link
Contributor

Choose a reason for hiding this comment

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

We might want to describe the meaning of values in the enum, to help consistency in adoption.
Does cancelled refer to use cancelled or system cancelled or both? Would a "timed-out" build count as cancelled (as in cancelled by the system because of taking too long?).

]
},
"errors": {
"type": "string"
Expand Down Expand Up @@ -106,4 +112,4 @@
"context",
"subject"
]
}
}
9 changes: 7 additions & 2 deletions schemas/taskrunfinished.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@
]
},
"outcome": {
"type": "string"
"type": "string",
"enum": [
"succeeded",
"failed",
"cancelled"
]
},
"errors": {
"type": "string"
Expand Down Expand Up @@ -124,4 +129,4 @@
"context",
"subject"
]
}
}
7 changes: 3 additions & 4 deletions schemas/testcaserunfinished.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@
"outcome": {
"type": "string",
"enum": [
"pass",
"fail",
"cancel",
"error"
"passed",
"failed",
"cancelled"
]
},
"severity": {
Expand Down
8 changes: 4 additions & 4 deletions schemas/testsuiterunfinished.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@
},
"outcome": {
"type": "string",
"minLength": 1,
"enum": [
"pass",
"fail",
"cancel",
"error"
"passed",
"failed",
"cancelled"
]
},
"severity": {
Expand Down
Loading