From 2f9160c9bb3a7c87a93b25abd1fea69c9c05b3fa Mon Sep 17 00:00:00 2001 From: xibz Date: Tue, 21 Jul 2026 11:35:31 -0500 Subject: [PATCH 1/2] feat(deployment): add deployment subject and queued/started/finished events Deployments today are only visible as a side effect of a service state change (service.deployed/service.upgraded), with no way to observe the orchestration act itself: when a rollout started, when it finished, or how long it took. This adds deployment as its own subject with the standard queued/started/finished lifecycle, giving DORA-style tooling an explicit deployment-duration/outcome fact independent of the resulting service entity. service.deployed/service.upgraded are unchanged; whether to deprecate them is a separate decision left for a follow-up once deployment.* has implementation experience. The original proposal also included a targetRollout subject to model fan-out to multiple destinations within one deployment; that's split into a separate follow-up PR pending more implementation experience. Signed-off-by: xibz --- conformance/deployment_finished.json | 22 +++++ conformance/deployment_queued.json | 21 ++++ conformance/deployment_started.json | 21 ++++ continuous-deployment.md | 60 +++++++++++- schemas/_defs/deployment.json | 19 ++++ schemas/_defs/finished.json | 20 ++++ schemas/_defs/queued.json | 18 ++++ schemas/deploymentfinished.json | 140 +++++++++++++++++++++++++++ schemas/deploymentqueued.json | 130 +++++++++++++++++++++++++ schemas/deploymentstarted.json | 130 +++++++++++++++++++++++++ 10 files changed, 580 insertions(+), 1 deletion(-) create mode 100644 conformance/deployment_finished.json create mode 100644 conformance/deployment_queued.json create mode 100644 conformance/deployment_started.json create mode 100644 schemas/_defs/deployment.json create mode 100644 schemas/_defs/finished.json create mode 100644 schemas/_defs/queued.json create mode 100644 schemas/deploymentfinished.json create mode 100644 schemas/deploymentqueued.json create mode 100644 schemas/deploymentstarted.json diff --git a/conformance/deployment_finished.json b/conformance/deployment_finished.json new file mode 100644 index 0000000..d27f5c9 --- /dev/null +++ b/conformance/deployment_finished.json @@ -0,0 +1,22 @@ +{ + "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.deployment.finished.0.1.0", + "timestamp": "2023-03-20T14:27:05.315384Z", + "schemaUri": "https://myorg.com/schema/custom" + }, + "subject": { + "id": "mySubject123", + "source": "/event/source/123", + "content": { + "artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427", + "environment": { + "id": "test123" + }, + "outcome": "success" + } + } +} diff --git a/conformance/deployment_queued.json b/conformance/deployment_queued.json new file mode 100644 index 0000000..1dd4656 --- /dev/null +++ b/conformance/deployment_queued.json @@ -0,0 +1,21 @@ +{ + "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.deployment.queued.0.1.0", + "timestamp": "2023-03-20T14:27:05.315384Z", + "schemaUri": "https://myorg.com/schema/custom" + }, + "subject": { + "id": "mySubject123", + "source": "/event/source/123", + "content": { + "artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427", + "environment": { + "id": "test123" + } + } + } +} diff --git a/conformance/deployment_started.json b/conformance/deployment_started.json new file mode 100644 index 0000000..0985fec --- /dev/null +++ b/conformance/deployment_started.json @@ -0,0 +1,21 @@ +{ + "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.deployment.started.0.1.0", + "timestamp": "2023-03-20T14:27:05.315384Z", + "schemaUri": "https://myorg.com/schema/custom" + }, + "subject": { + "id": "mySubject123", + "source": "/event/source/123", + "content": { + "artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427", + "environment": { + "id": "test123" + } + } + } +} diff --git a/continuous-deployment.md b/continuous-deployment.md index fba55e9..05336e1 100644 --- a/continuous-deployment.md +++ b/continuous-deployment.md @@ -14,12 +14,13 @@ Continuous Deployment (CD) events are related to continuous deployment pipelines ## Subjects -This specification defines two subjects in this stage: `environment` and `service`. The term `service` is used to represent a running Artifact. A `service` can represent a binary that is running, a daemon, an application, a docker container. The term `environment` represent any platform which has all the means to run a `service`. +This specification defines three subjects in this stage: `environment`, `service`, and `deployment`. The term `service` is used to represent a running Artifact. A `service` can represent a binary that is running, a daemon, an application, a docker container. The term `environment` represent any platform which has all the means to run a `service`. A `deployment` is the act of applying a version of a release unit to an environment. | Subject | Description | Predicates | |---------|-------------|------------| | [`environment`](#environment) | An environment where to run services | [`created`](#environment-created), [`modified`](#environment-modified), [`deleted`](#environment-deleted)| | [`service`](#service) | A service | [`deployed`](#service-deployed), [`upgraded`](#service-upgraded), [`rolledback`](#service-rolledback), [`removed`](#service-removed), [`published`](#service-published)| +| [`deployment`](#deployment) | The act of deploying a release unit to an environment | [`queued`](#deployment-queued), [`started`](#deployment-started), [`finished`](#deployment-finished)| ### `environment` @@ -43,6 +44,17 @@ A `service` can represent for example a binary that is running, a daemon, an app | environment | `Object` ([`environment`](#environment)) | Reference for the environment where the service runs | `{"id": "1234"}`, `{"id": "maven123, "source": "tekton-dev-123"}` | | artifactId | `Purl` | Identifier of the artifact deployed with this service | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427`, `pkg:golang/mygit.com/myorg/myapp@234fd47e07d1004f0aed9c` | +### `deployment` + +A `deployment` is the act of applying a version of a release unit to an environment. It may be carried out by an automated CD pipeline or as a single manual action, such as a one-off `kubectl apply`; a `deployment` does not require an orchestrator or pipeline to exist. A `deployment` is that act and its outcome only, not the pipeline or tool that performed it (see [`pipelineRun`](core.md#pipelinerun)), and not the resulting state of the running service, which `service` describes separately. Where a producer's pipeline execution is itself the natural deployment boundary, its `id` MAY be reused as the `deployment` subject's `id`. + +| Field | Type | Description | Examples | +|-------|------|-------------|----------| +| id | `String` | See [id](spec.md#id-subject)| `dep-8f3a2c` | +| source | `URI-Reference` | See [source](spec.md#source-subject) | `/cd/deploy-controller` | +| artifactId | `Purl` | Identifier of the artifact being deployed | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427` | +| environment | `Object` ([`environment`](#environment)) | Reference to the target environment | `{"id": "production"}` | + ## Events ### [`environment created`](conformance/environment_created.json) @@ -148,6 +160,52 @@ This event represents the removal of a previously deployed service instance and | source | `URI-Reference` | See [source](spec.md#source-subject) | | | | environment | `Object` ([`environment`](#environment)) | Reference for the environment where the service runs | `{"id": "1234"}`, `{"id": "maven123, "source": "tekton-dev-123"}` | ✅ | +### [`deployment queued`](conformance/deployment_queued.json) + +This event represents a deployment that has been accepted and is waiting to begin. + +- Event Type: __`dev.cdevents.deployment.queued.0.1.0`__ +- Predicate: queued +- Subject: [`deployment`](#deployment) + +| Field | Type | Description | Examples | Required | +|-------|------|-------------|----------|----------------------------| +| id | `String` | See [id](spec.md#id-subject)| `dep-8f3a2c` | ✅ | +| source | `URI-Reference` | See [source](spec.md#source-subject) | | | +| artifactId | `Purl` | Identifier of the artifact being deployed | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427` | ✅ | +| environment | `Object` ([`environment`](#environment)) | Reference to the target environment | `{"id": "production"}` | ✅ | + +### [`deployment started`](conformance/deployment_started.json) + +This event represents a deployment controller that has begun orchestrating a rollout. + +- Event Type: __`dev.cdevents.deployment.started.0.1.0`__ +- Predicate: started +- Subject: [`deployment`](#deployment) + +| Field | Type | Description | Examples | Required | +|-------|------|-------------|----------|----------------------------| +| id | `String` | See [id](spec.md#id-subject)| `dep-8f3a2c` | ✅ | +| source | `URI-Reference` | See [source](spec.md#source-subject) | | | +| artifactId | `Purl` | Identifier of the artifact being deployed | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427` | ✅ | +| environment | `Object` ([`environment`](#environment)) | Reference to the target environment | `{"id": "production"}` | ✅ | + +### [`deployment finished`](conformance/deployment_finished.json) + +This event represents a deployment that has completed. `deployment.finished` is the orchestration-side completion fact for a deployment, analogous to `build finished` on the CI side, and is kept separate from the entity-side fact carried by `service.deployed`. + +- Event Type: __`dev.cdevents.deployment.finished.0.1.0`__ +- Predicate: finished +- Subject: [`deployment`](#deployment) + +| Field | Type | Description | Examples | Required | +|-------|------|-------------|----------|----------------------------| +| id | `String` | See [id](spec.md#id-subject)| `dep-8f3a2c` | ✅ | +| source | `URI-Reference` | See [source](spec.md#source-subject) | | | +| artifactId | `Purl` | Identifier of the artifact being deployed | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427` | ✅ | +| environment | `Object` ([`environment`](#environment)) | Reference to the target environment | `{"id": "production"}` | ✅ | +| outcome | `String (enum)` | Outcome of the finished deployment | `success`, `failure`, `cancel`, `error` | ✅ | + ### [`service published`](conformance/service_published.json) This event represents an existing instance of a service that has an accessible URL for users to interact with it. This event can be used to let other tools know that the service is ready and also available for consumption. diff --git a/schemas/_defs/deployment.json b/schemas/_defs/deployment.json new file mode 100644 index 0000000..7988c5a --- /dev/null +++ b/schemas/_defs/deployment.json @@ -0,0 +1,19 @@ +{ + "$id": "cdevents/_defs/deployment", + "term": "Deployment", + "definition": "A Deployment is the act of applying a version of a release unit to an environment. It may be carried out by an automated CD pipeline or as a single manual action, such as a one-off `kubectl apply`; a Deployment does not require an orchestrator or pipeline to exist. A Deployment is that act and its outcome only, not the pipeline or tool that performed it, and not the resulting state of the running service, which the `service` subject describes separately.", + "notes": [ + "A Deployment is not the pipeline or tooling that executed it", + "A Deployment does not require an orchestrator or CD pipeline to exist; a single manual action, such as a one-off `kubectl apply`, is still a deployment", + "deployment separates the act of deploying (this subject) from the entity fact of a running service (`service`), mirroring the build/artifact split in CI" + ], + "examples": [ + "Deploying myapp v1.2.3 to the production environment", + "A Spinnaker pipeline execution that rolls out a service to a Kubernetes cluster", + "A developer manually running `kubectl apply -f deploy.yaml` and reporting the outcome, with no CD pipeline involved" + ], + "counterExamples": [ + "The pipeline that performed the deployment", + "The resulting running state of the service (that is `service`)" + ] +} diff --git a/schemas/_defs/finished.json b/schemas/_defs/finished.json new file mode 100644 index 0000000..56001e3 --- /dev/null +++ b/schemas/_defs/finished.json @@ -0,0 +1,20 @@ +{ + "$id": "cdevents/_defs/finished", + "term": "Finished", + "definition": "Indicates that execution of an entity has ended, regardless of outcome. The outcome field on the event conveys whether execution succeeded or failed.", + "notes": [ + "A finished event does not imply successful execution.", + "The outcome field must be inspected to determine success or failure.", + "A finished event is terminal — no further lifecycle events follow for this entity." + ], + "examples": [ + "A deployment completing across all target rollouts", + "A target rollout completing at its destination", + "A pipeline run terminating with success or failure" + ], + "counterExamples": [ + "Intermediate execution states", + "Progress or partial completion signals", + "Cancellation requests (the finished event is emitted after cancellation is complete)" + ] +} diff --git a/schemas/_defs/queued.json b/schemas/_defs/queued.json new file mode 100644 index 0000000..9990d37 --- /dev/null +++ b/schemas/_defs/queued.json @@ -0,0 +1,18 @@ +{ + "$id": "cdevents/_defs/queued", + "term": "Queued", + "definition": "Indicates that an entity has been accepted and is waiting to begin execution.", + "notes": [ + "A queued event does not imply that execution has started.", + "The associated entity may be held by scheduling, resource availability, or dependencies." + ], + "examples": [ + "A deployment accepted by a deploy controller and waiting for resources", + "A target rollout scheduled but not yet executing", + "A pipeline run waiting in a queue before a worker picks it up" + ], + "counterExamples": [ + "Active execution of the entity", + "Completion or failure of the entity" + ] +} diff --git a/schemas/deploymentfinished.json b/schemas/deploymentfinished.json new file mode 100644 index 0000000..f2c2b01 --- /dev/null +++ b/schemas/deploymentfinished.json @@ -0,0 +1,140 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://cdevents.dev/0.6.0-draft/schema/deployment-finished-event", + "x-cdevents-semantics": { + "subject": "cdevents/_defs/deployment", + "predicate": "cdevents/_defs/finished" + }, + "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.deployment.finished.0.1.0" + ], + "default": "dev.cdevents.deployment.finished.0.1.0" + }, + "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": { + "artifactId": { + "type": "string", + "minLength": 1 + }, + "environment": { + "properties": { + "id": { + "type": "string", + "minLength": 1 + }, + "source": { + "type": "string", + "minLength": 1, + "format": "uri-reference" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "id" + ] + }, + "outcome": { + "type": "string", + "enum": [ + "success", + "failure", + "cancel", + "error" + ] + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "artifactId", + "environment", + "outcome" + ] + } + }, + "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" + ] +} diff --git a/schemas/deploymentqueued.json b/schemas/deploymentqueued.json new file mode 100644 index 0000000..eda11f5 --- /dev/null +++ b/schemas/deploymentqueued.json @@ -0,0 +1,130 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://cdevents.dev/0.6.0-draft/schema/deployment-queued-event", + "x-cdevents-semantics": { + "subject": "cdevents/_defs/deployment", + "predicate": "cdevents/_defs/queued" + }, + "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.deployment.queued.0.1.0" + ], + "default": "dev.cdevents.deployment.queued.0.1.0" + }, + "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": { + "artifactId": { + "type": "string", + "minLength": 1 + }, + "environment": { + "properties": { + "id": { + "type": "string", + "minLength": 1 + }, + "source": { + "type": "string", + "minLength": 1, + "format": "uri-reference" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "id" + ] + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "artifactId", + "environment" + ] + } + }, + "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" + ] +} diff --git a/schemas/deploymentstarted.json b/schemas/deploymentstarted.json new file mode 100644 index 0000000..0a48df1 --- /dev/null +++ b/schemas/deploymentstarted.json @@ -0,0 +1,130 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://cdevents.dev/0.6.0-draft/schema/deployment-started-event", + "x-cdevents-semantics": { + "subject": "cdevents/_defs/deployment", + "predicate": "cdevents/_defs/started" + }, + "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.deployment.started.0.1.0" + ], + "default": "dev.cdevents.deployment.started.0.1.0" + }, + "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": { + "artifactId": { + "type": "string", + "minLength": 1 + }, + "environment": { + "properties": { + "id": { + "type": "string", + "minLength": 1 + }, + "source": { + "type": "string", + "minLength": 1, + "format": "uri-reference" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "id" + ] + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "artifactId", + "environment" + ] + } + }, + "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" + ] +} From 6895b51c49e8fd8cfdb3e123822e82074a6513f4 Mon Sep 17 00:00:00 2001 From: xibz Date: Wed, 14 Oct 2026 09:08:57 -0500 Subject: [PATCH 2/2] fix(deployment): address review feedback, add tier - Version the new deployment events 0.1.0-draft until release. - Drop the targetRollout examples from the queued/finished definitions; targetRollout moved to its own PR. - Replace the undefined "release unit" with "artifact". - Add errors to deployment.finished, consistent with pipelineRun.finished. - Replace the environment reference with tier: the logical environment (production, staging, ...) a deployment targets, used to compute lead time to deploy. The environment subject is defined as a platform and is commonly used to mean a specific cluster, so the logical concept gets its own name, defined in _defs/tier.json, and the environment section points to it. Signed-off-by: xibz --- .spellcheck-en-custom.txt | 2 ++ conformance/deployment_finished.json | 6 ++---- conformance/deployment_queued.json | 6 ++---- conformance/deployment_started.json | 6 ++---- continuous-deployment.md | 23 ++++++++++++---------- schemas/_defs/deployment.json | 2 +- schemas/_defs/finished.json | 1 - schemas/_defs/queued.json | 1 - schemas/_defs/tier.json | 21 ++++++++++++++++++++ schemas/deploymentfinished.json | 29 +++++++++------------------- schemas/deploymentqueued.json | 26 ++++++------------------- schemas/deploymentstarted.json | 26 ++++++------------------- 12 files changed, 64 insertions(+), 85 deletions(-) create mode 100644 schemas/_defs/tier.json diff --git a/.spellcheck-en-custom.txt b/.spellcheck-en-custom.txt index 4bb487d..59b4fea 100644 --- a/.spellcheck-en-custom.txt +++ b/.spellcheck-en-custom.txt @@ -48,11 +48,13 @@ md namespace notational observability +orchestrator param pipelinerun png pre rolledback +rollout runtime sbom schemaUri diff --git a/conformance/deployment_finished.json b/conformance/deployment_finished.json index d27f5c9..eef8371 100644 --- a/conformance/deployment_finished.json +++ b/conformance/deployment_finished.json @@ -4,7 +4,7 @@ "id": "271069a8-fc18-44f1-b38f-9d70a1695819", "chainId": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", - "type": "dev.cdevents.deployment.finished.0.1.0", + "type": "dev.cdevents.deployment.finished.0.1.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", "schemaUri": "https://myorg.com/schema/custom" }, @@ -13,9 +13,7 @@ "source": "/event/source/123", "content": { "artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427", - "environment": { - "id": "test123" - }, + "tier": "production", "outcome": "success" } } diff --git a/conformance/deployment_queued.json b/conformance/deployment_queued.json index 1dd4656..0daa817 100644 --- a/conformance/deployment_queued.json +++ b/conformance/deployment_queued.json @@ -4,7 +4,7 @@ "id": "271069a8-fc18-44f1-b38f-9d70a1695819", "chainId": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", - "type": "dev.cdevents.deployment.queued.0.1.0", + "type": "dev.cdevents.deployment.queued.0.1.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", "schemaUri": "https://myorg.com/schema/custom" }, @@ -13,9 +13,7 @@ "source": "/event/source/123", "content": { "artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427", - "environment": { - "id": "test123" - } + "tier": "production" } } } diff --git a/conformance/deployment_started.json b/conformance/deployment_started.json index 0985fec..76d78a0 100644 --- a/conformance/deployment_started.json +++ b/conformance/deployment_started.json @@ -4,7 +4,7 @@ "id": "271069a8-fc18-44f1-b38f-9d70a1695819", "chainId": "4c8cb7dd-3448-41de-8768-eec704e2829b", "source": "/event/source/123", - "type": "dev.cdevents.deployment.started.0.1.0", + "type": "dev.cdevents.deployment.started.0.1.0-draft", "timestamp": "2023-03-20T14:27:05.315384Z", "schemaUri": "https://myorg.com/schema/custom" }, @@ -13,9 +13,7 @@ "source": "/event/source/123", "content": { "artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427", - "environment": { - "id": "test123" - } + "tier": "production" } } } diff --git a/continuous-deployment.md b/continuous-deployment.md index 05336e1..12c5e18 100644 --- a/continuous-deployment.md +++ b/continuous-deployment.md @@ -14,18 +14,20 @@ Continuous Deployment (CD) events are related to continuous deployment pipelines ## Subjects -This specification defines three subjects in this stage: `environment`, `service`, and `deployment`. The term `service` is used to represent a running Artifact. A `service` can represent a binary that is running, a daemon, an application, a docker container. The term `environment` represent any platform which has all the means to run a `service`. A `deployment` is the act of applying a version of a release unit to an environment. +This specification defines three subjects in this stage: `environment`, `service`, and `deployment`. The term `service` is used to represent a running Artifact. A `service` can represent a binary that is running, a daemon, an application, a docker container. The term `environment` represent any platform which has all the means to run a `service`. A `deployment` is the act of applying a version of an artifact to an environment. | Subject | Description | Predicates | |---------|-------------|------------| | [`environment`](#environment) | An environment where to run services | [`created`](#environment-created), [`modified`](#environment-modified), [`deleted`](#environment-deleted)| | [`service`](#service) | A service | [`deployed`](#service-deployed), [`upgraded`](#service-upgraded), [`rolledback`](#service-rolledback), [`removed`](#service-removed), [`published`](#service-published)| -| [`deployment`](#deployment) | The act of deploying a release unit to an environment | [`queued`](#deployment-queued), [`started`](#deployment-started), [`finished`](#deployment-finished)| +| [`deployment`](#deployment) | The act of deploying an artifact to an environment | [`queued`](#deployment-queued), [`started`](#deployment-started), [`finished`](#deployment-finished)| ### `environment` An `environment` is a platform which may run a `service`. +For the logical environment a deployment targets, such as `production` or `staging`, see [`tier`](schemas/_defs/tier.json). + | Field | Type | Description | Examples | |-------|------|-------------|----------| | id | `String` | See [id](spec.md#id-subject)| `1234`, `maven123`, `builds/taskrun123` | @@ -46,14 +48,14 @@ A `service` can represent for example a binary that is running, a daemon, an app ### `deployment` -A `deployment` is the act of applying a version of a release unit to an environment. It may be carried out by an automated CD pipeline or as a single manual action, such as a one-off `kubectl apply`; a `deployment` does not require an orchestrator or pipeline to exist. A `deployment` is that act and its outcome only, not the pipeline or tool that performed it (see [`pipelineRun`](core.md#pipelinerun)), and not the resulting state of the running service, which `service` describes separately. Where a producer's pipeline execution is itself the natural deployment boundary, its `id` MAY be reused as the `deployment` subject's `id`. +A `deployment` is the act of applying a version of an artifact to an environment. It may be carried out by an automated CD pipeline or as a single manual action, such as a one-off `kubectl apply`; a `deployment` does not require an orchestrator or pipeline to exist. A `deployment` is that act and its outcome only, not the pipeline or tool that performed it (see [`pipelineRun`](core.md#pipelinerun)), and not the resulting state of the running service, which `service` describes separately. Where a producer's pipeline execution is itself the natural deployment boundary, its `id` MAY be reused as the `deployment` subject's `id`. | Field | Type | Description | Examples | |-------|------|-------------|----------| | id | `String` | See [id](spec.md#id-subject)| `dep-8f3a2c` | | source | `URI-Reference` | See [source](spec.md#source-subject) | `/cd/deploy-controller` | | artifactId | `Purl` | Identifier of the artifact being deployed | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427` | -| environment | `Object` ([`environment`](#environment)) | Reference to the target environment | `{"id": "production"}` | +| tier | `String` | The logical environment being deployed to, used to compute lead time to deploy. See [tier](schemas/_defs/tier.json) | `production`, `staging`, `development` | ## Events @@ -164,7 +166,7 @@ This event represents the removal of a previously deployed service instance and This event represents a deployment that has been accepted and is waiting to begin. -- Event Type: __`dev.cdevents.deployment.queued.0.1.0`__ +- Event Type: __`dev.cdevents.deployment.queued.0.1.0-draft`__ - Predicate: queued - Subject: [`deployment`](#deployment) @@ -173,13 +175,13 @@ This event represents a deployment that has been accepted and is waiting to begi | id | `String` | See [id](spec.md#id-subject)| `dep-8f3a2c` | ✅ | | source | `URI-Reference` | See [source](spec.md#source-subject) | | | | artifactId | `Purl` | Identifier of the artifact being deployed | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427` | ✅ | -| environment | `Object` ([`environment`](#environment)) | Reference to the target environment | `{"id": "production"}` | ✅ | +| tier | `String` | The logical environment being deployed to, used to compute lead time to deploy. See [tier](schemas/_defs/tier.json) | `production`, `staging`, `development` | ✅ | ### [`deployment started`](conformance/deployment_started.json) This event represents a deployment controller that has begun orchestrating a rollout. -- Event Type: __`dev.cdevents.deployment.started.0.1.0`__ +- Event Type: __`dev.cdevents.deployment.started.0.1.0-draft`__ - Predicate: started - Subject: [`deployment`](#deployment) @@ -188,13 +190,13 @@ This event represents a deployment controller that has begun orchestrating a rol | id | `String` | See [id](spec.md#id-subject)| `dep-8f3a2c` | ✅ | | source | `URI-Reference` | See [source](spec.md#source-subject) | | | | artifactId | `Purl` | Identifier of the artifact being deployed | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427` | ✅ | -| environment | `Object` ([`environment`](#environment)) | Reference to the target environment | `{"id": "production"}` | ✅ | +| tier | `String` | The logical environment being deployed to, used to compute lead time to deploy. See [tier](schemas/_defs/tier.json) | `production`, `staging`, `development` | ✅ | ### [`deployment finished`](conformance/deployment_finished.json) This event represents a deployment that has completed. `deployment.finished` is the orchestration-side completion fact for a deployment, analogous to `build finished` on the CI side, and is kept separate from the entity-side fact carried by `service.deployed`. -- Event Type: __`dev.cdevents.deployment.finished.0.1.0`__ +- Event Type: __`dev.cdevents.deployment.finished.0.1.0-draft`__ - Predicate: finished - Subject: [`deployment`](#deployment) @@ -203,8 +205,9 @@ This event represents a deployment that has completed. `deployment.finished` is | id | `String` | See [id](spec.md#id-subject)| `dep-8f3a2c` | ✅ | | source | `URI-Reference` | See [source](spec.md#source-subject) | | | | artifactId | `Purl` | Identifier of the artifact being deployed | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427` | ✅ | -| environment | `Object` ([`environment`](#environment)) | Reference to the target environment | `{"id": "production"}` | ✅ | +| tier | `String` | The logical environment being deployed to, used to compute lead time to deploy. See [tier](schemas/_defs/tier.json) | `production`, `staging`, `development` | ✅ | | outcome | `String (enum)` | Outcome of the finished deployment | `success`, `failure`, `cancel`, `error` | ✅ | +| errors | `String` | In case of error, canceled, or failed deployment, provides details about the failure | `Timeout during execution`, `deployment canceled by user`| | ### [`service published`](conformance/service_published.json) diff --git a/schemas/_defs/deployment.json b/schemas/_defs/deployment.json index 7988c5a..3fbddea 100644 --- a/schemas/_defs/deployment.json +++ b/schemas/_defs/deployment.json @@ -1,7 +1,7 @@ { "$id": "cdevents/_defs/deployment", "term": "Deployment", - "definition": "A Deployment is the act of applying a version of a release unit to an environment. It may be carried out by an automated CD pipeline or as a single manual action, such as a one-off `kubectl apply`; a Deployment does not require an orchestrator or pipeline to exist. A Deployment is that act and its outcome only, not the pipeline or tool that performed it, and not the resulting state of the running service, which the `service` subject describes separately.", + "definition": "A Deployment is the act of applying a version of an artifact to an environment. It may be carried out by an automated CD pipeline or as a single manual action, such as a one-off `kubectl apply`; a Deployment does not require an orchestrator or pipeline to exist. A Deployment is that act and its outcome only, not the pipeline or tool that performed it, and not the resulting state of the running service, which the `service` subject describes separately.", "notes": [ "A Deployment is not the pipeline or tooling that executed it", "A Deployment does not require an orchestrator or CD pipeline to exist; a single manual action, such as a one-off `kubectl apply`, is still a deployment", diff --git a/schemas/_defs/finished.json b/schemas/_defs/finished.json index 56001e3..cf8c0ab 100644 --- a/schemas/_defs/finished.json +++ b/schemas/_defs/finished.json @@ -9,7 +9,6 @@ ], "examples": [ "A deployment completing across all target rollouts", - "A target rollout completing at its destination", "A pipeline run terminating with success or failure" ], "counterExamples": [ diff --git a/schemas/_defs/queued.json b/schemas/_defs/queued.json index 9990d37..708da20 100644 --- a/schemas/_defs/queued.json +++ b/schemas/_defs/queued.json @@ -8,7 +8,6 @@ ], "examples": [ "A deployment accepted by a deploy controller and waiting for resources", - "A target rollout scheduled but not yet executing", "A pipeline run waiting in a queue before a worker picks it up" ], "counterExamples": [ diff --git a/schemas/_defs/tier.json b/schemas/_defs/tier.json new file mode 100644 index 0000000..61f35ee --- /dev/null +++ b/schemas/_defs/tier.json @@ -0,0 +1,21 @@ +{ + "$id": "cdevents/_defs/tier", + "term": "Tier", + "definition": "A Tier is the logical environment a deployment targets, such as production or staging, independent of the physical infrastructure it runs on. Tier is the value consumers compare across producers to compute delivery metrics such as lead time to deploy: a change is considered delivered when it is deployed to the production tier.", + "notes": [ + "Tier is what is commonly meant by \"environment\" (production, staging). It has its own name because the `environment` subject is defined as a platform, and is commonly used to mean a specific cluster", + "A Tier names a stage in the delivery path, not a place: a single tier is typically backed by many clusters, regions or slots", + "Tier is distinct from the `environment` subject, which producers commonly use to describe a specific platform or cluster", + "Producers should use the same tier values for the same stage across all of their deployments, so that consumers can compare them" + ], + "examples": [ + "production", + "staging", + "development" + ], + "counterExamples": [ + "A Kubernetes cluster such as prod-us-east-1", + "A cloud region such as us-east-1", + "A namespace or blue/green slot" + ] +} diff --git a/schemas/deploymentfinished.json b/schemas/deploymentfinished.json index f2c2b01..04fadf8 100644 --- a/schemas/deploymentfinished.json +++ b/schemas/deploymentfinished.json @@ -24,9 +24,9 @@ "type": { "type": "string", "enum": [ - "dev.cdevents.deployment.finished.0.1.0" + "dev.cdevents.deployment.finished.0.1.0-draft" ], - "default": "dev.cdevents.deployment.finished.0.1.0" + "default": "dev.cdevents.deployment.finished.0.1.0-draft" }, "timestamp": { "type": "string", @@ -72,23 +72,9 @@ "type": "string", "minLength": 1 }, - "environment": { - "properties": { - "id": { - "type": "string", - "minLength": 1 - }, - "source": { - "type": "string", - "minLength": 1, - "format": "uri-reference" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "id" - ] + "tier": { + "type": "string", + "minLength": 1 }, "outcome": { "type": "string", @@ -98,13 +84,16 @@ "cancel", "error" ] + }, + "errors": { + "type": "string" } }, "additionalProperties": false, "type": "object", "required": [ "artifactId", - "environment", + "tier", "outcome" ] } diff --git a/schemas/deploymentqueued.json b/schemas/deploymentqueued.json index eda11f5..ed50e7b 100644 --- a/schemas/deploymentqueued.json +++ b/schemas/deploymentqueued.json @@ -24,9 +24,9 @@ "type": { "type": "string", "enum": [ - "dev.cdevents.deployment.queued.0.1.0" + "dev.cdevents.deployment.queued.0.1.0-draft" ], - "default": "dev.cdevents.deployment.queued.0.1.0" + "default": "dev.cdevents.deployment.queued.0.1.0-draft" }, "timestamp": { "type": "string", @@ -72,30 +72,16 @@ "type": "string", "minLength": 1 }, - "environment": { - "properties": { - "id": { - "type": "string", - "minLength": 1 - }, - "source": { - "type": "string", - "minLength": 1, - "format": "uri-reference" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "id" - ] + "tier": { + "type": "string", + "minLength": 1 } }, "additionalProperties": false, "type": "object", "required": [ "artifactId", - "environment" + "tier" ] } }, diff --git a/schemas/deploymentstarted.json b/schemas/deploymentstarted.json index 0a48df1..08302be 100644 --- a/schemas/deploymentstarted.json +++ b/schemas/deploymentstarted.json @@ -24,9 +24,9 @@ "type": { "type": "string", "enum": [ - "dev.cdevents.deployment.started.0.1.0" + "dev.cdevents.deployment.started.0.1.0-draft" ], - "default": "dev.cdevents.deployment.started.0.1.0" + "default": "dev.cdevents.deployment.started.0.1.0-draft" }, "timestamp": { "type": "string", @@ -72,30 +72,16 @@ "type": "string", "minLength": 1 }, - "environment": { - "properties": { - "id": { - "type": "string", - "minLength": 1 - }, - "source": { - "type": "string", - "minLength": 1, - "format": "uri-reference" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "id" - ] + "tier": { + "type": "string", + "minLength": 1 } }, "additionalProperties": false, "type": "object", "required": [ "artifactId", - "environment" + "tier" ] } },