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

ensure next build is kicked off when a build completes #13670

Merged
merged 1 commit into from
Apr 9, 2017

Conversation

bparees
Copy link
Contributor

@bparees bparees commented Apr 7, 2017

fixes bugs:

https://bugzilla.redhat.com/show_bug.cgi?id=1440147 (we weren't immediately starting the next build when a build failed, nor setting the completion timestamp on the failed build)

https://bugzilla.redhat.com/show_bug.cgi?id=1436395 (we weren't setting the start time on a build if it went from new->complete extremely quickly, but we were setting the completion time)

@bparees bparees changed the title ensure next build is kicked off when a build completes [DO_NOT_MERGE] ensure next build is kicked off when a build completes Apr 7, 2017
@bparees bparees force-pushed the failed_builds branch 2 times, most recently from 8f97e7a to 4bdc449 Compare April 7, 2017 13:59
@bparees bparees changed the title [DO_NOT_MERGE] ensure next build is kicked off when a build completes ensure next build is kicked off when a build completes Apr 7, 2017
@bparees
Copy link
Contributor Author

bparees commented Apr 7, 2017

[test]

@bparees
Copy link
Contributor Author

bparees commented Apr 7, 2017

[testextended][extended:core(builds)]

@bparees
Copy link
Contributor Author

bparees commented Apr 7, 2017

@openshift/devex ptal

@bparees bparees requested a review from csrwng April 7, 2017 13:59
@bparees bparees force-pushed the failed_builds branch 2 times, most recently from 56a8621 to 25fe8b6 Compare April 7, 2017 14:06
Copy link
Contributor

@gabemontero gabemontero left a comment

Choose a reason for hiding this comment

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

One minor comment / potential suggestion

@@ -121,6 +121,9 @@ func (bc *BuildPodController) HandlePod(pod *kapi.Pod) error {
nextStatus := build.Status.Phase
currentReason := build.Status.Reason

// if the build is marked failed, the build status reason has already been
// set (probably by the build pod itself), so don't do any updating here
// or we'll overwrite the correct value.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have utility functions that delineate which non-successful BuildPhases are set by the build pod (where it is currently just Failed) and which are set outside of the build pod (i.e. BuildPhaseError), in case those two lists change over time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't anticipate that set changing. If it does, that would be a good time to introduce a utility function but I don't think it needs to be done here/now.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

Copy link
Contributor

@csrwng csrwng left a comment

Choose a reason for hiding this comment

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

Some nits, and we need to handle the case when we fail a build because its pod has been deleted (tell the policy to continue on to the next build).

// the current state changed. Do not touch builds that were marked failed
// because we'd potentially be overwriting build state information set by the
// build pod directly.
if (!common.HasBuildPodNameAnnotation(build) || build.Status.Phase != nextStatus) && !buildutil.IsBuildComplete(build) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should split this condition and have a separate

if !common.HasBuildPodNameAnnotation(build) {
	needsUpdate = true
  	common.SetBuildPodNameAnnotation(build, pod.Name)	
}

// there's no reason to re-update the build and rerun
// HandleBuildCompletion if we've already done it for this
// build previously.
buildWasComplete := build.Status.CompletionTimestamp != nil
Copy link
Contributor

Choose a reason for hiding this comment

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

just a nit ... maybe a better name for the variable would be completionTimestampIsSet ? or something shorter

}
if !buildWasComplete && buildutil.IsBuildComplete(build) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment explaining why we do this here

@bparees bparees force-pushed the failed_builds branch 2 times, most recently from eb0b01e to 1e37067 Compare April 7, 2017 17:25
}
// if the build was not previously marked complete but it's complete now,
// handle completion for it. otherwise ignore it because we've already
// handle its completion previously.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/handle/handled/

@csrwng
Copy link
Contributor

csrwng commented Apr 7, 2017

LGTM

@openshift-bot
Copy link
Contributor

Evaluated for origin testextended up to bb80432

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/testextended SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin_extended/133/) (Base Commit: b4b7083) (Extended Tests: core(builds))

@bparees
Copy link
Contributor Author

bparees commented Apr 7, 2017 via email

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to bb80432

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/653/) (Base Commit: 1ea122b)

@bparees
Copy link
Contributor Author

bparees commented Apr 8, 2017

[merge]

@stevekuznetsov
Copy link
Contributor

@openshift-bot, the last build failed from the following flakes:

re[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to bb80432

@openshift-bot
Copy link
Contributor

openshift-bot commented Apr 8, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/294/) (Base Commit: 201ba3f) (Image: devenv-rhel7_6128)

@openshift-bot openshift-bot merged commit 308e3e9 into openshift:master Apr 9, 2017
@bparees
Copy link
Contributor Author

bparees commented Apr 9, 2017

thanks @stevekuznetsov

@bparees bparees deleted the failed_builds branch April 11, 2017 14:52
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.

5 participants