-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
godep-save.sh: add sanity checks #48615
godep-save.sh: add sanity checks #48615
Conversation
02addaf
to
8bce391
Compare
hack/godep-save.sh
Outdated
pushd "${KUBE_ROOT}" > /dev/null | ||
# sanity check that staging directories do not exist in GOPATH |
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.
Do they need to actually be removed? Before running a godep save? Did this not work before?
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 had reports a couple of times from people who failed with non-trivial GOPATHs. I would better check 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.
Misread.
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 magic with the staging dirs needs that.
hack/godep-save.sh
Outdated
pushd "${KUBE_ROOT}" > /dev/null | ||
# sanity check that staging directories do not exist in GOPATH | ||
for R in "${STAGING_REPOS[@]}"; do | ||
if [ -e "${GOPATH}/src/${R}" ]; then |
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.
This will error one directory at a time if all 8 staging repos exist, meaning unless the user knows to delete all 8 the first time they hit this, they'll have to run the script 8 times to get all the dirs they need to remove. Perhaps we could collect all the dirs together and output the message once?
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.
fixed
hack/godep-save.sh
Outdated
@@ -33,35 +35,35 @@ REQUIRED_BINS=( | |||
"./..." | |||
) | |||
|
|||
STAGING_REPOS=( |
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 this be dynamic like https://github.com/kubernetes/kubernetes/blob/master/hack/update-staging-godeps.sh#L81 instead of a static list?
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.
Very good idea!
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.
done
@@ -513,6 +513,14 @@ kube::util::ensure_godep_version() { | |||
godep version | |||
} | |||
|
|||
# Checks that the GOPATH is simple, i.e. consists only of one directory, not multiple. | |||
kube::util::ensure_single_dir_gopath() { |
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 like this 👍 ! Would be useful to add on to the staging godeps dockerized script I've got too.
8bce391
to
5b9c339
Compare
@cblecker ptal |
/lgtm |
/assign @fejta |
/approve |
5b9c339
to
5328d4e
Compare
60cb000
to
8637a43
Compare
@cblecker oops. fixing. |
8637a43
to
4522505
Compare
@cblecker done |
hack/godep-save.sh
Outdated
fi | ||
|
||
echo "Deleting vendor/ and Godeps/" | ||
rm -rf "${KUBE_ROOT}/vendor" "${KUBE_ROOT}/Godeps" |
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.
This makes me uncomfortable. I don't see any other hack/ scripts that directly rm -rf anything outside of a temp directory... Perhaps we could warn/error like above, rather than actually rm the directories ourselves?
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.
Am also fine with a warning. I had that in fact as a warning before and then switch to an explicit removal.
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.
Now kube::util::ensure_clean_working_dir
complains that vendor/ and Godeps/ are missing 🙄
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.
So we can choose:
kube::util::ensure_clean_working_dir
and automaticrm -rf
- or no clean working dir check, but an error if vendor/ or Godeps/ exists.
Which one do you like?
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.
My suggestion would be no clean working dir check, and a error for now. I'd be okay with swapping it to the first option if/when these scripts move into a docker container (less risk to a bad delete, and the changes would then be rsync'd out)
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.
good point @ dockerized
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.
fixed
/unassign |
4522505
to
9187210
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cblecker, smarterclayton, sttts Associated issue: 48593 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue (batch tested with PRs 48374, 48524, 48519, 42548, 48615) |
Automatic merge from submit-queue (batch tested with PRs 47040, 48597, 48608, 48653) Fix godep verify to use godep restore script **What this PR does / why we need it**: A bug was introduced in #48615. `hack/verify-godeps.sh` only downloads and compares if godeps have changed, so it wasn't caught on the original PR. However, when it does run (e.g. https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/pr-logs/pull/48630/pull-kubernetes-verify/38350/) it fails because the godep-save script now doesn't permit a compex GOPATH. verify-godeps.sh actually sets one because it restores godeps not using the `hack/godep-restore.sh` script. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ``` /assign @sttts /priority failing-test
Might prevent #48593.