From 0ff4b55d9cfdb2950d6bc5cc1e5c72f77a83593e Mon Sep 17 00:00:00 2001 From: benjamin-j-powell Date: Tue, 30 May 2023 10:04:58 -0500 Subject: [PATCH] Introduce links to CDEvents This commits introduces the concept of linking events to CDEvents. We take inspiration from Eiffel for certain components, and also outline new APIs and use cases. Signed-off-by: benjamin-j-powell --- examples/artifact_packaged.json | 1 + examples/artifact_published.json | 1 + examples/artifact_signed.json | 1 + examples/branch_created.json | 3 +- examples/branch_deleted.json | 3 +- examples/build_finished.json | 1 + examples/build_queued.json | 1 + examples/build_started.json | 1 + examples/change_abandoned.json | 3 +- examples/change_created.json | 1 + examples/change_merged.json | 3 +- examples/change_reviewed.json | 3 +- examples/change_updated.json | 3 +- examples/environment_created.json | 1 + examples/environment_deleted.json | 1 + examples/environment_modified.json | 1 + examples/incident_detected.json | 1 + examples/incident_reported.json | 1 + examples/incident_resolved.json | 1 + examples/pipelinerun_finished.json | 1 + examples/pipelinerun_queued.json | 1 + examples/pipelinerun_started.json | 1 + examples/repository_created.json | 1 + examples/repository_deleted.json | 1 + examples/repository_modified.json | 1 + examples/service_deployed.json | 1 + examples/service_published.json | 1 + examples/service_removed.json | 1 + examples/service_rolledback.json | 1 + examples/service_upgraded.json | 1 + examples/taskrun_finished.json | 1 + examples/taskrun_started.json | 1 + examples/testcaserun_finished.json | 1 + examples/testcaserun_queued.json | 1 + examples/testcaserun_started.json | 1 + examples/testoutput_published.json | 1 + examples/testsuiterun_finished.json | 1 + examples/testsuiterun_queued.json | 1 + examples/testsuiterun_started.json | 1 + links.md | 624 ++++++++++++++++++++++++ schemas/artifactdeleted.json | 9 +- schemas/artifactdownloaded.json | 9 +- schemas/artifactpackaged.json | 13 +- schemas/artifactpublished.json | 13 +- schemas/artifactsigned.json | 9 +- schemas/branchcreated.json | 9 +- schemas/branchdeleted.json | 9 +- schemas/buildfinished.json | 9 +- schemas/buildqueued.json | 9 +- schemas/buildstarted.json | 9 +- schemas/changeabandoned.json | 9 +- schemas/changecreated.json | 7 + schemas/changemerged.json | 9 +- schemas/changereviewed.json | 9 +- schemas/changeupdated.json | 9 +- schemas/environmentcreated.json | 9 +- schemas/environmentdeleted.json | 9 +- schemas/environmentmodified.json | 9 +- schemas/incidentdetected.json | 9 +- schemas/incidentreported.json | 9 +- schemas/incidentresolved.json | 9 +- schemas/links/embeddedlinkend.json | 31 ++ schemas/links/embeddedlinkpath.json | 31 ++ schemas/links/embeddedlinkrelation.json | 34 ++ schemas/links/embeddedlinksarray.json | 19 + schemas/links/linkend.json | 58 +++ schemas/links/linkpath.json | 53 ++ schemas/links/linkrelation.json | 61 +++ schemas/links/linkstart.json | 43 ++ schemas/pipelinerunfinished.json | 9 +- schemas/pipelinerunqueued.json | 9 +- schemas/pipelinerunstarted.json | 9 +- schemas/repositorycreated.json | 9 +- schemas/repositorydeleted.json | 9 +- schemas/repositorymodified.json | 9 +- schemas/servicedeployed.json | 9 +- schemas/servicepublished.json | 9 +- schemas/serviceremoved.json | 9 +- schemas/servicerolledback.json | 9 +- schemas/serviceupgraded.json | 9 +- schemas/taskrunfinished.json | 9 +- schemas/taskrunstarted.json | 9 +- schemas/testcaserunfinished.json | 7 + schemas/testcaserunqueued.json | 7 + schemas/testcaserunstarted.json | 7 + schemas/testoutputpublished.json | 7 + schemas/testsuiterunfinished.json | 7 + schemas/testsuiterunqueued.json | 7 + schemas/testsuiterunstarted.json | 7 + spec.md | 58 ++- 90 files changed, 1380 insertions(+), 44 deletions(-) create mode 100644 links.md create mode 100644 schemas/links/embeddedlinkend.json create mode 100644 schemas/links/embeddedlinkpath.json create mode 100644 schemas/links/embeddedlinkrelation.json create mode 100644 schemas/links/embeddedlinksarray.json create mode 100644 schemas/links/linkend.json create mode 100644 schemas/links/linkpath.json create mode 100644 schemas/links/linkrelation.json create mode 100644 schemas/links/linkstart.json diff --git a/examples/artifact_packaged.json b/examples/artifact_packaged.json index 2d0071f4..5b283759 100644 --- a/examples/artifact_packaged.json +++ b/examples/artifact_packaged.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.artifact.packaged.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/artifact_published.json b/examples/artifact_published.json index b579aa1d..f8240e18 100644 --- a/examples/artifact_published.json +++ b/examples/artifact_published.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.artifact.published.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/artifact_signed.json b/examples/artifact_signed.json index 61506711..eb93d4ee 100644 --- a/examples/artifact_signed.json +++ b/examples/artifact_signed.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.artifact.signed.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/branch_created.json b/examples/branch_created.json index 4f257399..0e13c965 100644 --- a/examples/branch_created.json +++ b/examples/branch_created.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.branch.created.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", @@ -18,4 +19,4 @@ } } } -} \ No newline at end of file +} diff --git a/examples/branch_deleted.json b/examples/branch_deleted.json index 96cec7b8..42f573e0 100644 --- a/examples/branch_deleted.json +++ b/examples/branch_deleted.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.branch.deleted.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", @@ -18,4 +19,4 @@ } } } -} \ No newline at end of file +} diff --git a/examples/build_finished.json b/examples/build_finished.json index 4f463919..97682cce 100644 --- a/examples/build_finished.json +++ b/examples/build_finished.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.build.finished.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/build_queued.json b/examples/build_queued.json index ab777d68..fa523b90 100644 --- a/examples/build_queued.json +++ b/examples/build_queued.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.build.queued.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/build_started.json b/examples/build_started.json index ab6e6a41..474569ee 100644 --- a/examples/build_started.json +++ b/examples/build_started.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.build.started.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/change_abandoned.json b/examples/change_abandoned.json index 646161d4..c71d6d1b 100644 --- a/examples/change_abandoned.json +++ b/examples/change_abandoned.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.change.abandoned.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", @@ -18,4 +19,4 @@ } } } -} \ No newline at end of file +} diff --git a/examples/change_created.json b/examples/change_created.json index 1dec9d65..994c9288 100644 --- a/examples/change_created.json +++ b/examples/change_created.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.change.created.0.3.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/change_merged.json b/examples/change_merged.json index ddef3d2b..398cbfea 100644 --- a/examples/change_merged.json +++ b/examples/change_merged.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.change.merged.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", @@ -18,4 +19,4 @@ } } } -} \ No newline at end of file +} diff --git a/examples/change_reviewed.json b/examples/change_reviewed.json index 8fb5393c..ef2f5f39 100644 --- a/examples/change_reviewed.json +++ b/examples/change_reviewed.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.change.reviewed.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", @@ -18,4 +19,4 @@ } } } -} \ No newline at end of file +} diff --git a/examples/change_updated.json b/examples/change_updated.json index a7d0c537..233cf31f 100644 --- a/examples/change_updated.json +++ b/examples/change_updated.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.change.updated.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", @@ -18,4 +19,4 @@ } } } -} \ No newline at end of file +} diff --git a/examples/environment_created.json b/examples/environment_created.json index 24db7b01..7b221b7f 100644 --- a/examples/environment_created.json +++ b/examples/environment_created.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.environment.created.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/environment_deleted.json b/examples/environment_deleted.json index 5e24297c..59a7fdc9 100644 --- a/examples/environment_deleted.json +++ b/examples/environment_deleted.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.environment.deleted.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/environment_modified.json b/examples/environment_modified.json index 5a794c6b..77626886 100644 --- a/examples/environment_modified.json +++ b/examples/environment_modified.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.environment.modified.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/incident_detected.json b/examples/incident_detected.json index 318c7759..c4628f7c 100644 --- a/examples/incident_detected.json +++ b/examples/incident_detected.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "F4BD2B55-B6F6-4F44-AF72-BD2D0E7A8708", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/monitoring/prod1", "type": "dev.cdevents.incident.detected.0.2.0-draft", "timestamp": "2022-11-11T13:52:20.079Z" diff --git a/examples/incident_reported.json b/examples/incident_reported.json index 0bff28dd..a21ecbc1 100644 --- a/examples/incident_reported.json +++ b/examples/incident_reported.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "F4BD2B55-B6F6-4F44-AF72-BD2D0E7A8708", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/monitoring/prod1", "type": "dev.cdevents.incident.reported.0.2.0-draft", "timestamp": "2022-11-11T13:52:20.079Z" diff --git a/examples/incident_resolved.json b/examples/incident_resolved.json index bbc70782..39d5ae08 100644 --- a/examples/incident_resolved.json +++ b/examples/incident_resolved.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "F4BD2B55-B6F6-4F44-AF72-BD2D0E7A8708", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/monitoring/prod1", "type": "dev.cdevents.incident.resolved.0.2.0-draft", "timestamp": "2022-11-11T13:52:20.079Z" diff --git a/examples/pipelinerun_finished.json b/examples/pipelinerun_finished.json index d4031eda..c027c7dc 100644 --- a/examples/pipelinerun_finished.json +++ b/examples/pipelinerun_finished.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.pipelinerun.finished.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/pipelinerun_queued.json b/examples/pipelinerun_queued.json index 09564adc..cf0aaacc 100644 --- a/examples/pipelinerun_queued.json +++ b/examples/pipelinerun_queued.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.pipelinerun.queued.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/pipelinerun_started.json b/examples/pipelinerun_started.json index cedb23ed..c0bff690 100644 --- a/examples/pipelinerun_started.json +++ b/examples/pipelinerun_started.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.pipelinerun.started.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/repository_created.json b/examples/repository_created.json index 0bd84ad0..bc8c3946 100644 --- a/examples/repository_created.json +++ b/examples/repository_created.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.repository.created.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/repository_deleted.json b/examples/repository_deleted.json index 20f420ec..d39b71a0 100644 --- a/examples/repository_deleted.json +++ b/examples/repository_deleted.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.repository.deleted.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/repository_modified.json b/examples/repository_modified.json index 5bfeafc5..22206ded 100644 --- a/examples/repository_modified.json +++ b/examples/repository_modified.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.repository.modified.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/service_deployed.json b/examples/service_deployed.json index dbc38082..f0343947 100644 --- a/examples/service_deployed.json +++ b/examples/service_deployed.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.service.deployed.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/service_published.json b/examples/service_published.json index 0134c110..a2cdaabc 100644 --- a/examples/service_published.json +++ b/examples/service_published.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.service.published.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/service_removed.json b/examples/service_removed.json index 06343144..73ddc073 100644 --- a/examples/service_removed.json +++ b/examples/service_removed.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.service.removed.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/service_rolledback.json b/examples/service_rolledback.json index bd4cdaa5..8f24c00a 100644 --- a/examples/service_rolledback.json +++ b/examples/service_rolledback.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.service.rolledback.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/service_upgraded.json b/examples/service_upgraded.json index 88da946c..5c5846bc 100644 --- a/examples/service_upgraded.json +++ b/examples/service_upgraded.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.service.upgraded.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/taskrun_finished.json b/examples/taskrun_finished.json index bed709af..0097e0cb 100644 --- a/examples/taskrun_finished.json +++ b/examples/taskrun_finished.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.taskrun.finished.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/taskrun_started.json b/examples/taskrun_started.json index c8560f44..dd56381a 100644 --- a/examples/taskrun_started.json +++ b/examples/taskrun_started.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.taskrun.started.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/testcaserun_finished.json b/examples/testcaserun_finished.json index 8f4f2dce..0afa0a85 100644 --- a/examples/testcaserun_finished.json +++ b/examples/testcaserun_finished.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.testcaserun.finished.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/testcaserun_queued.json b/examples/testcaserun_queued.json index 292309ec..64ff6389 100644 --- a/examples/testcaserun_queued.json +++ b/examples/testcaserun_queued.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.testcaserun.queued.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/testcaserun_started.json b/examples/testcaserun_started.json index 02e856ba..5d4b2549 100644 --- a/examples/testcaserun_started.json +++ b/examples/testcaserun_started.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.testcaserun.started.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/testoutput_published.json b/examples/testoutput_published.json index de8c0f75..9927552d 100644 --- a/examples/testoutput_published.json +++ b/examples/testoutput_published.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.testoutput.published.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/testsuiterun_finished.json b/examples/testsuiterun_finished.json index e20c2ab5..d9a1ad2a 100644 --- a/examples/testsuiterun_finished.json +++ b/examples/testsuiterun_finished.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.testsuiterun.finished.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/testsuiterun_queued.json b/examples/testsuiterun_queued.json index cdec816a..57c3c054 100644 --- a/examples/testsuiterun_queued.json +++ b/examples/testsuiterun_queued.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.testsuiterun.queued.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/examples/testsuiterun_started.json b/examples/testsuiterun_started.json index dbf13a08..253ebc69 100644 --- a/examples/testsuiterun_started.json +++ b/examples/testsuiterun_started.json @@ -2,6 +2,7 @@ "context": { "version": "0.4.0-draft", "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", "type": "dev.cdevents.testsuiterun.started.0.2.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", diff --git a/links.md b/links.md new file mode 100644 index 00000000..309bc1d9 --- /dev/null +++ b/links.md @@ -0,0 +1,624 @@ +# Connecting Events - Links Proposal + +## Abstract + +This proposal will outline how to connect individual CDEvents to one other. +Currently there's no way of associating events without needing to backtrack +across certain subject attributes, e.g. +[id](https://github.com/CDEvents/spec/blob/main/spec.md#id-subject). While +this does give us the ability to construct some graph, we do not know when a +particular chain starts or finishes. + +This proposal will outline a new approach that will allow for connecting +CDEvents and give a clear distinction of when an activity chain starts and +finishes. + +## CDEvents Architecture + +Below is an example diagram for a CDEvent system to help illustrate how users +and systems may utilize CDEvents. In this case, a user is merging a GitHub pull +request and then using some CDEvent frontend to query all links for their +request to get a full view of all that has happened. + +``` ++--------------------------------------------------------------------------+ +------------------+ +| | (links) | | +| Event Bus +--------->| | +| | | | ++----------------------+---------------------------------------------------+ | | + ^ | ^ | ^ | | + | | | | | | | + | | | | | | | + | v | v | | | ++------+------+ +--------+----+ +-------------+ +--------+----+ | Links | +| | | | | |<--+ | | Service | +| GitHub | | Jenkins +-->| Artifactory | | Spinnaker | | | +| | | | | +-->| | | | ++-------------+ +-------------+ +-------------+ +------+------+ | | + ^ | | | + | v | | + | +-------------+ | | + | | | | | + | | Kubernetes | | | + | | | | | + | user merges a pull +-------------+ +------------------+ + | request from GitHub ^ | + | | | + | | | + | | | ++------+-----+ | | +| | | | +| User | frontend requests all links for a particular request | | +| +--------------------------------------------------------------------------------+ | +| o | | +| /|\ |<----------------------------------------------------------------------------------+ +| / \ | ++------------+ +``` + +## Semantics + +This section will define various terms to ensure there are no assumptions being +made when we talk about linking events + +* **CI** - [Continuous integration](https://bestpractices.cd.foundation/learn/ci/) +* **CD** - [Continuous delivery](https://bestpractices.cd.foundation/learn/cd/) +* **Chain** - A chain is an end to end representation of all activities performed + in the CI/CD life cycle of some entity +* **Link** - A link is an object which describes how an event is related to another event. + +## Goals + +The biggest challenge in this whole process is ensuring that connected events +can be retrieved quickly and efficiently, while also providing the necessary +metadata and structure to give a detailed picture of how things occurred. + +1) Provide a way of quickly retrieving all related links +2) Keep link data structured small and simple +3) Scalable + +## Use Cases + +This section will go over a few use cases and explain how this approach can be +used to solve for each particular case. + +### 1. Fan Out Fan In + +The fan out fan in use case is an example where a system may make parallel +requests (fan out), and merge back to some other or the very same system (fan in) + +Let us assume we have 3 system in our CI/CD environment. A continuous +integration environment, which we will call CI system, that runs tests and +builds artifacts, an artifact store that receives artifacts from the CI system, +and lastly the CD system which consume these artifacts shown in the diagram +below. + +``` + +-------------------+ +-----------------+ + +-->| Build for Mac |-->| Test on Mac |---+ ++-----------+ | +-------------------+ +-----------------+ | +| Static | | +-------------------+ +-----------------+ | +---------------------------+ +| Code |---+-->| Build for SLES |-->| Test on SLES |---+-->| Promote & Deliver Release | +| Analysis | | +-------------------+ +-----------------+ | +---------------------------+ ++-----------+ | +-------------------+ +-----------------+ | + +-->| Build for Windows |-->| Test on Windows |---+ + +-------------------+ +-----------------+ +``` + +The diagram above shows the CI event creating 3 separate artifacts that will +make it's way to the artifact store. Some CD system would then consume those +artifact, but would need to group all the artifact when the CI system finishes +its pipeline. This is not meant to be a full diagram of the whole CDEvents +flow, but a simple representation of the artifact(s) life cycle. + +### 2. Generic UI + +With the goal of interoperability, this allows for compatible standalone +generic UIs for any CI/CD system. + +## Connecting Events + +An individual event usually has some connection to some trigger. This can be a +new commit added to a pull request, a test suite being called in the CI +process, or publishing a new artifact for some system to consume. While these +events mean something themselves, they do not give the proper context of what +caused what. This section will introduce two new fields, `chain_id` and +`links`, within the CDEvents context that will allow for giving some path +between CDEvents. + +```json +{ + "context": { + "version": "0.3.0-draft", + "id": "505b31c2-8bc8-47b3-a1a0-269d7a8530ac", + "source": "dev/jenkins", + "type": "dev.cdevents.testsuite.finished.0.1.1", + "chain_id": "00000000-0000-0000-0000-000000000001", # new chain id field + "timestamp": "2023-03-20T14:27:05.315384Z" + }, + "subject": { + "id": "MyTestSuite", + "source": "/tests/com/org/package", + "type": "testSuite", + "content": {} + } +} +``` + +The `chain_id` is an ID that will be generated when a new CDEvent chain is +wanted or if no CDEvent chain is present. This ID will follow the +[UUID](https://datatracker.ietf.org/doc/html/rfc4122) format. Chain IDs will +serve as a bucket for all CDEvents with some sort of path to each other. + +### Optional Links Field + +While links can be sent separately, links can also be embedded in the CDEvent +context as an optional field. Embedded links look similar to separate links +except `START` links are not needed since we can infer when a chain has started +based on the context of the event. This leaves only three types of links that +may be embedded, `PATH`, `RELATION` and `END`. While `END` might be possible to +infer, it may not be as simple especially if there are gaps or islands. Having +an event specifically say it is the `END` of a chain will allow for UIs or +systems to act accordingly based off the ending notation. + +```json +{ + "context": { + "version": "0.3.0", + "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "7ff3f526-1a0e-4d35-8a4c-7d6295e97359", + "source": "/event/source/123", + "type": "dev.cdevents.pipelinerun.queued.0.1.1", + "timestamp": "2023-03-20T14:27:05.315384Z", + "links": [ + { + "link_type": "RELATION", + "link_kind": "TRIGGER", + "target": { + "context_id": "5328c37f-bb7e-4bb7-84ea-9f5f85e4a7ce" # context id of a change.merged CDEvent + } + } + ] + }, + "subject": { + "id": "mySubject123", + "source": "/event/source/123", + "type": "pipelineRun", + "content": { + "pipelineName": "myPipeline", + "url": "https://www.example.com/mySubject123" + } + } +} +``` + +Above shows a simple relation link that would allow a trigger relation of a +`changed.merge` and the `pipelinerun.queued` event. To illustrate links +further, we can allow for a path link between `pipelinerun.queued` to the +`pipelinerun.started` event shown below. + +```json +{ + "context": { + "version": "0.3.0", + "id": "271069a8-fc18-44f1-b38f-9d70a1695819", + "chain_id": "7ff3f526-1a0e-4d35-8a4c-7d6295e97359", + "source": "/event/source/123", + "type": "dev.cdevents.pipelinerun.started.0.1.1", + "timestamp": "2023-03-20T14:27:05.315384Z", + "links": [ + { + "link_type": "PATH", + "from": { + "context_id": "271069a8-fc18-44f1-b38f-9d70a1695819" # context id of the pipelinerun.queued event + } + } + ] + }, + "subject": { + "id": "mySubject123", + "source": "/event/source/123", + "type": "pipelineRun", + "content": { + "pipelineName": "myPipeline", + "url": "https://www.example.com/mySubject123" + } + } +} +``` + +## Propagation + +Chain propagation will be handled differently depending on the protocol that is +used. At a high level, the SDK expects calls to construct the proper paths, but +connecting of events will be handled completely by the SDKs. + +There are a couple cases where propagation is difficult, and maybe even +impossible depending on what the receiving services are willing to do. In +events where the SDKs are not used, it is up to these receiving services to +pass the chain IDs. If this is not done, then there will be a break in the +chain, which means that a new chain will be started, or missing links that will +cause these services to not be visible. + +## Links Spec + +So far we have only talked about what a service may receive when consuming a +CDEvent with links. However, when we store a link, there's a lot more metadata +that can and should be added. + +The idea is we would expect users to start links, connect links, and end links +accordingly through APIs we would provide. This is very similar to how tracing +works in that the individual services dictate when a tracing span starts and +finishes. Granularity in tracing is completely up to the engineer which this +proposal also intends users to do. + +This will introduce new APIs to the CDEvents SDKs to handle automatic injection +of links or allow users to provide their own definition of what a CDEvent chain +is. + +These links can be, but are not limited to being, sent when a CDEvent has +completed: to some collector, the link service, or the event bus. Further +the link service will allow for tagging of various metadata allowing for users +to specify certain labels when looking at links. + +Some users may prefer to not run a separate links service especially if they +know their overall flow may only contain a few links. If that is the case, +simply turning on link payload aggregation, will send all links in the +payload. Mind you, this can make the payload very large, but may be good for +debugging. + +The chain ID header will continue to propagate, unless the user explicitly +starts a new CDEvent chain. If there is no chain ID, the client will generate +one and that will be used for the lifetime of the whole events chain. + +In the case when an event consumer is also an event producer, such a consumer +will easily be able to construct the link to the consumed event. A producer of events +with start links is often not an event consumer itself. When links are sent stand-alone, +and not embedded within the CDEvents themselves, an event consumer that is not +an event producer could still construct the links if it has the necessary information for +it. An event producer that wants to provide a link to some earlier sent event will need +to look it up in a links service or similar if the producer wants to embed the link into +the produced event itself. For events produced within a service, that service should +be able to construct the links between those events by itself. + +``` ++-----+ +-----+ +-----+ +--------------+ +-----------+ +| Git | | CI | | CD | | Link Service | | Event Bus | ++--+--+ +--+--+ +--+--+ +-------+------+ +-----+-----+ + | | | #1 (send change merged event) | | + +----------------------------------------------------------------------------------------------------------------------------->| + | | | #2 (source change link to start chain) | | + +----------------------------------------------------------------------------------------------------------------------------->| + | | | | #3 (proxy link #1) | + | | | |<-----------------------| + | | | #4 (receive change merged event) | | + | |<----------------------------------------------------------------------------------------------------------------+ + | | | #5 (send pipeline queued event) | | + | +---------------------------------------------------------------------------------------------------------------->| + | | | #6 (source change links connecting #1 -> #5) | | + | +---------------------------------------------------------------------------------------------------------------->| + | | | | #7 (proxy link #6) | + | | | |<-----------------------| + | | | #8 (send pipeline started event) | | + | +---------------------------------------------------------------------------------------------------------------->| + | | | #9 (pipeline queued links connecting #5 -> #8) | | + | +---------------------------------------------------------------------------------------------------------------->| + | | | | #10 (proxy link #9) | + | | | |<-----------------------| + | | | #11 (send build queued event) | | + | +---------------------------------------------------------------------------------------------------------------->| + | | | #12 (pipeline started links connecting #6 -> #9) | | + | +---------------------------------------------------------------------------------------------------------------->| + | | | | #13 (proxy link #12) | + | | | |<-----------------------| + | | | #14 (send build started event) | | + | +---------------------------------------------------------------------------------------------------------------->| + | | | #15 (build queued event links connecting #11 -> #14) | | + | +---------------------------------------------------------------------------------------------------------------->| + | | | | #17 (proxy link #16) | + | | | |<-----------------------| + | | | #18 (send build completed event) | | + | +---------------------------------------------------------------------------------------------------------------->| + | | | #19 (build started event links connecting #14 -> #18) | | + | +---------------------------------------------------------------------------------------------------------------->| + | | | | #20 (proxy link #15) | + | | | |<-----------------------| + | | | #21 (send pipeline finished event) | | + | +---------------------------------------------------------------------------------------------------------------->| + | | | #22 (build completed event links connecting #18 -> #21) | | + | +---------------------------------------------------------------------------------------------------------------->| + | | | | #23 (proxy link #22) | + | | | |<-----------------------| + | | | #24 (receive pipeline finished event) | | + | | |<---------------------------------------------------------------------------------------------------+ + | | | #25 (send pipeline queued event) | | + | | +--------------------------------------------------------------------------------------------------->| + | | | #26 (pipeline finished event links connecting #21 -> #25) | | + | | +--------------------------------------------------------------------------------------------------->| + | | | | #27 (proxy link #26) | + | | | |<-----------------------| + | | | #28 (send pipeline started event) | | + | | +--------------------------------------------------------------------------------------------------->| + | | | #29 (pipeline queued links connecting #25 -> #28) | | + | | +--------------------------------------------------------------------------------------------------->| + | | | | #30 (proxy link #29) | + | | | |<-----------------------| + | | | #31 (send environment created event) | | + | | +--------------------------------------------------------------------------------------------------->| + | | | #32 (pipeline started links connecting #28 -> #31) | | + | | +--------------------------------------------------------------------------------------------------->| + | | | | #33 (proxy link #32) | + | | | |<-----------------------| + | | | #34 (environment created end link for #31) | | + | | +--------------------------------------------------------------------------------------------------->| + | | | | #32 (proxy link #31) | + | | | |<-----------------------| +``` + +This example shows how these different types would be used in a CI/CD setting, +but is not the only architecture. + +### Payloads + +This section will describe the first few sequences in the sequence diagram to +help explain the overall flow using payloads from CDEvents. + +1. This is our very first event to the start of our CI/CD chain. This event + would have been sent from some source management tool like Github, Gitlabs, + etc. + +```json +{ + "context": { + "version": "0.4.0-draft", + "chain_id": "d0be0005-cca7-4175-8fe3-f64d2f27bc01", + "id": "38a09112-a1ab-4c26-94c4-edfc234ef631", + "source": "/event/source/123", + "type": "dev.cdevents.change.merged.0.1.2", + "timestamp": "2023-03-20T14:27:05.315384Z" + }, + "subject": { + "id": "mySubject123", + "source": "/event/source/123", + "type": "change", + "content": { + "repository": { + "id": "cdevents/service", + "source": "https://github.com/cdevents/service/pull/1234" + } + } + } +} +``` + +Something to call out here is that the `chain_id` may have been `null`, for +whatever reason, prior to this event. This means any parents to this event did +not generate a `chain_id`. When an event is sent, it is important that the +sender generates this id. + +2. We send the start link to let the links service know that we are creating a + new chain. + +```json +{ + "chain_id": "d0be0005-cca7-4175-8fe3-f64d2f27bc01", + "link_type": "START", + "timestamp": "2023-03-20T14:27:05.315384Z", + "start": { + "context_id": "38a09112-a1ab-4c26-94c4-edfc234ef631" # context.id of #1 + } +} +``` + +3. Event bus proxies the link payload from `#2` to the links service. + +4. Shows some consumer consuming `#1` to do some action. + +5. The CI system will queue a pipeline execution, and will generates a +`context.id` to be sent + +```json +{ + "context": { + "version": "0.4.0-draft", + "chain_id": "d0be0005-cca7-4175-8fe3-f64d2f27bc01", + "id": "AA6945F8-B0F1-48DD-B658-25ACF95BD2F5", + "source": "/event/source/123", + "type": "dev.cdevents.pipelinerun.queued.0.1.1", + "timestamp": "2023-03-20T14:27:05.315384Z" + }, + "subject": { + "id": "mySubject123", + "source": "/event/source/123", + "type": "pipelineRun", + "content": { + "pipelineName": "myPipeline", + "url": "https://www.example.com/mySubject123" + } + } +} +``` + +6. As the send change merge event is sent, the system will follow up with +sending a link associated with the prior event which connects `#1` to `#5` + +```json +{ + "chain_id": "d0be0005-cca7-4175-8fe3-f64d2f27bc01", + "link_type": "PATH", + "timestamp": "2023-03-20T14:27:05.315384Z", + "from": { + "context_id": "38a09112-a1ab-4c26-94c4-edfc234ef631" # context.id of #1 + }, + "to": { + "context_id": "aa6945f8-b0f1-48dd-b658-25acf95bd2f5" # context.id of #5 + }, + "tags": { + "ci.environment": "prod" + } +} +``` + +7. The event bus will then forward link `#6` to the links service + +34. Paylods from `8-33` are very similar to all prior payloads shown here, but + the last sequence is the ending link. + +```json +{ + "chain_id": "d0be0005-cca7-4175-8fe3-f64d2f27bc01", + "link_type": "END", + "timestamp": "2023-03-20T14:27:05.315384Z", + "end": { + "context_id": "7d5e011f-5073-44a7-b4f0-86dd7d4c2c7f" # context.id of #31 + } +} +``` + + +### Link Types + +This section will describe the four different `link_type`s: `START`, `END`, `PATH`, and +`RELATION`. + +First is the common link fields shared between all links + +| Name | Description | +|-----------------|----------------------------------------------------------------------------------------------------------| +| chain_id | This represents the full life cycles of a series of events in CDEvents | +| link_type | An enum that represents the type of link, e.g. 'START', 'END', 'PATH', 'RELATION' | +| timestamp | The timestamp of when the link was created. This field is omitted when embedding links in the CDEvent context | +| tags | Custom metadata that an individual link can have. It is important to note values and keys can only be strings | + +#### Start Link + +Start links are used to indicate that a new chain has been started, and is a +special type of `PATH` link. The reasoning for having a separate link type for +both `START` and `END` is that it allows for clear indication of starting and +stopping a chain. If we relied only on `PATH` link types to indicate either of +these states, then consumers may not be able to distinguish the two different +states. This makes it very clear and easy for consuming systems. + +| Name | Description | +|-------|------------------------------------------------------------------------------------| +| start | An node object that describes the event that is associated with starting the chain | + +```json +{ + "chain_id": "97ef590e-0285-45ad-98bb-9660ffaa567e", + "link_type": "START", + "timestamp": "2023-03-20T14:27:05.315384Z", + "start": { + "context_id": "a721d6ba-bbd6-4737-9274-5ddd2526b92f" + }, + "tags": { + "ci.environment": "prod" + } +} +``` + +#### End Link + +End links are used to indicate that a new chain has completed, and are a +special type of `PATH` link. + +| Name | Description | +|------|------------------------------------------------------------------------------------| +| from | Where the link is coming from. This field is omitted when embedded this link type. | +| end | An node object that describes the event that is associated with ending the chain | + +```json +{ + "chain_id": "97ef590e-0285-45ad-98bb-9660ffaa567e", + "link_type": "END", + "timestamp": "2023-03-20T14:27:05.315384Z", + "from": { + "context_id": "bf9d3c52-1c12-4029-a8d6-e4aca6c69127" + }, + "end": { + "context_id": "bf9d3c52-1c12-4029-a8d6-e4aca6c69127" + }, + "tags": { + "ci.environment": "prod" + } +} +``` + +#### Path Link + +A path link is used to indicate a path that a request has taken, which may be +from system to system or could describe a path within a system like tests. + +| Name | Description | +|-----------------|--------------------------| +| from | Where the link is coming from. This field is omitted when embedded this link type. | +| to | Where the link is going to | + +```json +{ + "chain_id": "97ef590e-0285-45ad-98bb-9660ffaa567e", + "link_type": "PATH", + "timestamp": "2023-03-20T14:27:05.315384Z", + "from": { + "context_id": "f27e36a4-5c78-43c0-840a-52524dfeed03" + }, + "to": { + "context_id": "f004290e-5e45-45f4-b97a-fa82499f534c" + }, + "tags": { + "ci.environment": "prod" + } +} +``` + +#### Relation Link + +Relation links are used to add some context to certain events + +| Name | Description | +|-----------------|-----------------------------------------------------------------------------| +| link_kind | A stringed value representing any sort of relationship the link has to the event | +| source | The entity from which the `link_kind` is applied to. This field is omitted when embedding this link type. | +| target | An event that will be associated with the `source` | + +```json +{ + "chain_id": "97ef590e-0285-45ad-98bb-9660ffaa567e", + "link_type": "RELATION", + "link_kind": "ARTIFACT", + "timestamp": "2023-03-20T14:27:05.315384Z", + "source": { + "context_id": "5668c352-dd9d-4dee-b334-384e4661d21b" + }, + "target": { + "context_id": "3579a5aa-ef46-4ee8-95db-0540298835de" + }, + "tags": { + "ci.environment": "prod" + } +} +``` +### Scalability + +Scalability is one of the bigger goals in this proposal and we wanted to ensure +fast lookups. This section is going to describe how the proposed links format +will be scalable and also provide tactics on how DB read/writes can be done. + +The purpose of the chain ID is to ensure very fast lookups no matter the +database. Without a chain ID the database or its client would need to +recursively follow event references, upstream or downstream depending on the +use case. A graph DB would easily provide that, and it is also possible to +implement on top of SQL like DBs and document DBs, but it will never be as fast +as querying for a chain ID. + +Instead a link service that processes and stores the links to some DB is much +preferred as it gives companies and developers options to choose from. When +using an SQL database, the chain ID could be the secondary key to easily +retrieve indexed entities. Links could be easily sorted by timestamps which +should roughly coordinate to their linked neighbors, parent and child. + +CDEvents that are to be ingested by some service would also have to worry about +the number of events returned. This problem is mitigated in that only the +immediate parent(s) links are returned, and any higher ancestry are excluded. +If some service needs to get access to a higher (a parent's parent) they would +need to use the links API to retrieve them. diff --git a/schemas/artifactdeleted.json b/schemas/artifactdeleted.json index 00dedbc7..c9ecd10f 100644 --- a/schemas/artifactdeleted.json +++ b/schemas/artifactdeleted.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -103,4 +110,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/artifactdownloaded.json b/schemas/artifactdownloaded.json index 36fd5132..15bb421e 100644 --- a/schemas/artifactdownloaded.json +++ b/schemas/artifactdownloaded.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -103,4 +110,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/artifactpackaged.json b/schemas/artifactpackaged.json index 68df54f4..3088a0e1 100644 --- a/schemas/artifactpackaged.json +++ b/schemas/artifactpackaged.json @@ -20,9 +20,9 @@ "type": { "type": "string", "enum": [ - "dev.cdevents.artifact.packaged.0.2.0-draft" + "dev.cdevents.artifact.packaged.0.3.0-draft" ], - "default": "dev.cdevents.artifact.packaged.0.2.0-draft" + "default": "dev.cdevents.artifact.packaged.0.3.0-draft" }, "timestamp": { "type": "string", @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -134,4 +141,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/artifactpublished.json b/schemas/artifactpublished.json index c1eb7f7c..98e70920 100644 --- a/schemas/artifactpublished.json +++ b/schemas/artifactpublished.json @@ -20,9 +20,9 @@ "type": { "type": "string", "enum": [ - "dev.cdevents.artifact.published.0.2.0-draft" + "dev.cdevents.artifact.published.0.3.0-draft" ], - "default": "dev.cdevents.artifact.published.0.2.0-draft" + "default": "dev.cdevents.artifact.published.0.3.0-draft" }, "timestamp": { "type": "string", @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -117,4 +124,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/artifactsigned.json b/schemas/artifactsigned.json index 96a5cc2d..b08b482a 100644 --- a/schemas/artifactsigned.json +++ b/schemas/artifactsigned.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -106,4 +113,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/branchcreated.json b/schemas/branchcreated.json index 82c28c2d..ea0c6d37 100644 --- a/schemas/branchcreated.json +++ b/schemas/branchcreated.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -117,4 +124,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/branchdeleted.json b/schemas/branchdeleted.json index f22a8327..6f467f2e 100644 --- a/schemas/branchdeleted.json +++ b/schemas/branchdeleted.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -117,4 +124,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/buildfinished.json b/schemas/buildfinished.json index f2572a77..b3e37239 100644 --- a/schemas/buildfinished.json +++ b/schemas/buildfinished.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -102,4 +109,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/buildqueued.json b/schemas/buildqueued.json index 96d7d1ef..d04f1c82 100644 --- a/schemas/buildqueued.json +++ b/schemas/buildqueued.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -98,4 +105,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/buildstarted.json b/schemas/buildstarted.json index fae985df..fe4206d4 100644 --- a/schemas/buildstarted.json +++ b/schemas/buildstarted.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -98,4 +105,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/changeabandoned.json b/schemas/changeabandoned.json index 3c9c8bd3..7cf19e86 100644 --- a/schemas/changeabandoned.json +++ b/schemas/changeabandoned.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -117,4 +124,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/changecreated.json b/schemas/changecreated.json index 5e11c9cc..07b8fde3 100644 --- a/schemas/changecreated.json +++ b/schemas/changecreated.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, diff --git a/schemas/changemerged.json b/schemas/changemerged.json index 639fda30..ace43683 100644 --- a/schemas/changemerged.json +++ b/schemas/changemerged.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -117,4 +124,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/changereviewed.json b/schemas/changereviewed.json index eaf7a4d6..5912c7a1 100644 --- a/schemas/changereviewed.json +++ b/schemas/changereviewed.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -117,4 +124,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/changeupdated.json b/schemas/changeupdated.json index 6dc26003..403ce784 100644 --- a/schemas/changeupdated.json +++ b/schemas/changeupdated.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -117,4 +124,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/environmentcreated.json b/schemas/environmentcreated.json index 598e15ec..89b44d8a 100644 --- a/schemas/environmentcreated.json +++ b/schemas/environmentcreated.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -105,4 +112,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/environmentdeleted.json b/schemas/environmentdeleted.json index 52ea88e5..929e09a4 100644 --- a/schemas/environmentdeleted.json +++ b/schemas/environmentdeleted.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -102,4 +109,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/environmentmodified.json b/schemas/environmentmodified.json index 239fedfe..839566a9 100644 --- a/schemas/environmentmodified.json +++ b/schemas/environmentmodified.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -105,4 +112,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/incidentdetected.json b/schemas/incidentdetected.json index b77700f6..2d30a071 100644 --- a/schemas/incidentdetected.json +++ b/schemas/incidentdetected.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -145,4 +152,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/incidentreported.json b/schemas/incidentreported.json index 2a5f2b6c..85584fb4 100644 --- a/schemas/incidentreported.json +++ b/schemas/incidentreported.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -151,4 +158,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/incidentresolved.json b/schemas/incidentresolved.json index 259bfcbe..8513564c 100644 --- a/schemas/incidentresolved.json +++ b/schemas/incidentresolved.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -145,4 +152,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/links/embeddedlinkend.json b/schemas/links/embeddedlinkend.json new file mode 100644 index 00000000..c484871a --- /dev/null +++ b/schemas/links/embeddedlinkend.json @@ -0,0 +1,31 @@ +{ + "link_type": { + "type": "string", + "enum": [ + "END" + ] + }, + "from": { + "description": "When consuming a CDEvent, you are consuming a parent event. So, when looking at the 'from' key, this is the parent's parent.", + "type": "object", + "properties": { + "context_id": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "context_id" + ] + }, + "tags": { + "type": "object", + "additionalProperties": true + }, + "additionalProperties": false, + "type": "object", + "required": [ + "link_type" + ] +} + diff --git a/schemas/links/embeddedlinkpath.json b/schemas/links/embeddedlinkpath.json new file mode 100644 index 00000000..50ac2b69 --- /dev/null +++ b/schemas/links/embeddedlinkpath.json @@ -0,0 +1,31 @@ +{ + "link_type": { + "type": "string", + "enum": [ + "PATH" + ] + }, + "from": { + "description": "When consuming a CDEvent, you are consuming a parent event. So, when looking at the 'from' key, this is the parent's parent.", + "type": "object", + "properties": { + "context_id": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "context_id" + ] + }, + "tags": { + "type": "object", + "additionalProperties": true + }, + "additionalProperties": false, + "type": "object", + "required": [ + "link_type", + "from" + ] +} diff --git a/schemas/links/embeddedlinkrelation.json b/schemas/links/embeddedlinkrelation.json new file mode 100644 index 00000000..ae811137 --- /dev/null +++ b/schemas/links/embeddedlinkrelation.json @@ -0,0 +1,34 @@ +{ + "link_type": { + "type": "string", + "enum": [ + "RELATION" + ] + }, + "link_kind": { + "type": "string", + "minLength": 1 + }, + "target": { + "description": "", + "type": "object", + "properties": { + "context_id": { + "type": "string", + "minLength": 1 + } + } + }, + "tags": { + "type": "object", + "additionalProperties": true + }, + "additionalProperties": false, + "type": "object", + "required": [ + "link_type", + "link_kind", + "target" + ] +} + diff --git a/schemas/links/embeddedlinksarray.json b/schemas/links/embeddedlinksarray.json new file mode 100644 index 00000000..95774eac --- /dev/null +++ b/schemas/links/embeddedlinksarray.json @@ -0,0 +1,19 @@ +{ + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "$ref": "embeddedlinkend.json" + }, + { + "type": "object", + "$ref": "embeddedlinkpath.json" + }, + { + "type": "object", + "$ref": "embeddedlinkrelation.json" + } + ] + } +} diff --git a/schemas/links/linkend.json b/schemas/links/linkend.json new file mode 100644 index 00000000..5d7a8711 --- /dev/null +++ b/schemas/links/linkend.json @@ -0,0 +1,58 @@ +{ + "chain_id": { + "description": "This represents the full lifecycles of a series of events in CDEvents", + "type": "string", + "minLength": 1 + }, + "link_type": { + "description": "The type associated with the link. In this case, 'END', suggesting the end of some CI/CD lifecycle", + "type": "string", + "enum": [ + "END" + ] + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "from": { + "description": "This is the context ID of the producing CDEvent.", + "type": "object", + "properties": { + "context_id": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "context_id" + ] + }, + "end": { + "description": "This is the context ID of the final CDEvent in the chain", + "type": "object", + "properties": { + "context_id": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "context_id" + ] + }, + "tags": { + "type": "object", + "additionalProperties": true + }, + "additionalProperties": false, + "type": "object", + "required": [ + "chain_id", + "link_type", + "timestamp", + "from", + "end" + ] +} + diff --git a/schemas/links/linkpath.json b/schemas/links/linkpath.json new file mode 100644 index 00000000..53e94616 --- /dev/null +++ b/schemas/links/linkpath.json @@ -0,0 +1,53 @@ +{ + "chain_id": { + "type": "string", + "minLength": 1 + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "link_type": { + "type": "string", + "enum": [ + "PATH" + ] + }, + "from": { + "type": "object", + "properties": { + "context_id": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "context_id" + ] + }, + "to": { + "type": "object", + "properties": { + "context_id": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "context_id" + ] + }, + "tags": { + "type": "object", + "additionalProperties": true + }, + "additionalProperties": false, + "type": "object", + "required": [ + "chain_id", + "link_type", + "timestamp", + "from", + "to" + ] +} diff --git a/schemas/links/linkrelation.json b/schemas/links/linkrelation.json new file mode 100644 index 00000000..256eb69f --- /dev/null +++ b/schemas/links/linkrelation.json @@ -0,0 +1,61 @@ +{ + "chain_id": { + "description": "This represents the full lifecycles of a series of events in CDEvents", + "type": "string", + "minLength": 1 + }, + "link_type": { + "type": "string", + "enum": [ + "RELATION" + ] + }, + "link_kind": { + "type": "string", + "minLength": 1 + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "source": { + "description": "", + "type": "object", + "properties": { + "context_id": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "context_id" + ] + }, + "target": { + "description": "", + "type": "object", + "properties": { + "context_id": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "context_id" + ] + }, + "tags": { + "type": "object", + "additionalProperties": true + }, + "additionalProperties": false, + "type": "object", + "required": [ + "chain_id", + "link_type", + "timestamp", + "source", + "target" + ] +} + diff --git a/schemas/links/linkstart.json b/schemas/links/linkstart.json new file mode 100644 index 00000000..ff3d9c64 --- /dev/null +++ b/schemas/links/linkstart.json @@ -0,0 +1,43 @@ +{ + "chain_id": { + "description": "This represents the full lifecycles of a series of events in CDEvents", + "type": "string", + "minLength": 1 + }, + "link_type": { + "description": "The type associated with the link. In this case, 'START', suggesting the start of some CI/CD lifecycle", + "type": "string", + "enum": [ + "START" + ] + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "start": { + "description": "This is the context ID of the starting CDEvent in the chain.", + "type": "object", + "properties": { + "context_id": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "context_id" + ] + }, + "tags": { + "type": "object", + "additionalProperties": true + }, + "additionalProperties": false, + "type": "object", + "required": [ + "chain_id", + "link_type", + "timestamp", + "start" + ] +} diff --git a/schemas/pipelinerunfinished.json b/schemas/pipelinerunfinished.json index 30f254ec..6e6e8e31 100644 --- a/schemas/pipelinerunfinished.json +++ b/schemas/pipelinerunfinished.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -111,4 +118,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/pipelinerunqueued.json b/schemas/pipelinerunqueued.json index 068b4f7c..00562abf 100644 --- a/schemas/pipelinerunqueued.json +++ b/schemas/pipelinerunqueued.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -105,4 +112,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/pipelinerunstarted.json b/schemas/pipelinerunstarted.json index ac9947d9..e3d9c9a5 100644 --- a/schemas/pipelinerunstarted.json +++ b/schemas/pipelinerunstarted.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -109,4 +116,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/repositorycreated.json b/schemas/repositorycreated.json index eff6cca6..a9551102 100644 --- a/schemas/repositorycreated.json +++ b/schemas/repositorycreated.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -117,4 +124,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/repositorydeleted.json b/schemas/repositorydeleted.json index 0ee4c51c..b45c69aa 100644 --- a/schemas/repositorydeleted.json +++ b/schemas/repositorydeleted.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -111,4 +118,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/repositorymodified.json b/schemas/repositorymodified.json index b2c331db..bdc35486 100644 --- a/schemas/repositorymodified.json +++ b/schemas/repositorymodified.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -111,4 +118,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/servicedeployed.json b/schemas/servicedeployed.json index 3276d4ea..0fe98639 100644 --- a/schemas/servicedeployed.json +++ b/schemas/servicedeployed.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -125,4 +132,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/servicepublished.json b/schemas/servicepublished.json index 32a1c123..2bc3ed6e 100644 --- a/schemas/servicepublished.json +++ b/schemas/servicepublished.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -117,4 +124,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/serviceremoved.json b/schemas/serviceremoved.json index 70e29fa5..ce92eca6 100644 --- a/schemas/serviceremoved.json +++ b/schemas/serviceremoved.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -117,4 +124,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/servicerolledback.json b/schemas/servicerolledback.json index 2898a9e3..992e9357 100644 --- a/schemas/servicerolledback.json +++ b/schemas/servicerolledback.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -125,4 +132,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/serviceupgraded.json b/schemas/serviceupgraded.json index 080c376a..c69bb207 100644 --- a/schemas/serviceupgraded.json +++ b/schemas/serviceupgraded.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -125,4 +132,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/taskrunfinished.json b/schemas/taskrunfinished.json index 33ddd48a..c8f46a49 100644 --- a/schemas/taskrunfinished.json +++ b/schemas/taskrunfinished.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -129,4 +136,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/taskrunstarted.json b/schemas/taskrunstarted.json index 1c5ca741..e1221ceb 100644 --- a/schemas/taskrunstarted.json +++ b/schemas/taskrunstarted.json @@ -32,6 +32,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, @@ -123,4 +130,4 @@ "context", "subject" ] -} \ No newline at end of file +} diff --git a/schemas/testcaserunfinished.json b/schemas/testcaserunfinished.json index d267a2a1..50f9bca2 100644 --- a/schemas/testcaserunfinished.json +++ b/schemas/testcaserunfinished.json @@ -31,6 +31,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, diff --git a/schemas/testcaserunqueued.json b/schemas/testcaserunqueued.json index c8ccef71..484abfcd 100644 --- a/schemas/testcaserunqueued.json +++ b/schemas/testcaserunqueued.json @@ -31,6 +31,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, diff --git a/schemas/testcaserunstarted.json b/schemas/testcaserunstarted.json index 672cb468..aa2232bb 100644 --- a/schemas/testcaserunstarted.json +++ b/schemas/testcaserunstarted.json @@ -31,6 +31,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, diff --git a/schemas/testoutputpublished.json b/schemas/testoutputpublished.json index bdff3a9a..904edc03 100644 --- a/schemas/testoutputpublished.json +++ b/schemas/testoutputpublished.json @@ -31,6 +31,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, diff --git a/schemas/testsuiterunfinished.json b/schemas/testsuiterunfinished.json index 6e821c2f..e00488de 100644 --- a/schemas/testsuiterunfinished.json +++ b/schemas/testsuiterunfinished.json @@ -31,6 +31,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, diff --git a/schemas/testsuiterunqueued.json b/schemas/testsuiterunqueued.json index 96d995fa..9720306f 100644 --- a/schemas/testsuiterunqueued.json +++ b/schemas/testsuiterunqueued.json @@ -31,6 +31,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, diff --git a/schemas/testsuiterunstarted.json b/schemas/testsuiterunstarted.json index c88de307..236be346 100644 --- a/schemas/testsuiterunstarted.json +++ b/schemas/testsuiterunstarted.json @@ -31,6 +31,13 @@ "type": "string", "minLength": 1, "format": "uri" + }, + "chain_id": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray.json" } }, "additionalProperties": false, diff --git a/spec.md b/spec.md index 06641b31..f75a2dfd 100644 --- a/spec.md +++ b/spec.md @@ -32,6 +32,9 @@ CDEvents is a common specification for Continuous Delivery events. - [source (context)](#source-context) - [timestamp](#timestamp) - [version](#version) + - [OPTIONAL Context Attributes](#optional-context-attributes) + - [chain_id](#chain_id) + - [links](#links) - [Context example](#context-example) - [CDEvent subject](#cdevent-subject) - [REQUIRED Subject Attributes](#required-subject-attributes) @@ -297,6 +300,59 @@ defined in the [vocabulary](#vocabulary): - If there is a single "context" (cloud, cluster or platform of some kind) - `https://myorg.com/cdevents/schema/artifact-published-0-1-0` +#### chain_id + +- Type: [`String`][typesystem] +- Description: Identifier for a chain as defined in the [links spec](links.md). + +- Constraints: + - A [UUID version 4](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)) + +#### links + +- Type: [`List`][typesystem] +- Description: A list of link objects as defined in the [links spec](links.md). + +- Examples: + - A path link which is used to indicate a direct connection between two + events + + ```json + [ + { + "link_type": "PATH", + "from": { + "context_id": "271069a8-fc18-44f1-b38f-9d70a1695819" + } + } + ] + ``` + - A relation link where the `context_id` is was some trigger for this event + + ```json + [ + { + "link_type": "RELATION", + "link_kind": "TRIGGER", + "target": { + "context_id": "5328c37f-bb7e-4bb7-84ea-9f5f85e4a7ce" + } + } + ] + ``` + - An end link signaling the end of a chain + + ```json + [ + { + "link_type": "END", + "from": { + "context_id": "fb455028-a876-430e-a5ff-4b2ece77e827" + } + } + ] + ``` + ### Context example This is an example of a full CDEvent context, rendered in JSON format: @@ -555,4 +611,4 @@ platforms. [typesystem]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type-system [datacontenttype]: https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#datacontenttype [rfc2406]: https://tools.ietf.org/html/rfc2046 -[purl-spec]: https://github.com/package-url/purl-spec/blob/master/PURL-SPECIFICATION.rst \ No newline at end of file +[purl-spec]: https://github.com/package-url/purl-spec/blob/master/PURL-SPECIFICATION.rst