Skip to content

Commit 2ae0546

Browse files
authored
Improve subject fields spec and schema (#118)
* Improve subject fields spec and schema Improve the spec of subject fields for all events: - link id and source to their spec definitions - add the type, linked to its spec definition - include the value of the type for each event Improve the jsonschema by constraining the subject type field to the only valid value for each event. Since all events have been patched already in v0.2-draft, there's not need to +1 the version number again within the same spec release. Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
1 parent 6d9a0f1 commit 2ae0546

41 files changed

Lines changed: 326 additions & 126 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

continuous-deployment.md

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ An `environment` is a platform which may run a `service`.
2727

2828
| Field | Type | Description | Examples |
2929
|-------|------|-------------|----------|
30-
| id | `String` | Uniquely identifies the subject within the source. | `1234`, `maven123`, `builds/taskrun123` |
31-
| source | `URI-Reference` | [source](../spec.md#source) from the context | `staging/tekton`, `tekton-dev-123`|
30+
| id | `String` | See [id](spec.md#id-subject)| `1234`, `maven123`, `builds/taskrun123` |
31+
| source | `URI-Reference` | See [source](spec.md#source-subject) | `staging/tekton`, `tekton-dev-123`|
32+
| type | `String` | See [type](spec.md#type-subject) | `environment` |
3233
| name | `String` | Name of the environment | `dev`, `staging`, `production`, `ci-123`|
3334
| url | `String` | URL to reference where the environment is located | `https://my-cluster.zone.my-cloud-provider`|
3435

@@ -38,8 +39,9 @@ A `service` can represent for example a binary that is running, a daemon, an app
3839

3940
| Field | Type | Description | Examples |
4041
|-------|------|-------------|----------|
41-
| id | `String` | Uniquely identifies the subject within the source. | `service/myapp`, `daemonset/myapp` |
42-
| source | `URI-Reference` | [source](../spec.md#source) from the context | `staging/tekton`, `tekton-dev-123`|
42+
| id | `String` | See [id](spec.md#id-subject)| `service/myapp`, `daemonset/myapp` |
43+
| source | `URI-Reference` | See [source](spec.md#source-subject) | `staging/tekton`, `tekton-dev-123`|
44+
| type | `String` | See [type](spec.md#type-subject) | `service` |
4345
| environment | `Object` ([`environment`](#environment)) | Reference for the environment where the service runs | `{"id": "1234"}`, `{"id": "maven123, "source": "tekton-dev-123"}` |
4446
| artifactId | `Purl` | Identifier of the artifact deployed with this service | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427`, `pkg:golang/mygit.com/myorg/myapp@234fd47e07d1004f0aed9c` |
4547

@@ -55,8 +57,9 @@ This event represents an environment that has been created. Such an environment
5557

5658
| Field | Type | Description | Examples | Required |
5759
|-------|------|-------------|----------|----------------------------|
58-
| id | `String` | Uniquely identifies the subject within the source. | `tenant1/12345-abcde`, `namespace/pipelinerun-1234` ||
59-
| source | `URI-Reference` | [source](../spec.md#source) from the context | | |
60+
| id | `String` | See [id](spec.md#id-subject)| `tenant1/12345-abcde`, `namespace/pipelinerun-1234` ||
61+
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
62+
| type | `String` | See [type](spec.md#type-subject) | `environment` | |
6063
| name | `String` | Name of the environment | `dev`, `staging`, `production`, `ci-123`| |
6164
| url | `String` | URL to reference where the environment is located | `https://my-cluster.zone.my-cloud-provider`| |
6265

@@ -70,8 +73,9 @@ This event represents an environment that has been modified.
7073

7174
| Field | Type | Description | Examples | Required |
7275
|-------|------|-------------|----------|----------------------------|
73-
| id | `String` | Uniquely identifies the subject within the source. | `tenant1/12345-abcde`, `namespace/pipelinerun-1234` ||
74-
| source | `URI-Reference` | [source](../spec.md#source) from the context | | |
76+
| id | `String` | See [id](spec.md#id-subject)| `tenant1/12345-abcde`, `namespace/pipelinerun-1234` ||
77+
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
78+
| type | `String` | See [type](spec.md#type-subject) | `environment` | |
7579
| name | `String` | Name of the environment | `dev`, `staging`, `production`, `ci-123`| |
7680
| url | `String` | URL to reference where the environment is located | `https://my-cluster.zone.my-cloud-provider`| |
7781

@@ -85,8 +89,9 @@ This event represents an environment that has been deleted.```
8589

8690
| Field | Type | Description | Examples | Required |
8791
|-------|------|-------------|----------|----------------------------|
88-
| id | `String` | Uniquely identifies the subject within the source. | `tenant1/12345-abcde`, `namespace/pipelinerun-1234` ||
89-
| source | `URI-Reference` | [source](../spec.md#source) from the context | | |
92+
| id | `String` | See [id](spec.md#id-subject)| `tenant1/12345-abcde`, `namespace/pipelinerun-1234` ||
93+
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
94+
| type | `String` | See [type](spec.md#type-subject) | `environment` | |
9095
| name | `String` | Name of the environment | `dev`, `staging`, `production`, `ci-123`| |
9196

9297
### `service deployed`
@@ -99,7 +104,9 @@ This event represents a new instance of a service that has been deployed
99104

100105
| Field | Type | Description | Examples | Required |
101106
|-------|------|-------------|----------|----------------------------|
102-
| id | `String` | Uniquely identifies the subject within the source. | `service/myapp`, `daemonset/myapp` ||
107+
| id | `String` | See [id](spec.md#id-subject)| `service/myapp`, `daemonset/myapp` ||
108+
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
109+
| type | `String` | See [type](spec.md#type-subject) | `service` | |
103110
| environment | `Object` ([`environment`](#environment)) | Reference for the environment where the service runs | `{"id": "1234"}`, `{"id": "maven123, "source": "tekton-dev-123"}` ||
104111
| artifactId | `Purl` | Identifier of the artifact deployed with this service | `0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427`, `927aa808433d17e315a258b98e2f1a55f8258e0cb782ccb76280646d0dbe17b5`, `six-1.14.0-py2.py3-none-any.whl` ||
105112

@@ -113,7 +120,9 @@ This event represents an existing instance of a service that has been upgraded t
113120

114121
| Field | Type | Description | Examples | Required |
115122
|-------|------|-------------|----------|----------------------------|
116-
| id | `String` | Uniquely identifies the subject within the source. | `service/myapp`, `daemonset/myapp` ||
123+
| id | `String` | See [id](spec.md#id-subject)| `service/myapp`, `daemonset/myapp` ||
124+
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
125+
| type | `String` | See [type](spec.md#type-subject) | `service` | |
117126
| environment | `Object` ([`environment`](#environment)) | Reference for the environment where the service runs | `{"id": "1234"}`, `{"id": "maven123, "source": "tekton-dev-123"}` ||
118127
| artifactId | `Purl` | Identifier of the artifact deployed with this service |`pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427`, `pkg:golang/mygit.com/myorg/myapp@234fd47e07d1004f0aed9c` ||
119128

@@ -127,7 +136,9 @@ This event represents an existing instance of a service that has been rolled bac
127136

128137
| Field | Type | Description | Examples | Required |
129138
|-------|------|-------------|----------|----------------------------|
130-
| id | `String` | Uniquely identifies the subject within the source. | `service/myapp`, `daemonset/myapp` ||
139+
| id | `String` | See [id](spec.md#id-subject)| `service/myapp`, `daemonset/myapp` ||
140+
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
141+
| type | `String` | See [type](spec.md#type-subject) | `service` | |
131142
| environment | `Object` ([`environment`](#environment)) | Reference for the environment where the service runs | `{"id": "1234"}`, `{"id": "maven123, "source": "tekton-dev-123"}` ||
132143
| artifactId | `Purl` | Identifier of the artifact deployed with this service | `pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427`, `pkg:golang/mygit.com/myorg/myapp@234fd47e07d1004f0aed9c` ||
133144

@@ -141,7 +152,9 @@ This event represents the removal of a previously deployed service instance and
141152

142153
| Field | Type | Description | Examples | Required |
143154
|-------|------|-------------|----------|----------------------------|
144-
| id | `String` | Uniquely identifies the subject within the source. | `service/myapp`, `daemonset/myapp` ||
155+
| id | `String` | See [id](spec.md#id-subject)| `service/myapp`, `daemonset/myapp` ||
156+
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
157+
| type | `String` | See [type](spec.md#type-subject) | `service` | |
145158
| environment | `Object` ([`environment`](#environment)) | Reference for the environment where the service runs | `{"id": "1234"}`, `{"id": "maven123, "source": "tekton-dev-123"}` ||
146159

147160
### `service published`
@@ -154,5 +167,7 @@ This event represents an existing instance of a service that has an accessible U
154167

155168
| Field | Type | Description | Examples | Required |
156169
|-------|------|-------------|----------|----------------------------|
157-
| id | `String` | Uniquely identifies the subject within the source. | `service/myapp`, `daemonset/myapp` ||
170+
| id | `String` | See [id](spec.md#id-subject)| `service/myapp`, `daemonset/myapp` ||
171+
| source | `URI-Reference` | See [source](spec.md#source-subject) | | |
172+
| type | `String` | See [type](spec.md#type-subject) | `service` | |
158173
| environment | `Object` ([`environment`](#environment)) | Reference for the environment where the service runs | `{"id": "1234"}`, `{"id": "maven123, "source": "tekton-dev-123"}` ||

0 commit comments

Comments
 (0)