-
Notifications
You must be signed in to change notification settings - Fork 4.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
Allow to specify runPolicy for BuildConfig #8453
Conversation
@bparees @smarterclayton this is an very early draft of the API additions needed for https://trello.com/c/Wz8FFwko/849-13-single-threaded-builds. Would appreciate quick review before I jump into actual implementation. |
// make the build created from this build requests be the only build in the | ||
// queue. This option is valid only for build configurations with "recent" | ||
// build scheduling policy. | ||
SkipBuildsInQueue *bool |
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.
@smarterclayton @bparees maybe this deserves a better name ;-)
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.
What does Jenkins call this flag? How many flags do they have? What about jenkins pipeline and concourse?
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.
@jstrachan && @jimmidyson to the rescue :-)
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.
There isn't a direct equivalent afaik. There's also accelerated build which will run the new build immediately, but not cancel the other builds. It's all possible of course :) @jstrachan Do you know any different?
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.
not seen anything else equivalent I'm afraid
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.
@jimmidyson @jstrachan thanks guys, we are opting out this option and have one parallel and serial builds for now.
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.
not sure this is the way we want to expose that behavior anyway. i think the use case is more like:
- i started a build
- i look at the build queue and see it's full of garbage
- i run "oc skip-builds" (name tbd) which skips all the queued builds except the most recent one (mine).
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.
@bparees iow.
oc skip-build --to ruby-10
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.
--to is fancy :) but sure.
8fa4671
to
e22db83
Compare
@@ -86,6 +86,10 @@ type BuildStatus struct { | |||
// Cancelled describes if a cancel event was triggered for the build. | |||
Cancelled bool | |||
|
|||
// Position represents the build position in the build queue. Only applies to | |||
// build configurations with "serial" or "recent" scheduling policy. | |||
Position *int64 |
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.
going to use the build number annotation instead?
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.
yes, already updated this pull.
@bparees @smarterclayton PTAL. I did some initial implementation for serial builds. It works, but it is not ideal.. The builds are executed sequentially based on the build number we store in the annotation. Also the BuildController has 30 minutes retry timeout... does that mean if I have big queue for builds and they will not finish in 30 minutes, they will be marked as failed? Another solution would be to have separate controller that handle only "serial" builds. |
978f35b
to
bacdafb
Compare
that should definitely be done. I guess i didn't put it in the card but i was assuming that controller should, on seeing a build enter a terminal state, revisit the queue and pick the next build. doesn't solve the "stuck build that is waiting for an IST" scenario though. |
@bparees it basically means that an event of "complete" build should kick HandleBuild() for all queued builds.... |
@@ -17354,6 +17354,10 @@ | |||
}, | |||
"description": "Triggers determine how new Builds can be launched from a BuildConfig. If no triggers are defined, a new build can only occur as a result of an explicit client build creation." | |||
}, | |||
"schedulePolicy": { | |||
"$ref": "v1.BuildSchedulePolicy", | |||
"description": "SchedulePolicy describes how the new build created from this build configuration will be scheduled for execution. This is optional, if not specified we default to \"parallel\"." |
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 think we would default to serial?
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.
@smarterclayton right. I was thinking about that and I think it make sense. Serial is also default in Jenkins.
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 was thinking we'd default to parallel for backwards compatibility reasons.
i'm ok w/ changing it, but we need to acknowledge we're changing the default behavior for users.
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.
@smarterclayton i found the schedulePolicy
long to type ;-) WDYT about changing that just to schedule: parallel
?
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.
@smarterclayton should we still default to Serial or SerialLatestOnly? I think Serial will be "safe" default.
not just complete. also failed, canceled, etc. |
@bparees made some improvements in the last commit, https://www.youtube.com/watch?v=0MpmnYebdHw |
I think you guys need to define what skipped is before we argue about how On Tue, Apr 12, 2016 at 3:44 PM, Michal Fojtik [email protected]
|
if nextBuild != nil { | ||
glog.Infof("Queue: The next build is %s", nextBuild.Name) | ||
switch build.Status.Phase { | ||
case buildapi.BuildPhaseError, buildapi.BuildPhaseFailed, buildapi.BuildPhaseComplete, buildapi.BuildPhaseCancelled: |
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.
pkg/build/util/util.go:IsBuildComplete
to me, skipped is a reason. canceled is the state. canceled - because the user canceled it |
@bparees +1 we don't want to introduce new phase, so we have to live with existing phases. The best fit for "skipped" is cancelled with a good reason (Ben described the reasons). |
// SchedulePolicy describes how the new build created from this build | ||
// configuration will be scheduled for execution. | ||
// This is optional, if not specified we default to "parallel". | ||
SchedulePolicy *BuildSchedulePolicy |
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.
@smarterclayton API question... do you think this field should be here or in BuildSpec? I think it should be higher level (same as Triggers), WDYT?
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.
Since this doesn't apply to Builds, it makes sense to me that it is not part of BuildSpec.
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.
right. I think it should live on BuildConfig as it is now.
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.
but renamed i guess per the type renaming below.
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.
@bparees yes as soon as we decide the name :-)
[test] |
181125a
to
d3c2897
Compare
[test] (integration flake) |
@smarterclayton @bparees merge while it is green :-) |
@mfojtik still needs api approved label from @smarterclayton |
Approved, thanks for following process :) |
lgtm but we'll let @jimmidyson's PR merge first :) (it just got tagged) |
@bparees rebased... will wait for tests to pass :-) |
[test] |
Evaluated for origin testonlyextended up to bd47008 |
continuous-integration/openshift-jenkins/testonlyextended SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin_extended/132/) (Extended Tests: core(using build configuration)) |
ok jenkins, [test] again. |
Evaluated for origin test up to bd47008 |
continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/3525/) |
[merge] (tests are flaking but nothing related to this PR) |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/5779/) (Image: devenv-rhel7_4075) |
Evaluated for origin merge up to bd47008 |
Are all the flakes known? On May 2, 2016, at 11:32 AM, Michal Fojtik [email protected] wrote: [merge] (tests are flaking but nothing related to this PR) — |
Yes as far I know (s2i quota, mysql passtrough)
|
runPolicy=Parallel | Serial | SerialLatestOnly
into theBuildConfig
.Parallel
represents current behavior.Serial
means the builds will be execute sequentially.SerialLatestOnly
means that only the latest build will be executed and previous non-running builds will be cancelled.The
Serial
will be default when this PR gets merged. This will be documented for users.