Skip to content

Commit 453b6e7

Browse files
committed
Add example files for all events
Add example files for all events. Add a CI job that checks all examples against the schemas. Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
1 parent acc3864 commit 453b6e7

39 files changed

+693
-3
lines changed

.github/workflows/main.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ on:
1010
# Set the Job #
1111
###############
1212
jobs:
13-
build:
13+
lint:
1414
name: Lint Code Base
1515
runs-on: ubuntu-latest
1616

1717
steps:
1818
- name: Checkout Code
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v3
2020
with:
2121
# Full git history is needed to get a proper list of changed files within `super-linter`
2222
fetch-depth: 0
@@ -31,3 +31,19 @@ jobs:
3131
DEFAULT_BRANCH: main
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3333
VALIDATE_MARKDOWN: true
34+
35+
jsonschema:
36+
name: Validate examples
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- name: Checkout Code
41+
uses: actions/checkout@v3
42+
43+
- name: Set up Go
44+
uses: actions/setup-go@v3
45+
with:
46+
go-version: 1.19
47+
48+
- name: Validate Examples
49+
run: ./tools/verify-examples.sh

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ Handling Events associated with the health of the services deployed and running
8686

8787
Defining how CDEvents are mapped to CloudEvents for transportation and delivery
8888

89+
### [Schemas](./schemas/) and [Examples](./examples/)
90+
91+
The [schemas](./schemas/) folder contains `jsonschemas` for all events in the spec. The [examples](./examples/) contains simple `JSON` examples for all events.
92+
8993
## CDEvents SDKs
9094

9195
CDEvents is developing as set of SDKs:
@@ -94,7 +98,6 @@ CDEvents is developing as set of SDKs:
9498
* [Python](https://github.com/cdevents/sdk-python)
9599
* [Java](https://github.com/cdevents/sdk-java)
96100

97-
98101
## Community
99102

100103
### How to get involved

examples/artifact_packaged.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"context": {
3+
"version": "0.2.0",
4+
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
5+
"source": "/event/source/123",
6+
"type": "dev.cdevents.artifact.packaged.0.1.1",
7+
"timestamp": "2023-03-20T14:27:05.315384Z"
8+
},
9+
"subject": {
10+
"id": "pkg:golang/mygit.com/myorg/myapp@234fd47e07d1004f0aed9c",
11+
"source": "/event/source/123",
12+
"type": "artifact",
13+
"content": {
14+
"change": {
15+
"id": "myChange123",
16+
"source": "my-git.example/an-org/a-repo"
17+
}
18+
}
19+
}
20+
}

examples/artifact_published.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"context": {
3+
"version": "0.2.0",
4+
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
5+
"source": "/event/source/123",
6+
"type": "dev.cdevents.artifact.published.0.1.1",
7+
"timestamp": "2023-03-20T14:27:05.315384Z"
8+
},
9+
"subject": {
10+
"id": "pkg:golang/mygit.com/myorg/myapp@234fd47e07d1004f0aed9c",
11+
"source": "/event/source/123",
12+
"type": "artifact",
13+
"content": {}
14+
}
15+
}

examples/branch_created.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"context": {
3+
"version": "0.2.0",
4+
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
5+
"source": "/event/source/123",
6+
"type": "dev.cdevents.branch.created.0.1.2",
7+
"timestamp": "2023-03-20T14:27:05.315384Z"
8+
},
9+
"subject": {
10+
"id": "mySubject123",
11+
"source": "/event/source/123",
12+
"type": "branch",
13+
"content": {
14+
"repository": {
15+
"id": "TestRepo/TestOrg",
16+
"source": "https://example.org"
17+
}
18+
}
19+
}
20+
}

examples/branch_deleted.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"context": {
3+
"version": "0.2.0",
4+
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
5+
"source": "/event/source/123",
6+
"type": "dev.cdevents.branch.deleted.0.1.2",
7+
"timestamp": "2023-03-20T14:27:05.315384Z"
8+
},
9+
"subject": {
10+
"id": "mySubject123",
11+
"source": "/event/source/123",
12+
"type": "branch",
13+
"content": {
14+
"repository": {
15+
"id": "TestRepo/TestOrg",
16+
"source": "https://example.org"
17+
}
18+
}
19+
}
20+
}

examples/build_finished.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"context": {
3+
"version": "0.2.0",
4+
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
5+
"source": "/event/source/123",
6+
"type": "dev.cdevents.build.finished.0.1.1",
7+
"timestamp": "2023-03-20T14:27:05.315384Z"
8+
},
9+
"subject": {
10+
"id": "mySubject123",
11+
"source": "/event/source/123",
12+
"type": "build",
13+
"content": {
14+
"artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427"
15+
}
16+
}
17+
}

examples/build_queued.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"context": {
3+
"version": "0.2.0",
4+
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
5+
"source": "/event/source/123",
6+
"type": "dev.cdevents.build.queued.0.1.1",
7+
"timestamp": "2023-03-20T14:27:05.315384Z"
8+
},
9+
"subject": {
10+
"id": "mySubject123",
11+
"source": "/event/source/123",
12+
"type": "build",
13+
"content": {}
14+
}
15+
}

examples/build_started.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"context": {
3+
"version": "0.2.0",
4+
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
5+
"source": "/event/source/123",
6+
"type": "dev.cdevents.build.started.0.1.1",
7+
"timestamp": "2023-03-20T14:27:05.315384Z"
8+
},
9+
"subject": {
10+
"id": "mySubject123",
11+
"source": "/event/source/123",
12+
"type": "build",
13+
"content": {}
14+
}
15+
}

examples/change_abandoned.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"context": {
3+
"version": "0.2.0",
4+
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
5+
"source": "/event/source/123",
6+
"type": "dev.cdevents.change.abandoned.0.1.2",
7+
"timestamp": "2023-03-20T14:27:05.315384Z"
8+
},
9+
"subject": {
10+
"id": "mySubject123",
11+
"source": "/event/source/123",
12+
"type": "change",
13+
"content": {
14+
"repository": {
15+
"id": "TestRepo/TestOrg",
16+
"source": "https://example.org"
17+
}
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)