-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Improve oc cancel-build command #8509
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
Conversation
[test] |
// BuildConfigBuilds return a list of builds for the given build config. | ||
// Optionally you can specify a filter function to select only builds that | ||
// matches your criteria. | ||
func BuildConfigBuilds(c client.BuildInterface, name string, filterFunc buildFilter) (*buildapi.BuildList, error) { |
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 is borrowed from serial builds PR and will be re-used there :-)
62cd88d
to
474a27e
Compare
Yeah we have been thinking about batch delete as well.
|
Why would I have a |
@deads2k I think it will make it harder for users to support that format, think of:
What will this do? Cancel all builds created from bc/foo, then cancel build/bar-1 and then cancel foobar-1 that might be BC or build?... Also buildConfig is not a build and the command is |
This is related to #5193 Note that this is proposing slightly different behavior than described in the issue (this PR would cancel all builds for a BC, whereas in the issue we discussed only canceling if there's just a single build running for the BC). I think what's proposed here is ok/better though (behavior wise. i agree with @deads2k that the syntax should be more like cancel-build bc/foo) |
Agree on |
for backwards compatibility, if no resource type is specified, you must assume it's a build. just like "oc logs" assumes you provided a pod name. |
@mfojtik it's not ideal, but it doesn't sound totally wrong. after all, "oc start-build" takes a BC.... |
@bparees I see, actually I looked on start-build and it is accepting both as well :-) OK, I'm surrendering :) |
Take the thing they gave you and find a build logically connected to it you can cancel. Makes sense to me. |
ec20874
to
81dbcf5
Compare
Not yet, but in progress. #8279 |
d4bff9d
to
35e2947
Compare
[test] seems like a flake in integration (failed to pull image) |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" | ||
) | ||
|
||
const ( | ||
cancelBuildLong = ` | ||
Cancels a pending or running build | ||
Cancels a pending, running or new builds |
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.
s/builds/build/
I thought we would support canceling the latest but cancelling all of the builds for that bc also makes sense.
cancel-build supports builds currently so we would continue to resolve single arguments to builds. |
if err != nil { | ||
return err | ||
if len(o.State) > 0 && !isStateCancellable(o.State) { | ||
return kcmdutil.UsageError(cmd, "The '--state' flag has invalid value. Must be 'new', 'pending' or 'running'") |
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.
oxford comma
I'm provisionally ok with the experience you describe, but given deployments has a bunch of stuff recently just want to be sure. |
Cancelling all cancelable builds for a bc makes sense to me. We cannot have the same experience in deployments because there should always be one cancelable deployment. But even in the case there are more than one active deployments (can happen in the upstream controller), we should be able to cancel them all at once. Either way, multiple deployments means all but the latest are rolling out their pods to the latest. |
@bparees @smarterclayton @Kargakis fixed test, I think we are good to merge after tests pass. |
@smarterclayton is there anything we can do with travis flakes on import ordering? maybe disable the check for now till we fix it? :) |
[test] |
We probably need to just fix it. On Wed, Apr 27, 2016 at 5:10 AM, Michal Fojtik [email protected]
|
seems like jenkins hate me today... [test] |
[test] (Error: image cache/mysql:pullthrough not found flake) |
[test] ? |
[test] (integration flake) |
@smarterclayton @bparees any final comments? |
(actually I would prefer to merge the run policy PR first) |
Evaluated for origin test up to a37693a |
@mfojtik still lgtm. |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/3533/) |
[merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/5784/) (Image: devenv-rhel7_4078) |
Evaluated for origin merge up to a37693a |
This is rework of the
oc cancel-build
command, following the 'options' style @smarterclayton introduced for start-build and other commands already.It also adds more functions and control over cancelling builds, following this PR: #8453
More specifically:
oc cancel-build ruby-build-1 ruby-build-2 ...
oc cancel-build bc/ruby-build
oc cancel-build bc/ruby-build --state=new
The last example is basically a command that will cleanup the build queue, allowing the next created build to be first executed (@bparees).
@smarterclayton PTAL.