-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: first implementation of cdevents-sdk from json-schema #8
Conversation
Hello @davidB, and thank you for your PR! @rjtch has been working on the rust SDK a bit, so it would be great if the two of you could collaborate on the rust SDK. FYI - we have public weekly CDEvents working group meetings (see https://github.com/cdevents/community?tab=readme-ov-file#how-to-get-involved) - if the time is convenient you're very welcome to join the meeting to discuss the rust SDK or any other topic around CDEvents. |
@mlieberman85 FYI - in case you are interested in reviewing / contributing or even simply watching |
@afrittoli Thank you, that motivate me to continue (I guess reviewer will be afraid by the volume of change in the PR, Sorry) Before I start this PR, I looked at how to contact the community, but the slack channel is restricted to some email host, and I have a conflict on my agenda with the weekly meeting (and my contribution is out of working hours/resources). |
I'm just watching this. I'm interested in replacing my generated structs here: https://github.com/kusaridev/skootrs/blob/main/src/model/cd_events/repo_created.rs that was made using a tool I wrote that calls out to https://github.com/oxidecomputer/typify, with something supported by the broader CD events community. |
Hey David, I can write you on slack if you want and we could work on this together. The community meeting is also conflicting with my agenda. I will contact you on slack. |
Thanks David! Async collaboration is perfectly fine. |
I'm on the slack workspace of the CD Foundation. |
you can also join the #cdevents and the #general channels. |
@afrittoli , @rjtch, |
@afrittoli , @rjtch, You can start the review; missing parts could added via the next PRs (smaller and more focused). Sorry for this too-big PR. Maybe the next commits in this PR will be comments and documentation to explain some choices. PS: I don't have permission to assign you as a reviewer, so I am notifying you via comment. |
.github/workflows/mega-linter.yml
Outdated
# (not recommended if you don't pay for GH Actions) | ||
push: | ||
|
||
# pull_request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should actually run on pull requests against main
, to avoid new PRs breaking CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with this configuration, it runs against every push (on every branch/pr). I can enable it for pull_request instead of push. But enabling both generates dual (overkill and sometimes conflicting) workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usual workflow is to push to a fork and create a PR from that. I may be wrong but I don't think that push to a fork would trigger the workflow on this repo.
The setup I usually use it pull_request
only on main
. If we at some point add branches to maintain specific releases we can extend the config from main
only to whatever name pattern we have for release branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the change, but it will be visible into the coming PR with merged CI,...
.github/workflows/ci.yml
Outdated
with: | ||
fetch-depth: 0 | ||
submodules: "true" | ||
- uses: jdx/rtx-action@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repo is archived, so maybe not a good candidate? https://github.com/jdx/rtx-action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check why he archive few days ago, maybe because the action could be replaced by 3 line of shell call.
rtx is simple and very useful tool (at least for me, when I have to switch between multiple project with various version of java, python, rust, node...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's related to the rename rtx -> mise? https://dev.to/jdxcode/beginners-guide-to-rtx-ac4
I can see how rtx
is very handy for the development environment on your laptop, but do we need it in CI jobs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my team, we found it useful to have the ci and local environment in sync.
I'll also a believer of "portable" CI, I mean every dev should be able to do the same as CI (if enough permission on third party system) or CI should just be like a developper that do every steps. So more the CI use same tooling than dev, better it is and less we are coupled to a CI system (trauma from migration between travis, azure pipeline, github-action, and hell of commit to debug/setup CI workflow special command).
And in the case of rtx+justfile/Makefile, it also provide a similar CI flow for various ecosystem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're right it's due to rename ofrtx
to mise
https://mise.jdx.dev/rtx.html + some nice new feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidB i found mise also it is a good tool! the linter works now fine i think we could integrate mise in a next pr.
justfile
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a Makefile
, so we should probably use that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the Makefile didn't exist when I forked. I'll try to convert the justfile into Makefile.
Thanks for the review, I'll try to do the change ASAP (maybe tomorrow). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, I started reviewing but it will take me a bit of extra time as I'm rather new to rust 🙏
That said, I don't want to slow down progress here, so if you feel confident this is a good way forward I'm happy to approve it (once the CI files part is sorted out).
Would you mind updating the PR title and description in the next iteration? |
@rjtch I removed the ci + megalinter workflow from this PR (to work on the workflows) on an other PR (as suggested by @afrittoli). I also rebase the branch on master to resolve conflicts, switch to Makefile,... but now the PR is blocked by the new workflow:
@afrittoli, What do you prefer "merge", "squash & merge", "rebase" when PR is ok? |
Signed-off-by: David Bernard <[email protected]>
Signed-off-by: David Bernard <[email protected]>
Signed-off-by: David Bernard <[email protected]>
…generated samples - generate samples with arbitraries (proptest) Signed-off-by: David Bernard <[email protected]>
…ontext.type and subject.type Signed-off-by: David Bernard <[email protected]>
- avoid clippy genarte wrong warning about useless stuff - apply some clippy recommandation Signed-off-by: David Bernard <[email protected]>
Signed-off-by: David Bernard <[email protected]>
- clippy & tests need git submodules content Signed-off-by: David Bernard <[email protected]>
Signed-off-by: David Bernard <[email protected]>
@rjtch you can review the code and the few modifications, I made on Makefile, tools configuration, ci... Sorry I rewrite the history several times (that will not ease the review as github could not remember what it already reviewed, and where comment should be inserted), but it was to please the new commit message rules (commitlint) and have a clean history when the PR will be rebase & merge. |
.github/workflows/linter.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used lint here in the matrix because i wanted to differentiate with next coming tests ci. Now that you renamed it to task it is not really clear what it is! If it is the linter_ci or the tests_ci.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simply call this workflow ci
(and ci.yml
for the filename, github workflow often use this name, and the extension .yml
, like what is generated by github and other framework).
We can discuss this point into a next PR. So I'll revert my change.
Signed-off-by: David Bernard <[email protected]>
I also prefer Alternatives are:
|
# The unpublished packages (generator) would be ignored now | ||
# FIXME the generator is excluded explicitly (see Makefile), I don't know why this is not working | ||
[licenses.private] | ||
ignore = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create an issue in GitHub to track this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#13 created, I don't found related issue on cargo-deny so maybe I misunderstood the purpose. It's why I didn't open yet an issue on there repository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
As a follow-up could you please add a CI job that runs the generator from the PR head and checks that there are no diff with the content of the PR?
Signed-off-by: David Bernard <[email protected]>
Signed-off-by: David Bernard <[email protected]>
@afrittoli I'll not push change on CI in this PR to close it faster, but I include the makefile task to do the check that we could include in the next PR related to CI. I think other points are fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates!
This PR is a WIP and a proposal implementation to have cdevents sdk for rust.
The PR contains:
json::Value
(nearly any json type) or String without constraintcontext.type
to match the subject's typeCI (can be view in action at https://github.com/davidB/cdevents-sdk-rust/actions)POSTPONED to another PR
I have a few other ideas, but after this PR
I need the rust sdk to continue my wip on davidB/cdviz: View software deployment's events & states
Let me know if I'm on the wrong path or if I should publish this library on my side.
PS: for the review, under the
cdevents/src/generated
folder, you can overlook just a few files. The generated folder is committed because rust crates are distributed as source, and I don't expect the user to build the generator and generate cdevents from git cloned spec before compiling the lib.