Skip to content

Commit

Permalink
Add example files for all events
Browse files Browse the repository at this point in the history
Add example files for all events.
Add a CI job that checks all examples against the schemas.

Signed-off-by: Andrea Frittoli <[email protected]>
  • Loading branch information
afrittoli committed Mar 21, 2023
1 parent acc3864 commit 453b6e7
Show file tree
Hide file tree
Showing 39 changed files with 693 additions and 3 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ on:
# Set the Job #
###############
jobs:
build:
lint:
name: Lint Code Base
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
Expand All @@ -31,3 +31,19 @@ jobs:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_MARKDOWN: true

jsonschema:
name: Validate examples
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Validate Examples
run: ./tools/verify-examples.sh
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ Handling Events associated with the health of the services deployed and running

Defining how CDEvents are mapped to CloudEvents for transportation and delivery

### [Schemas](./schemas/) and [Examples](./examples/)

The [schemas](./schemas/) folder contains `jsonschemas` for all events in the spec. The [examples](./examples/) contains simple `JSON` examples for all events.

## CDEvents SDKs

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


## Community

### How to get involved
Expand Down
20 changes: 20 additions & 0 deletions examples/artifact_packaged.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.artifact.packaged.0.1.1",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "pkg:golang/mygit.com/myorg/myapp@234fd47e07d1004f0aed9c",
"source": "/event/source/123",
"type": "artifact",
"content": {
"change": {
"id": "myChange123",
"source": "my-git.example/an-org/a-repo"
}
}
}
}
15 changes: 15 additions & 0 deletions examples/artifact_published.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.artifact.published.0.1.1",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "pkg:golang/mygit.com/myorg/myapp@234fd47e07d1004f0aed9c",
"source": "/event/source/123",
"type": "artifact",
"content": {}
}
}
20 changes: 20 additions & 0 deletions examples/branch_created.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.branch.created.0.1.2",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "mySubject123",
"source": "/event/source/123",
"type": "branch",
"content": {
"repository": {
"id": "TestRepo/TestOrg",
"source": "https://example.org"
}
}
}
}
20 changes: 20 additions & 0 deletions examples/branch_deleted.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.branch.deleted.0.1.2",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "mySubject123",
"source": "/event/source/123",
"type": "branch",
"content": {
"repository": {
"id": "TestRepo/TestOrg",
"source": "https://example.org"
}
}
}
}
17 changes: 17 additions & 0 deletions examples/build_finished.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.build.finished.0.1.1",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "mySubject123",
"source": "/event/source/123",
"type": "build",
"content": {
"artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427"
}
}
}
15 changes: 15 additions & 0 deletions examples/build_queued.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.build.queued.0.1.1",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "mySubject123",
"source": "/event/source/123",
"type": "build",
"content": {}
}
}
15 changes: 15 additions & 0 deletions examples/build_started.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.build.started.0.1.1",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "mySubject123",
"source": "/event/source/123",
"type": "build",
"content": {}
}
}
20 changes: 20 additions & 0 deletions examples/change_abandoned.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.change.abandoned.0.1.2",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "mySubject123",
"source": "/event/source/123",
"type": "change",
"content": {
"repository": {
"id": "TestRepo/TestOrg",
"source": "https://example.org"
}
}
}
}
20 changes: 20 additions & 0 deletions examples/change_created.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.change.created.0.1.2",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "mySubject123",
"source": "/event/source/123",
"type": "change",
"content": {
"repository": {
"id": "TestRepo/TestOrg",
"source": "https://example.org"
}
}
}
}
20 changes: 20 additions & 0 deletions examples/change_merged.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"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": "TestRepo/TestOrg",
"source": "https://example.org"
}
}
}
}
20 changes: 20 additions & 0 deletions examples/change_reviewed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.change.reviewed.0.1.2",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "mySubject123",
"source": "/event/source/123",
"type": "change",
"content": {
"repository": {
"id": "TestRepo/TestOrg",
"source": "https://example.org"
}
}
}
}
20 changes: 20 additions & 0 deletions examples/change_updated.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.change.updated.0.1.2",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "mySubject123",
"source": "/event/source/123",
"type": "change",
"content": {
"repository": {
"id": "TestRepo/TestOrg",
"source": "https://example.org"
}
}
}
}
18 changes: 18 additions & 0 deletions examples/environment_created.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.environment.created.0.1.1",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "mySubject123",
"source": "/event/source/123",
"type": "environment",
"content": {
"name": "testEnv",
"url": "https://example.org/testEnv"
}
}
}
17 changes: 17 additions & 0 deletions examples/environment_deleted.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.environment.deleted.0.1.1",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "mySubject123",
"source": "/event/source/123",
"type": "environment",
"content": {
"name": "testEnv"
}
}
}
18 changes: 18 additions & 0 deletions examples/environment_modified.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.environment.modified.0.1.1",
"timestamp": "2023-03-20T14:27:05.315384Z"
},
"subject": {
"id": "mySubject123",
"source": "/event/source/123",
"type": "environment",
"content": {
"name": "testEnv",
"url": "https://example.org/testEnv"
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions examples/pipelinerun_finished.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"source": "/event/source/123",
"type": "dev.cdevents.pipelinerun.finished.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",
"outcome": "failure",
"errors": "Something went wrong\nWith some more details"
}
}
}
18 changes: 18 additions & 0 deletions examples/pipelinerun_queued.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"context": {
"version": "0.2.0",
"id": "271069a8-fc18-44f1-b38f-9d70a1695819",
"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"
}
}
}
Loading

0 comments on commit 453b6e7

Please sign in to comment.