Skip to content

cancel binary builds if they hang #12484

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
merged 1 commit into from
Jan 24, 2017

Conversation

bparees
Copy link
Contributor

@bparees bparees commented Jan 13, 2017

fixes #12438

@bparees bparees changed the title cancel binary builds if they hang [WIP] cancel binary builds if they hang Jan 13, 2017
build, err = h.r.Generator.Client.GetBuild(h.ctx, build.Name)
return false, err
}
return true, err
Copy link
Contributor

Choose a reason for hiding this comment

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

Fold this into the switch so that err == nil is default:

// Attempt to cancel the build if it did not start running
// before we gave up.
success := false
defer func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Make this a method.

}
build.Status.Cancelled = true
h.r.Generator.Client.UpdateBuild(h.ctx, build)
wait.Poll(500*time.Millisecond, 30*time.Second, func() (bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Make these constants outside the loop but private

@@ -178,7 +178,31 @@ func (h *binaryInstantiateHandler) handle(r io.Reader) (runtime.Object, error) {
}
remaining := h.r.Timeout - time.Now().Sub(start)

// Attempt to cancel the build if it did not start running
Copy link
Contributor

Choose a reason for hiding this comment

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

Create an e2e test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

any suggestions on how to create one that doesn't have to wait 5 minutes to timeout?

since the timeout isn't configurable and can't easily be made configurable from the client side.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hrm. Certainly ugly to test, but also ugly not to have any sort of certainly this code works.

@bparees
Copy link
Contributor Author

bparees commented Jan 20, 2017

[test]

@bparees bparees force-pushed the binary_timeout branch 4 times, most recently from 2be53cd to eeaea5f Compare January 21, 2017 06:55
@bparees
Copy link
Contributor Author

bparees commented Jan 21, 2017

extended builds passed:

continuous-integration/openshift-jenkins/testextended SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin_extended/1015/) (Base Commit: 2cc89a9) (Extended Tests: core(builds))

[testextended][extended:core(image_ecosystem)]

@bparees
Copy link
Contributor Author

bparees commented Jan 21, 2017

@smarterclayton ready for final review, e2e test added. and yes, it waits 5 minutes.

@bparees bparees changed the title [WIP] cancel binary builds if they hang cancel binary builds if they hang Jan 22, 2017
@bparees
Copy link
Contributor Author

bparees commented Jan 23, 2017

@smarterclayton bump

// cancelBuild will mark a build for cancellation unless
// cancel is false in which case it is a no-op.
func (h *binaryInstantiateHandler) cancelBuild(cancel bool, build *buildapi.Build) {
if !cancel {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not necessary, don't do it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just avoid calling the method.

Copy link
Contributor Author

@bparees bparees Jan 23, 2017

Choose a reason for hiding this comment

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

you're the one who wanted the defer logic wrapped into a func in the first place, now you're having me factor the func logic back out of the func....

@@ -194,6 +194,23 @@ var _ = g.Describe("[builds][Slow] starting a build using CLI", func() {
})
})

g.Describe("cancel a binary build that doesn't start running in 5 minutes", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add "[slow]"

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 whole suite is already tagged slow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smarterclayton
Copy link
Contributor

Few small comments, otherwise LGTM

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to be1b942

@bparees
Copy link
Contributor Author

bparees commented Jan 23, 2017

[testextended][extended:core(builds)]

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/13200/) (Base Commit: 6bba78c)

@openshift-bot
Copy link
Contributor

Evaluated for origin testextended up to be1b942

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/testextended FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin_extended/1021/) (Base Commit: b61bed3) (Extended Tests: core(builds), core(image_ecosystem))

@bparees
Copy link
Contributor Author

bparees commented Jan 24, 2017

[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to be1b942

@openshift-bot
Copy link
Contributor

openshift-bot commented Jan 24, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/13223/) (Base Commit: 871952a) (Image: devenv-rhel7_5759)

@openshift-bot openshift-bot merged commit 08dd392 into openshift:master Jan 24, 2017
@bparees bparees deleted the binary_timeout branch January 26, 2017 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable oc start-build timeout
3 participants