-
Notifications
You must be signed in to change notification settings - Fork 443
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
Add scripts to verify generated codes and Go Modules #1999
Add scripts to verify generated codes and Go Modules #1999
Conversation
58b881a
to
859dc1c
Compare
859dc1c
to
a351b81
Compare
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 review! Does that mean we add scripts to Makefile or create the shellscript file like the following? katib/.github/workflows/test-go.yaml Lines 38 to 43 in 0848e03
|
@tenzen-y It's a good idea to re-use this unit test to check if contributor forgot to run |
It makes sense. |
hack/verify-generated-codes.sh
Outdated
|
||
cd "$(dirname "$0")/.." | ||
|
||
git diff --exit-code -- 'pkg/apis' 'hack/gen-python-sdk' 'sdk/python' 'pkg/mock' > /dev/null || \ |
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.
@andreyvelich Are there any other directories that need to be checked?
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.
@tenzen-y What do you think about verifying the whole code base on the changes
(e.g. git diff --exit-code -- .
)?
For example, tomorrow we are going to introduce script check to automatically sync operator
manifests with our manifests and we ask users to run this script before submitting PR.
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.
It makes sense.
I will change so that developer can check all files.
hack/verify-go-mod.sh
Outdated
GO_VERSION="$(grep '^go' go.mod | cut -d ' ' -f 2)" | ||
go mod tidy -go "${GO_VERSION}" | ||
git diff --exit-code -- 'go.*' > /dev/null || \ | ||
(echo "Please run \"go mod tidy -go ${GO_VERSION}\" to sync Go modules" && exit 1) |
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.
Should we keep code generation check in 1 hack script ?
Then, we can reduce our number of scripts.
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.
Sure, thanks!
hack/verify-generated-codes.sh
Outdated
|
||
cd "$(dirname "$0")/.." | ||
|
||
git diff --exit-code -- 'pkg/apis' 'hack/gen-python-sdk' 'sdk/python' 'pkg/mock' > /dev/null || \ |
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.
@tenzen-y What do you think about verifying the whole code base on the changes
(e.g. git diff --exit-code -- .
)?
For example, tomorrow we are going to introduce script check to automatically sync operator
manifests with our manifests and we ask users to run this script before submitting PR.
4ff0e5c
to
1a225a7
Compare
Signed-off-by: tenzen-y <yuki.iwai.tz@gmail.com>
1a225a7
to
fbedc18
Compare
@andreyvelich I addressed your suggestions. PTAL |
Thanks for the updates @tenzen-y! |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johnugeorge, tenzen-y 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:
Approvers can indicate their approval by writing |
Signed-off-by: tenzen-y yuki.iwai.tz@gmail.com
What this PR does / why we need it:
I added scripts to generate Go mock files to Makefile.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #59
Checklist: