-
Notifications
You must be signed in to change notification settings - Fork 771
Add verify script for deep-copies generator #545
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
Merged
k8s-ci-robot
merged 1 commit into
kubernetes-sigs:master
from
pravarag:add-verify-script-deep-copies
Apr 9, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -o errexit | ||
| set -o nounset | ||
| set -o pipefail | ||
|
|
||
| source "$(dirname "${BASH_SOURCE}")/lib/init.sh" | ||
| DESCHEDULER_ROOT=$(dirname "${BASH_SOURCE}")/.. | ||
| mkdir -p "${DESCHEDULER_ROOT}/_tmp" | ||
| _tmpdir="$(mktemp -d "${DESCHEDULER_ROOT}/_tmp/kube-verify.XXXXXX")" | ||
|
|
||
| _deschedulertmp="${_tmpdir}" | ||
| mkdir -p "${_deschedulertmp}" | ||
|
|
||
| git archive --format=tar --prefix=descheduler/ "$(git write-tree)" | (cd "${_deschedulertmp}" && tar xf -) | ||
| _deschedulertmp="${_deschedulertmp}/descheduler" | ||
|
|
||
| pushd "${_deschedulertmp}" > /dev/null 2>&1 | ||
| go build -o "${OS_OUTPUT_BINPATH}/deepcopy-gen" "k8s.io/code-generator/cmd/deepcopy-gen" | ||
|
|
||
| ${OS_OUTPUT_BINPATH}/deepcopy-gen \ | ||
| --go-header-file "hack/boilerplate/boilerplate.go.txt" \ | ||
| --input-dirs "./pkg/apis/componentconfig,./pkg/apis/componentconfig/v1alpha1,./pkg/api,./pkg/api/v1alpha1" \ | ||
| --output-file-base zz_generated.deepcopy | ||
| popd > /dev/null 2>&1 | ||
|
|
||
| pushd "${DESCHEDULER_ROOT}" > /dev/null 2>&1 | ||
| if ! _out="$(diff -Naupr pkg/ "${_deschedulertmp}/pkg/")"; then | ||
| echo "Generated deep-copies output differs:" >&2 | ||
| echo "${_out}" >&2 | ||
| echo "Generated deep-copies verify failed. Please run ./hack/update-deep-copies.sh" | ||
| exit 1 | ||
| fi | ||
| popd > /dev/null 2>&1 | ||
|
|
||
| echo "Generated deep-copies verified." | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Please delete this line. You can also remove this line from the verify-conversions.sh script too.
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.
Are you referring to, line 34 or line 36 ?
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.
Line 36
Uh oh!
There was an error while loading. Please reload this page.
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.
Some kind of "success" message is helpful rather than printing nothing, to show that the script did actually complete (for local runs, and for CI where we are calling multiple scripts).
I would also update the failure message to include a
Please run ./hack/update-deep-copies.sh(same for conversions if it doesn't already)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.
Updated with latest push.
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.
Okay, I'll just put back those in with the updated failure message as well.
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.
Yeah, sorry for the back and forth but I do think these are worth having... You may want to wait for @seanmalloy to see if he agrees or there is something I'm overlooking 🙂
Uh oh!
There was an error while loading. Please reload this page.
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's fine to keep the echo statement.
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.
@pravarag you can re-add the
echostatement. Sorry for the confusion.