Add verify scripts for make gen to run during PR#507
Add verify scripts for make gen to run during PR#507k8s-ci-robot merged 1 commit intokubernetes-sigs:masterfrom
Conversation
|
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
Welcome @pravarag! |
|
Hi @pravarag. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
I signed it |
hack/verify-makegen.sh
Outdated
| @@ -0,0 +1,10 @@ | |||
| #!/bin/bash | |||
|
|
|||
| result=$(git diff ${OS_OUTPUT_BINPATH}) | |||
There was a problem hiding this comment.
This script should do more than just check for a git diff, it should ideally actually run the generator scripts in a temp directory and compare that to the current output. The reason for this is because this script on its own isn't verifying make gen, so if I call it directly with ./hack/verify-makegen.sh or make verify-gen, I won't really be checking that.
You can see how verify-vendor.sh works for an example.
Following that pattern, I think it would be better to have separate ./hack/verify-xx... scripts for each of the generators (for the same reason: that I may want to just verify one of them).
There was a problem hiding this comment.
Hi @damemi thanks for pointing out the reference script verify-vendor.sh. I wanted to check, is this the line which suggests correct way of using git diff : L64 ? Also, in our case for the git diff to compare, do we need to take output generated by ./hack/updated-generated-xxx scripts in the latest commit with the output generated in the temp_ directory( created during PR check) ?
There was a problem hiding this comment.
I was referring more to how this script is pushing the existing changes onto a tmp directory, running the generator, and then comparing if any new changes occurred. So yes, the diff should be comparing the latest commit to a copy of the latest commit that has had the generator run. In this case, you are just getting that by doing git diff on the copy
hack/verify-makegen.sh
Outdated
| exit 1 | ||
| fi | ||
| echo "Diff for make gen hasn't changed in the PR, good to go" | ||
| exit 0 No newline at end of file |
|
/ok-to-test |
8cc37c0 to
a198478
Compare
|
/check-cla |
|
@damemi also, I've come across a doubt during local execution. When I run But, when I explicitly run this command L4, I'm getting below error as well, Is this error something which is to be ignored at this point? |
@pravarag the command you linked to is a So yes, you can ignore this error. In general, trying to run these bash scripts line-by-line may not work very well (due to imports of other init files setting variables etc). You should just be running |
|
@pravarag you might also be able to take a look at the PR I just opened to add a similar verify script for the table of contents: #516 That could help you on these other generators. We could also probably move some of the redundant code to a lib file so it isn't run over and over, but that's not vital. A problem I found is that the files from Hope this helps |
Thanks @damemi , I'll check the changes done in mentioned PR. |
a198478 to
6aa6edc
Compare
3f40c59 to
7abc780
Compare
|
@damemi I've made some changes and pushed the latest code taking reference from the script you suggested in previous comments. But, I keep getting |
|
@pravarag the script shouldn't be running If you see this line in which is essentially Because when we update the vendor, we expect changes to If you are running the generators for this PR without any significant changes to the code (for example, modifying the API) then you will not see any generated changes besides downloading the binaries, as you said. We can ignore anything that happens in As an example, if you check out this commit from my fork and run diff --git a/pkg/api/v1alpha1/zz_generated.conversion.go b/pkg/api/v1alpha1/zz_generated.conversion.go
index 727b9c776..8f56bf309 100644
--- a/pkg/api/v1alpha1/zz_generated.conversion.go
+++ b/pkg/api/v1alpha1/zz_generated.conversion.go
@@ -151,6 +151,7 @@ func autoConvert_v1alpha1_DeschedulerStrategy_To_api_DeschedulerStrategy(in *Des
out.Enabled = in.Enabled
out.Weight = in.Weight
out.Params = (*api.StrategyParameters)(unsafe.Pointer(in.Params))
+ out.Foo = in.Foo
return nil
}
@@ -163,6 +164,7 @@ func autoConvert_api_DeschedulerStrategy_To_v1alpha1_DeschedulerStrategy(in *api
out.Enabled = in.Enabled
out.Weight = in.Weight
out.Params = (*StrategyParameters)(unsafe.Pointer(in.Params))
+ out.Foo = in.Foo
return nil
}So, if you imagine a PR that just has the above commit (and did not run
|
7abc780 to
f8aa741
Compare
3f2976a to
dc38bd3
Compare
Thanks @seanmalloy , as you suggested I've shortened this PR to include changes for |
|
Hi @pravarag, thanks for working on this so far. I agree that we can just merge the verify checks for the 2 scripts we know are working and continue to debug why |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: damemi, pravarag The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Thanks @damemi , it was all your help :) and it's great to see my first PR coming towards a closure. Also, this PR only consists changes for |
I think we can do three separate PRs. One for each generator. |
|
So the automated CI checks all work. But I get the below error when running @pravarag were you able to successfully run |
@seanmalloy here's an output from my local, I'm not getting the error which you mentioned above with my current clone of the repository. But, I'm not sure if it's not coming since I already have the working-repository setup. I'll try to check by doing a fresh clone as well. |
|
Okay, I was getting the similar error like @seanmalloy mentioned above in my local(OSX) when I did a fresh clone of the fork: And I found the culprit, it's a missing I'll make changes and push the code to working branch then. |
|
Awesome work @pravarag! Could you please squash this down to 1 commit? |
7de051b to
63e0838
Compare
seanmalloy
left a comment
There was a problem hiding this comment.
The script always exits zero. See inline comments for suggested fix.
| if ! _out="$(diff -Naupr pkg/ "${_deschedulertmp}/pkg/")"; then | ||
| echo "Generated output differs:" >&2 | ||
| echo "${_out}" >&2 | ||
| echo "Generated conversions verify failed." |
There was a problem hiding this comment.
| echo "Generated conversions verify failed." | |
| echo "Generated conversions verify failed." | |
| exit 1 |
There was a problem hiding this comment.
Thanks @seanmalloy, I've made the change with latest push.
| popd > /dev/null 2>&1 | ||
| ret=$? | ||
| unset PRJ_PREFIX | ||
|
|
||
| if [[ ${ret} -ne 0 ]]; then | ||
| exit ${ret} | ||
| fi | ||
|
|
There was a problem hiding this comment.
| popd > /dev/null 2>&1 | |
| ret=$? | |
| unset PRJ_PREFIX | |
| if [[ ${ret} -ne 0 ]]; then | |
| exit ${ret} | |
| fi |
Signed-off-by: Pravar Agrawal <pravaag1@in.ibm.com>
63e0838 to
a9099ef
Compare
|
Updated the review comments. |
|
/lgtm |
|
Thanks @seanmalloy @damemi 🙂 |
Add verify scripts for make gen to run during PR
This PR fixes: #483
As part of this change, we want to add steps to ensure that
make genhas been run and there are no changes being generated during the PR.For now, I've tested the code in local for the steps which I've added in the Makefile and below is the output for same,
Since it's reporting error, which means it's pointing that the generators have been downloaded at the latest in the
_outputdirectory in my local.