Skip to content
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

Merged

Conversation

sttts
Copy link
Contributor

@sttts sttts commented Jul 7, 2017

Might prevent #48593.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 7, 2017
@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 7, 2017
@sttts sttts force-pushed the sttts-sanity-check-godep-save branch from 02addaf to 8bce391 Compare July 7, 2017 16:50
@sttts sttts assigned cblecker and unassigned fejta and spxtr Jul 7, 2017
pushd "${KUBE_ROOT}" > /dev/null
# sanity check that staging directories do not exist in GOPATH
Copy link
Member

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?

Copy link
Contributor Author

@sttts sttts Jul 7, 2017

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misread.

Copy link
Contributor Author

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.

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
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -33,35 +35,35 @@ REQUIRED_BINS=(
"./..."
)

STAGING_REPOS=(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good idea!

Copy link
Contributor Author

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() {
Copy link
Member

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.

@sttts sttts force-pushed the sttts-sanity-check-godep-save branch from 8bce391 to 5b9c339 Compare July 7, 2017 17:06
@sttts
Copy link
Contributor Author

sttts commented Jul 7, 2017

@cblecker ptal

@sttts sttts added the release-note-none Denotes a PR that doesn't merit a release note. label Jul 7, 2017
@cblecker
Copy link
Member

cblecker commented Jul 7, 2017

/lgtm
Can you add #48593 as a ref to the body of the PR for the approval bot?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 7, 2017
@cblecker
Copy link
Member

cblecker commented Jul 7, 2017

/assign @fejta
for approval

@smarterclayton
Copy link
Contributor

/approve

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 7, 2017
@sttts sttts force-pushed the sttts-sanity-check-godep-save branch from 5b9c339 to 5328d4e Compare July 7, 2017 17:41
@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 7, 2017
@sttts
Copy link
Contributor Author

sttts commented Jul 7, 2017

@cblecker add another small test: vendor/ and Godeps/ must be deleted. Thanks @nikhita for the idea :)

@sttts sttts force-pushed the sttts-sanity-check-godep-save branch 2 times, most recently from 60cb000 to 8637a43 Compare July 7, 2017 18:04
@cblecker
Copy link
Member

cblecker commented Jul 7, 2017

@sttts I think you must have picked up an extra commit in a rebase somehow? I don't think 9125cae is supposed to be there.

@sttts
Copy link
Contributor Author

sttts commented Jul 7, 2017

@cblecker oops. fixing.

@sttts sttts force-pushed the sttts-sanity-check-godep-save branch from 8637a43 to 4522505 Compare July 7, 2017 18:30
@sttts
Copy link
Contributor Author

sttts commented Jul 7, 2017

@cblecker done

fi

echo "Deleting vendor/ and Godeps/"
rm -rf "${KUBE_ROOT}/vendor" "${KUBE_ROOT}/Godeps"
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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 🙄

Copy link
Contributor Author

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 automatic rm -rf
  • or no clean working dir check, but an error if vendor/ or Godeps/ exists.

Which one do you like?

Copy link
Member

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point @ dockerized

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@fejta
Copy link
Contributor

fejta commented Jul 7, 2017

/unassign
/assign @smarterclayton

@k8s-ci-robot k8s-ci-robot assigned smarterclayton and unassigned fejta Jul 7, 2017
@sttts sttts force-pushed the sttts-sanity-check-godep-save branch from 4522505 to 9187210 Compare July 7, 2017 19:17
Copy link
Member

@cblecker cblecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 7, 2017
@k8s-github-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 48374, 48524, 48519, 42548, 48615)

@k8s-github-robot k8s-github-robot merged commit 95a4a5d into kubernetes:master Jul 7, 2017
k8s-github-robot pushed a commit that referenced this pull request Jul 8, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants