kubernetes-client / c

Official C client library for Kubernetes
Apache License 2.0
146 stars 45 forks source link

Add a github action for generating code. #124

Closed brendandburns closed 2 years ago

brendandburns commented 2 years ago

cc @ityuhui

The output of this github action is a pull request like: ~https://github.com/brendandburns/c/pull/3~ https://github.com/brendandburns/c/pull/5

ityuhui commented 2 years ago

Hi @brendandburns

There is another version setting in the file https://github.com/kubernetes-client/c/blob/master/kubernetes/PreTarget.cmake#L1-L3

set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 3)
set(PROJECT_VERSION_PATCH 0)

Should it be updated before releasing or via this action ? I can add a manul step to https://github.com/kubernetes-client/c/blob/master/RELEASE.md to doc it.


And it's better to delete the old model/api/unit-test files in the original C client before re-generating in this action because some of them are deprecated in the new version of Kubernetes spec:

find $CLIENT_REPO_ROOT/kubernetes/model -type f -not -name "int_or_string*" -exec rm -r {} \;
find $CLIENT_REPO_ROOT/kubernetes/api -type f -not -name "int_or_string*" -exec rm -r {} \;
find $CLIENT_REPO_ROOT/kubernetes/unit-test -type f -not -name "manual*" -exec rm -r {} \;
brendandburns commented 2 years ago

I've addressed your comments, I figured out a way to integrate the version update into the generation workflow.

Please take another look.

ityuhui commented 2 years ago

/lgtm /approve

k8s-ci-robot commented 2 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, ityuhui

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-client/c/blob/master/OWNERS)~~ [brendandburns,ityuhui] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
ityuhui commented 2 years ago

Thank you @brendandburns

Now we have a great automated generation solution that saves time for upgrading to new versions and avoids mistakes.