diff --git a/conformance/taskrun_queued.json b/conformance/taskrun_queued.json new file mode 100644 index 0000000..a24ee77 --- /dev/null +++ b/conformance/taskrun_queued.json @@ -0,0 +1,53 @@ +{ + "context": { + "specversion": "0.6.0-draft", + "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chainId": "4c8cb7dd-3448-41de-8768-eec704e2829b", + "source": "/event/source/123", + "type": "dev.cdevents.taskrun.queued.0.1.0-draft", + "timestamp": "2023-03-20T14:27:05.315384Z", + "schemaUri": "https://myorg.com/schema/custom", + "links": [ + { + "linkType": "RELATION", + "linkKind": "TRIGGER", + "target": { + "contextId": "5328c37f-bb7e-4bb7-84ea-9f5f85e4a7ce" + }, + "tags": { + "foo1": "bar", + "foo2": "bar" + } + }, { + "linkType": "PATH", + "from": { + "contextId": "5328c37f-bb7e-4bb7-84ea-9f5f85e4a7ce" + }, + "tags": { + "foo1": "bar", + "foo2": "bar" + } + }, { + "linkType": "END", + "from": { + "contextId": "5328c37f-bb7e-4bb7-84ea-9f5f85e4a7ce" + }, + "tags": { + "foo1": "bar", + "foo2": "bar" + } + } + ] + }, + "subject": { + "id": "mySubject123", + "source": "/event/source/123", + "content": { + "taskName": "myTask", + "uri": "https://www.example.com/mySubject123", + "pipelineRun": { + "id": "mySubject123" + } + } + } +} diff --git a/core.md b/core.md index 21fa3a4..03ef83d 100644 --- a/core.md +++ b/core.md @@ -21,7 +21,7 @@ The definition of *pipelines* and *tasks* is an authoring process, and has no ev | Subject | Description | Predicates | |---------|-------------|------------| | [`pipelineRun`](#pipelinerun) | An instance of a *pipeline* | [`queued`](#pipelinerun-queued), [`started`](#pipelinerun-started), [`finished`](#pipelinerun-finished)| -| [`taskRun`](#taskrun) | An instance of a *task* | [`started`](#taskrun-started), [`finished`](#taskrun-finished)| +| [`taskRun`](#taskrun) | An instance of a *task* | [`queued`](#taskrun-queued), [`started`](#taskrun-started), [`finished`](#taskrun-finished)| ### `pipelineRun` @@ -52,7 +52,7 @@ associated, in which case it is acceptable to generate only taskRun events. |-------|------|-------------|----------| | id | `String` | See [id](spec.md#id-subject)| `tenant1/12345-abcde`, `namespace/taskrun-1234` | | source | `URI-Reference` | See [source](spec.md#source-subject) | | -| taskName | `String` | The name of the pipeline | `MyPipeline`, `Unit tests for my repo` | +| taskName | `String` | The name of the task | `MyTask`, `Deploy to DEV stage` | | pipelineRun | `Object` ([`pipelineRun`](#pipelinerun)) | The `pipelineRun` that this `taskRun` belongs to. | `{"id": "namespace/pipelinerun-1234"}`| | outcome | `String` | outcome of a finished `taskRun` | `success`, `failure`, `cancel`, or `error` | | url | `URI` | url to the `taskRun` | `https://dashboard.org/namespace/taskrun-1234`, `https://api.cdsystem.com/namespace/taskrun-1234` | @@ -109,6 +109,26 @@ A pipelineRun has finished, successfully or not. | outcome | `String (enum)` | outcome of a finished `pipelineRun` | `success`, `failure`, `cancel`, or `error` | `success`, `failure`, `cancel`, `error` | | errors | `String` | In case of error, canceled, or failed pipeline , provides details about the failure | `Invalid input param 123`, `Timeout during execution`, `pipelineRun canceled by user`, `Unit tests failed`| | +### [`taskRun Queued`](conformance/taskrun_queued.json) + +This event represents when a taskRun has been queued for execution - and is waiting for applicable preconditions (resource availability, other tasks, etc.) to be fulfilled before actually executing. + +Adopters can choose to ignore these events if they don't apply to their use cases. + +A `taskRun.queued` event may be followed by `taskRun.started` or `taskRun.finished` for the **same** subject. + +- Event Type: __`dev.cdevents.taskrun.queued.0.1.0-draft`__ +- Predicate: queued +- Subject: [`taskRun`](#taskrun) + +| Field | Type | Description | Examples | Required | +|-------|------|-------------|----------|----------------------------| +| id | `String` | See [id](spec.md#id-subject)| `tenant1/12345-abcde`, `namespace/taskrun-1234` | ✅ | +| source | `URI-Reference` | [source](spec.md#source) from the context | | | +| taskName | `String` | The name of the task | `MyTask`, `Deploy to DEV stage` | | +| pipelineRun | `Object` ([`pipelineRun`](#pipelinerun)) | The `pipelineRun` that this `taskRun` belongs to. | `{"id": "namespace/pipelinerun-1234"}`| | +| url | `URI` | url to the `taskRun` | `https://dashboard.org/namespace/taskrun-1234`, `https://api.cdsystem.com/namespace/taskrun-1234` | | + ### [`taskRun Started`](conformance/taskrun_started.json) A taskRun has started and it is running. @@ -121,7 +141,7 @@ A taskRun has started and it is running. |-------|------|-------------|----------|----------------------------| | id | `String` | See [id](spec.md#id-subject)| `tenant1/12345-abcde`, `namespace/taskrun-1234` | ✅ | | source | `URI-Reference` | [source](spec.md#source) from the context | | | -| taskName | `String` | The name of the pipeline | `MyPipeline`, `Unit tests for my repo` | | +| taskName | `String` | The name of the task | `MyTask`, `Deploy to DEV stage` | | | pipelineRun | `Object` ([`pipelineRun`](#pipelinerun)) | The `pipelineRun` that this `taskRun` belongs to. | `{"id": "namespace/pipelinerun-1234"}`| | | url | `URI` | url to the `taskRun` | `https://dashboard.org/namespace/taskrun-1234`, `https://api.cdsystem.com/namespace/taskrun-1234` | | @@ -137,7 +157,7 @@ A taskRun has finished, successfully or not. |-------|------|-------------|----------|----------------------------| | id | `String` | See [id](spec.md#id-subject)| `tenant1/12345-abcde`, `namespace/taskrun-1234` | ✅ | | source | `URI-Reference` | [source](spec.md#source) from the context | | | -| taskName | `String` | The name of the pipeline | `MyPipeline`, `Unit tests for my repo` | | +| taskName | `String` | The name of the task | `MyTask`, `Deploy to DEV stage` | | | pipelineRun | `Object` ([`pipelineRun`](#pipelinerun)) | The `pipelineRun` that this `taskRun` belongs to. | `{"id": "namespace/pipelinerun-1234"}`| | | url | `URI` | url to the `taskRun` | `https://dashboard.org/namespace/taskrun-1234`, `https://api.cdsystem.com/namespace/taskrun-1234` | | | outcome | `String (enum)` | outcome of a finished `taskRun` | `success`, `failure`, `cancel`, or `error` | `success`, `failure`, `cancel`, `error` | diff --git a/schemas/taskrunqueued.json b/schemas/taskrunqueued.json new file mode 100644 index 0000000..daef6c5 --- /dev/null +++ b/schemas/taskrunqueued.json @@ -0,0 +1,125 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://cdevents.dev/0.6.0-draft/schema/taskrun-queued-event", + "properties": { + "context": { + "properties": { + "specversion": { + "type": "string", + "minLength": 1 + }, + "id": { + "type": "string", + "minLength": 1 + }, + "source": { + "type": "string", + "minLength": 1, + "format": "uri-reference" + }, + "type": { + "type": "string", + "enum": [ + "dev.cdevents.taskrun.queued.0.1.0-draft" + ], + "default": "dev.cdevents.taskrun.queued.0.1.0-draft" + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "schemaUri": { + "type": "string", + "minLength": 1, + "format": "uri" + }, + "chainId": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "specversion", + "id", + "source", + "type", + "timestamp" + ] + }, + "subject": { + "properties": { + "id": { + "type": "string", + "minLength": 1 + }, + "source": { + "type": "string", + "minLength": 1, + "format": "uri-reference" + }, + "content": { + "properties": { + "taskName": { + "type": "string" + }, + "uri": { + "type": "string", + "format": "uri" + }, + "pipelineRun": { + "properties": { + "id": { + "type": "string", + "minLength": 1 + }, + "source": { + "type": "string", + "minLength": 1, + "format": "uri-reference" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "id" + ] + } + }, + "additionalProperties": false, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "id", + "content" + ] + }, + "customData": { + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] + }, + "customDataContentType": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "context", + "subject" + ] +}