Giter Club home page Giter Club logo

sdk-java's People

Contributors

aalmiray avatar adamkenihan avatar afrittoli avatar cdevents-bot avatar dependabot[bot] avatar rjalander avatar zaza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sdk-java's Issues

"CDEvent validation failed with errors" in SDK release

The stage deploy step in the v0.1.2 release reported a lot of validation errors (see below).

We should:

  • investigate and fix those issues
  • make sure that a release cannot succeed if testing fails
  • make sure that CI testing captures such failures
[INFO] Running dev.cdevents.CDEventsTest
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.environment.deleted.0.1.0 as json - {"context":{"id":"2512d781-f602-4b22-8109-8e8f71021285","type":"dev.cdevents.environment.deleted.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/dev/environment/run/subject","source":"/dev/environment/run/subject","type":"ENVIRONMENT","content":{"name":"Name"}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.testcase.started.0.1.0 as json - {"context":{"id":"0910698c-c55c-4095-8da8-c693bdff02fb","type":"dev.cdevents.testcase.started.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-case-1","source":"/dev/test-case","type":"TESTCASE","content":{}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.build.finished.0.1.0 as json - {"context":{"id":"b878fb88-946b-420b-911f-1ce0387ec6b5","type":"dev.cdevents.build.finished.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-build","source":"/dev/builds/test-build","type":"BUILD","content":{"artifactId":"pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f"}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.service.published.0.1.0 as json - {"context":{"id":"e863fa12-3a65-4f4f-9572-07678b4f3ef1","type":"dev.cdevents.service.published.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/dev/service/run/subject","source":"dev/service/run/subject","type":"SERVICE","content":{"environment":{"id":"dev/environment/run/subject","source":"dev/environment/run/subject"}}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.testsuite.started.0.1.0 as json - {"context":{"id":"68956964-03df-4a6d-9cd0-ff843a90d49e","type":"dev.cdevents.testsuite.started.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-suite-1","source":"/dev/test-suite","type":"TESTSUITE","content":{}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.service.upgraded.0.1.0 as json - {"context":{"id":"0ccb675a-48c5-4c48-83c4-28cc023635f4","type":"dev.cdevents.service.upgraded.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/dev/service/run/subject","source":"dev/service/run/subject","type":"SERVICE","content":{"environment":{"id":"dev/environment/run/subject","source":"dev/environment/run/subject"},"artifactId":"pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f"}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.service.rolledback.0.1.0 as json - {"context":{"id":"902e9b8c-a3f6-429e-8b0c-88b6d82b1407","type":"dev.cdevents.service.rolledback.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/dev/service/run/subject","source":"dev/service/run/subject","type":"SERVICE","content":{"environment":{"id":"dev/environment/run/subject","source":"dev/environment/run/subject"},"artifactId":"pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f"}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.testcase.finished.0.1.0 as json - {"context":{"id":"7c8ef971-5e07-4a6f-b0d3-2ba13c3b5caf","type":"dev.cdevents.testcase.finished.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-case-1","source":"/dev/test-case","type":"TESTCASE","content":{}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.branch.created.0.1.1 as json - {"context":{"id":"0ae0dcbf-8d81-4[47](https://github.com/cdevents/sdk-java/actions/runs/5645622708/job/15291772812#step:5:48)9-9d97-7237a95c1b4c","type":"dev.cdevents.branch.created.0.1.1","source":"http://dev.cdevents/","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-branch","source":"/github.com/test-branch","type":"BRANCH","content":{"repository":{"id":"/github.com/test-repo","source":"http://github.com/test-repo"}}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.service.removed.0.1.0 as json - {"context":{"id":"8eee9a1f-c9c0-4f5d-bae1-c14fc3efc3ef","type":"dev.cdevents.service.removed.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/dev/service/run/subject","source":"dev/service/run/subject","type":"SERVICE","content":{"environment":{"id":"dev/environment/run/subject","source":"dev/environment/run/subject"}}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.change.abandoned.0.1.1 as json - {"context":{"id":"db16cfef-ae88-4bb2-a285-b6773596fb36","type":"dev.cdevents.change.abandoned.0.1.1","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-branch","source":"/github.com/test-branch","type":"CHANGE","content":{"repository":{"id":"/github.com/test-repo","source":"http://github.com/test-repo"}}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.taskrun.finished.0.1.0 as json - {"context":{"id":"570c276d-55b3-4238-95fa-d44992501e02","type":"dev.cdevents.taskrun.finished.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/dev/task/run/subject","source":"/dev/task/run/subject","type":"TASKRUN","content":{"taskName":"test-task-finished","url":"http://dev/task/url","outcome":"SUCCESS","errors":"errors to place","pipelineRun":{"id":"/dev/pipeline/run/subject","source":"http://dev/pipeline/run/subject"}}}}
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/test-suite-finished-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.repository.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/branch-deleted-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.environment.id: is missing but it is required, $.subject.content.artifactId: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/service-deployed-event
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.pipelinerun.queued.0.1.0 as json - {"context":{"id":"b3e09475-4d90-4d9f-a3cc-f3671e68ec10","type":"dev.cdevents.pipelinerun.queued.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/dev/pipeline/run/subject","source":"/dev/pipeline/run/subject","type":"PIPELINERUN","content":{"pipelineName":"test-pipeline-queued","url":"http://dev/pipeline/url"}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.branch.deleted.0.1.1 as json - {"context":{"id":"0d99db29-e6ee-4f34-a88a-f99411a2d[48](https://github.com/cdevents/sdk-java/actions/runs/5645622708/job/15291772812#step:5:49)9","type":"dev.cdevents.branch.deleted.0.1.1","source":"http://dev.cdevents/","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-branch","source":"/github.com/test-branch","type":"BRANCH","content":{"repository":{"id":"/github.com/test-repo","source":"http://github.com/test-repo"}}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.change.reviewed.0.1.1 as json - {"context":{"id":"67ecbeac-d60f-425e-bdd6-f61df7fdbb93","type":"dev.cdevents.change.reviewed.0.1.1","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-branch","source":"/github.com/test-branch","type":"CHANGE","content":{"repository":{"id":"/github.com/test-repo","source":"http://github.com/test-repo"}}}}
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.repository.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/change-created-event
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.artifact.packaged.0.1.0 as json - {"context":{"id":"a8efeede-c185-47e8-9470-05afa5fbd2b0","type":"dev.cdevents.artifact.packaged.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b","source":"/dev/artifact/source","type":"ARTIFACT","content":{"change":{"id":"test-feature","source":"/github.com/test-repo"}}}}
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/repository-deleted-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.repository.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/change-updated-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/repository-modified-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.repository.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/change-abandoned-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.repository.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/branch-created-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.pipelineRun.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/task-run-finished-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/pipeline-run-finished-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/environment-deleted-event
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.environment.modified.0.1.0 as json - {"context":{"id":"8dc3048c-5523-4626-879e-4aeaa7b9ccdb","type":"dev.cdevents.environment.modified.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/dev/environment/run/subject","source":"/dev/environment/run/subject","type":"ENVIRONMENT","content":{"name":"Name","url":"http://dev/environment/url"}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.build.started.0.1.0 as json - {"context":{"id":"2b7b3fc2-4ede-4157-9a73-679ed7401f64","type":"dev.cdevents.build.started.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-build","source":"/dev/builds/test-build","type":"BUILD","content":{}}}
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/build-queued-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.name: is missing but it is required, $.subject.content.url: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/repository-created-event
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.repository.created.0.1.0 as json - {"context":{"id":"adacdaf9-75[49](https://github.com/cdevents/sdk-java/actions/runs/5645622708/job/15291772812#step:5:50)-4376-a8e7-78ce938649a7","type":"dev.cdevents.repository.created.0.1.0","source":"http://dev.cdevents/","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/github.com/test-repo","source":"/github.com/test-repo","type":"REPOSITORY","content":{"name":"test-repo","owner":"test-user","url":"git://github.com/test-org/test-repo","viewUrl":"http://github.com/test-org/test-repo/view"}}}
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/build-finished-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.environment.id: is missing but it is required, $.subject.content.artifactId: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/service-upgraded-event
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.testsuite.finished.0.1.0 as json - {"context":{"id":"33f46ac7-3959-4690-98da-f9ab536424ec","type":"dev.cdevents.testsuite.finished.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-suite-1","source":"/dev/test-suite","type":"TESTSUITE","content":{}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.repository.deleted.0.1.0 as json - {"context":{"id":"a548c82d-9765-413c-a794-37dc2bad2da2","type":"dev.cdevents.repository.deleted.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/github.com/test-repo","source":"/github.com/test-repo","type":"REPOSITORY","content":{"name":"test-repo","owner":"test-user","url":"git://github.com/test-org/test-repo","viewUrl":"http://github.com/test-org/test-repo/view"}}}
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/environment-created-event
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.change.updated.0.1.1 as json - {"context":{"id":"2ddeb294-b0ed-44f4-87f7-978bb17b95c6","type":"dev.cdevents.change.updated.0.1.1","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-branch","source":"/github.com/test-branch","type":"CHANGE","content":{"repository":{"id":"/github.com/test-repo","source":"http://github.com/test-repo"}}}}
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.environment.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/service-published-event
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.service.deployed.0.1.0 as json - {"context":{"id":"e297a1b8-2fca-426d-b99f-55b414f5[50](https://github.com/cdevents/sdk-java/actions/runs/5645622708/job/15291772812#step:5:51)0d","type":"dev.cdevents.service.deployed.0.1.0","source":"http://dev.cdevents/","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/dev/service/run/subject","source":"dev/service/run/subject","type":"SERVICE","content":{"environment":{"id":"dev/environment/run/subject","source":"dev/environment/run/subject"},"artifactId":"pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f"}}}
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/pipeline-run-queued-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.environment.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/service-removed-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/test-suite-started-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.repository.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/change-reviewed-event
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.repository.modified.0.1.0 as json - {"context":{"id":"0507c8b6-d6d3-45e7-b9b3-6cdab3d453[51](https://github.com/cdevents/sdk-java/actions/runs/5645622708/job/15291772812#step:5:52)","type":"dev.cdevents.repository.modified.0.1.0","source":"http://dev.cdevents/","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/github.com/test-repo","source":"/github.com/test-repo","type":"REPOSITORY","content":{"name":"test-repo","owner":"test-user","url":"git://github.com/test-org/test-repo","viewUrl":"http://github.com/test-org/test-repo/view"}}}
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/build-started-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/environment-modified-event
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.pipelinerun.finished.0.1.0 as json - {"context":{"id":"6f531358-2b48-4764-b26c-0699ca62a7b1","type":"dev.cdevents.pipelinerun.finished.0.1.0","source":"http://dev.cdevents/","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/dev/pipeline/run/subject","source":"/dev/pipeline/run/subject","type":"PIPELINERUN","content":{"pipelineName":"Name-pipeline","url":"http://dev/pipeline/url","outcome":"SUCCESS","errors":"errors to place"}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.pipelinerun.started.0.1.0 as json - {"context":{"id":"86fd92db-3d46-416a-9b6d-e7c42f701213","type":"dev.cdevents.pipelinerun.started.0.1.0","source":"http://dev.cdevents/","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/dev/pipeline/run/subject","source":"/dev/pipeline/run/subject","type":"PIPELINERUN","content":{"pipelineName":"test-pipeline-started","url":"http://dev/pipeline/url"}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.artifact.published.0.1.0 as json - {"context":{"id":"8427f2eb-b71e-4286-b1f6-379bd76a1ae9","type":"dev.cdevents.artifact.published.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b","source":"/dev/artifact/source","type":"ARTIFACT","content":{}}}
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.pipelineRun.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/task-run-started-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.pipelineName: is missing but it is required, $.subject.content.url: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/pipeline-run-started-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/artifact-published-event
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.change.merged.0.1.1 as json - {"context":{"id":"3418363d-0a69-4a37-9ead-6be514d2a164","type":"dev.cdevents.change.merged.0.1.1","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-branch","source":"/github.com/test-branch","type":"CHANGE","content":{"repository":{"id":"/github.com/test-repo","source":"http://github.com/test-repo"}}}}
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/test-case-queued-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/test-case-started-event
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.testcase.queued.0.1.0 as json - {"context":{"id":"04b3d8e1-2f3f-4d79-98cd-34ce826dee03","type":"dev.cdevents.testcase.queued.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-case-1","source":"/dev/test-case","type":"TESTCASE","content":{}}}
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/test-case-finished-event
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.environment.created.0.1.0 as json - {"context":{"id":"7b275f2d-89f9-4ea0-aa08-db17e8[54](https://github.com/cdevents/sdk-java/actions/runs/5645622708/job/15291772812#step:5:55)04a0","type":"dev.cdevents.environment.created.0.1.0","source":"http://dev.cdevents/","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/dev/environment/run/subject","source":"/dev/environment/run/subject","type":"ENVIRONMENT","content":{"name":"Name","url":"http://dev/environment/url"}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.pipelinerun.queued.0.1.0 as json - {"context":{"id":"3f96560b-fb9c-4f41-97fb-abadeddbe6e0","type":"dev.cdevents.pipelinerun.queued.0.1.0","source":"http://dev.cdevents/","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":"{\"key1\": \"value1\",\"key2\" : {\"test\": \"customData\" }}","customDataContentType":"application/json","subject":{"id":"/dev/pipeline/run/subject","source":"/dev/pipeline/run/subject","type":"PIPELINERUN","content":{"pipelineName":"test-pipeline-queued","url":"http://dev/pipeline/url"}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.build.queued.0.1.0 as json - {"context":{"id":"d04609d7-fadf-436b-8e5d-9a38ca018987","type":"dev.cdevents.build.queued.0.1.0","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-build","source":"/dev/builds/test-build","type":"BUILD","content":{}}}
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.environment.id: is missing but it is required, $.subject.content.artifactId: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/service-rolledback-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.repository.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/change-merged-event
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed with errors [$.subject.id: is missing but it is required, $.subject.content.change.id: is missing but it is required]
[main] ERROR dev.cdevents.CDEvents - CDEvent validation failed against schema URL - https://cdevents.dev/0.1.2/schema/artifact-packaged-event
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.change.created.0.1.1 as json - {"context":{"id":"5cba8d90-c2b7-4bae-affb-a96310818890","type":"dev.cdevents.change.created.0.1.1","source":"http://dev.cdevents","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"test-branch","source":"/github.com/test-branch","type":"CHANGE","content":{"repository":{"id":"/github.com/test-repo","source":"http://github.com/test-repo"}}}}
[main] INFO dev.cdevents.CDEvents - CDEvent with type dev.cdevents.taskrun.started.0.1.0 as json - {"context":{"id":"0b2296fb-7d7b-4c6b-b3e5-6a23a49b3848","type":"dev.cdevents.taskrun.started.0.1.0","source":"http://dev.cdevents/","version":"0.1.2","timestamp":"2023-07-24T13:44:27Z"},"customData":{},"customDataContentType":"application/json","subject":{"id":"/dev/task/run/subject","source":"/dev/task/run/subject","type":"TASKRUN","content":{"taskName":"test-task-started","url":"http://dev/task/url","pipelineRun":

JSON schema for events must be loaded from classpath

The current code foe each event loads its schema in this way

public String eventSchema() {
try {
return Files.readString(Paths.get(CDEventConstants.SCHEMA_FOLDER + "/pipelinerunstarted.json"));
} catch (IOException e) {
throw new CDEventsException("Exception while reading Event JsonSchema file ", e);
}
}

Which means it expects to find the schema as a file in the filesystem. This code fails when the cdevents-java-sdk is consumed as a dependency by other projects, as the schema files are no longer found in the filesystem but rather as embedded resources within the cdevents-java-sdk JAR.

This code must be updated to find the schema as a classpath resource first, falling back to filesystem if not found.

Codebase must remain Java 8 compatible

0.3.0 was published with Java 11 bytecode

$ jarviz bytecode show --gav dev.cdevents:cdevents-sdk-java:0.3.0
subject: cdevents-sdk-java-0.3.0.jar
Unversioned classes. Bytecode version: 53 (Java 9) total: 1
Unversioned classes. Bytecode version: 55 (Java 11) total: 339

consumers such as Spinaker remain in Java 8 compatibility mode.

Some events in CDEventConstants print incorrectly.

Some of the events in CDEventConstants have a small error where it does not have a . after the event name. For example, Testsuite Finished will print as "dev.cdevents.testsuite.finished0.1.0" rather than "dev.cdevents.testsuite.finished.0.1.0"

Utilize inheritance where needed

Subject classes for build events do not have a proper parent.

For example

and https://github.com/cdevents/sdk-java/blob/5d17b750fda57fd4a9d7ad2c5baec2bb4b9e2143/sdk/src/main/java/dev/cdevents/models/build/started/Subject.java are very similar. These classes should have a parent class that handles the intersection between all subject object in all events. As in the type, id, source, etc. These should all live on a parent. This is an issue in various other places. I imagine Context has the same problem. We should definitely change how this behaves and how these classes are generated

Tag and release to GitHub

Followup to #9

Current settings found at pom.xml and release.yml workflow perform the following tasks:

  • update version to a given input and commit changes.
  • publish JARs and POM to Maven Central.

I'd suggest enhancing the release setup to also perform the following tasks:

  • tag the release
  • create a GitHub release
  • [optional] announce the release on Twitter, Slack, etc

JReleaser may be used to provide such behavior.
Releases could look like this https://github.com/kordamp/kordamp-maven-parent/releases/tag/v1.3.0
Such release was created with the following input files:

JReleaser may be configured as a Maven plugin as well, avoiding the need to installing the CLI tool. If a commit message format convention is applied to the project (such as conventional-commits) then the generated changelog may look a bit better (categories, scopes, etc). Custom conventions may be mapped as well.

Create events as JSON blobs

The Java SDK today only allows producing CloudEvents objects. CloudEvents is a specific binding for CDEvents.
It should be possible to produce CDEvents objects that can then either be rendered as JSON or as CloudEvents.

Migrate away from Reload4j

Reload4j is the continuation of Log4j 1 for those affected by log4shell.

It would be better to use a more recent version of an Slf4j binding such as logback, log4j2, or slf4j-simple.
Matter of fact, defining an slf4j binding in a library is a bit of an anti-pattern. Consumers such applications do require explicit bindings, libraries do not.

However, a binding may be needed for testing. Thus changing the scope of the logging binding to test would be better.

IF the logging binding is indeed intended for just testing I'd suggest going with slf4j-simple as it's the easiest (no more deps) to use.

Support Java Modules

The codebase currently targets Java 8. Java Modules were added in Java 9, providing benefits to both API designers and consumers. It's possible to add a full module descriptor while remaining Java 8 compatible by using the ModiTect plugin.

I've personally help more than a dozen projects to migrate to Java modules in this way. I can prepare a PR if the team agrees to move forward with this idea.

Should opt for immutability where we can

Currently all objects in the SDK are mutable. If a new event or object is needed, it should be recreated, instead of using setters to set things.

public void setContent(Content content) {
this.content = content;
}

Instead we should utilize the builder pattern, imo. Look at lombok, https://projectlombok.org/features/Builder. This will make it a lot easier to generate these and make them properly immutable

Align the SDK to the latest spec in https://cdevents.dev/docs/

The current SDK has been created to replicate the behaviour of the old go SDK.
The spec has been since updated, and a new version of the go SDK is available.

The Java SDK must be aligned to the most recent spec so that moving forward changes to the spec may be easily reflected in the SDK. As this is a relatively large chunk of work, it would be ok to split it into multiple PRs. To avoid having a mid-state SDK we could work off a branch and merge it back into main when ready.

Update License file to add copyright owner

Good first issue

In the license file on line 189 the authors haven't been stated, this is a common thing that people miss when adding apache2 licenses.

replace the text with:

Copyright 2023 The cdevents Authors

Redundant event type parameter in the API

To create a CDEvent with the Java SDK, I can do:

            CloudEvent prfe = CDEventTypes.createPipelineRunFinishedEvent(
                CDEventConstants.CDEventTypes.PipelineRunFinishedEvent.getEventType(),
                "id", uri, "name", uri,
                        CDEventConstants.Outcome.OutcomeSuccess, "errors", "data");

The first parameter requires is the type, but that seems redundant since the create methods are client specific anyways

Modular dependency tracker

Now that a full Java module descriptor is in place thanks to #16 it would also be a good idea to keep track of current dependencies (compile & runtime) to see which ones may need updates in terms of Java modules support. Consumers wishing to use cdevents with modular Java Runtimes (created with jlink) require dependencies with full module descriptors.

Current dependency graph (mvn dependency:tree)

dev.cdevents:cdevents-sdk-java:jar:0.1.0-SNAPSHOT
+- io.cloudevents:cloudevents-core:jar:2.3.0:compile
|  \- io.cloudevents:cloudevents-api:jar:2.3.0:compile
+- com.fasterxml.jackson.core:jackson-databind:jar:2.15.0:compile
|  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.15.0:compile
|  \- com.fasterxml.jackson.core:jackson-core:jar:2.15.0:compile
+- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.15.0:compile
+- com.networknt:json-schema-validator:jar:1.0.80:compile
|  +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.15.0:compile
|  |  \- org.yaml:snakeyaml:jar:2.0:compile
|  +- org.apache.commons:commons-lang3:jar:3.12.0:runtime
|  \- com.ethlo.time:itu:jar:1.7.0:compile
+- org.slf4j:slf4j-api:jar:2.0.7:compile
+- org.slf4j:slf4j-reload4j:jar:2.0.7:runtime
  \- ch.qos.reload4j:reload4j:jar:1.2.22:runtime

Module names per dependency

Dependency Module Name Source Fix
cloudevents-core-2.3.0 io.cloudevents.core manifest
cloudevents-api-2.3.0 io.cloudevents.api manifest
jackson-databind-2.15.0 com.fasterxml.jackson.databind explicit OK
jackson-annotations-2.15.0 com.fasterxml.jackson.annotation explicit OK
jackson-core-2.15.0 com.fasterxml.jackson.core explicit OK
jackson-datatype-jsr310-2.15.0 com.fasterxml.jackson.datatype.jsr310 explicit OK
json-schema-validator-1.0.80 json.schema.validator filename
jackson-dataformat-yaml-2.15.0 com.fasterxml.jackson.dataformat.yaml explicit OK
snakeyaml-2.0 org.yaml.snakeyaml explicit OK
commons-lang3-3.12.0 org.apache.commons.lang3 manifest
itu-1.7.0 itu filename
slf4j-api-2.0.7 org.slf4j explicit OK
slf4j-reload4j-2.0.7 slf4j.reload4j filename
reload4j-1.2.22 reload4j filename

Validating CDEvent fails if not setting Optional fields

As per the spec for most of the events subject.content filds are optional, but validating the event against jsonschema fails if not setting these optional fields when creating an event,

An example pipelineRunQueued events fails without setting these optional fields source, pipelineName, url
CDEvent validation failed with errors [ $.subject.source: null found, string expected, $.subject.content.pipelineName: null found, string expected, $.subject.content.url: null found, string expected ]

Update pom.xml for release

Since sonatype approved the group id in issue OSSRH-90842, we need to update the group id and set the initial version to 0.0.1.

Publish the sdk in a public maven repository

I'm aware the sdk is in its early stages, but currently the only way to consume it requires cloning the git repository and installing it in a local maven repository. Once publicly available it would be easier to access and play with it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.