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 new file mode 100644 index 0000000..eef8371 --- /dev/null +++ b/conformance/deployment_finished.json @@ -0,0 +1,20 @@ +{ + "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-draft", + "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", + "tier": "production", + "outcome": "success" + } + } +} diff --git a/conformance/deployment_queued.json b/conformance/deployment_queued.json new file mode 100644 index 0000000..0daa817 --- /dev/null +++ b/conformance/deployment_queued.json @@ -0,0 +1,19 @@ +{ + "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-draft", + "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", + "tier": "production" + } + } +} diff --git a/conformance/deployment_started.json b/conformance/deployment_started.json new file mode 100644 index 0000000..76d78a0 --- /dev/null +++ b/conformance/deployment_started.json @@ -0,0 +1,19 @@ +{ + "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-draft", + "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", + "tier": "production" + } + } +} diff --git a/continuous-deployment.md b/continuous-deployment.md index fba55e9..12c5e18 100644 --- a/continuous-deployment.md +++ b/continuous-deployment.md @@ -14,17 +14,20 @@ 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 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 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` | @@ -43,6 +46,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 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` | +| 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 ### [`environment created`](conformance/environment_created.json) @@ -148,6 +162,53 @@ 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-draft`__ +- 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` | ✅ | +| 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-draft`__ +- 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` | ✅ | +| 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-draft`__ +- 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` | ✅ | +| 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) 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..3fbddea --- /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 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", + "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..cf8c0ab --- /dev/null +++ b/schemas/_defs/finished.json @@ -0,0 +1,19 @@ +{ + "$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 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..708da20 --- /dev/null +++ b/schemas/_defs/queued.json @@ -0,0 +1,17 @@ +{ + "$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 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/_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 new file mode 100644 index 0000000..04fadf8 --- /dev/null +++ b/schemas/deploymentfinished.json @@ -0,0 +1,129 @@ +{ + "$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-draft" + ], + "default": "dev.cdevents.deployment.finished.0.1.0-draft" + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "schemaUri": { + "type": "string", + "minLength": 1, + "format": "uri" + }, + "chainId": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "specversion", + "id", + "source", + "type", + "timestamp" + ] + }, + "subject": { + "properties": { + "id": { + "type": "string", + "minLength": 1 + }, + "source": { + "type": "string", + "minLength": 1, + "format": "uri-reference" + }, + "content": { + "properties": { + "artifactId": { + "type": "string", + "minLength": 1 + }, + "tier": { + "type": "string", + "minLength": 1 + }, + "outcome": { + "type": "string", + "enum": [ + "success", + "failure", + "cancel", + "error" + ] + }, + "errors": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "artifactId", + "tier", + "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..ed50e7b --- /dev/null +++ b/schemas/deploymentqueued.json @@ -0,0 +1,116 @@ +{ + "$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-draft" + ], + "default": "dev.cdevents.deployment.queued.0.1.0-draft" + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "schemaUri": { + "type": "string", + "minLength": 1, + "format": "uri" + }, + "chainId": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "specversion", + "id", + "source", + "type", + "timestamp" + ] + }, + "subject": { + "properties": { + "id": { + "type": "string", + "minLength": 1 + }, + "source": { + "type": "string", + "minLength": 1, + "format": "uri-reference" + }, + "content": { + "properties": { + "artifactId": { + "type": "string", + "minLength": 1 + }, + "tier": { + "type": "string", + "minLength": 1 + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "artifactId", + "tier" + ] + } + }, + "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..08302be --- /dev/null +++ b/schemas/deploymentstarted.json @@ -0,0 +1,116 @@ +{ + "$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-draft" + ], + "default": "dev.cdevents.deployment.started.0.1.0-draft" + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "schemaUri": { + "type": "string", + "minLength": 1, + "format": "uri" + }, + "chainId": { + "type": "string", + "minLength": 1 + }, + "links": { + "$ref": "links/embeddedlinksarray" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "specversion", + "id", + "source", + "type", + "timestamp" + ] + }, + "subject": { + "properties": { + "id": { + "type": "string", + "minLength": 1 + }, + "source": { + "type": "string", + "minLength": 1, + "format": "uri-reference" + }, + "content": { + "properties": { + "artifactId": { + "type": "string", + "minLength": 1 + }, + "tier": { + "type": "string", + "minLength": 1 + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "artifactId", + "tier" + ] + } + }, + "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" + ] +}