0

I have configured jenkins to build a job periodically. (every 1 hour)

I would like to know if there is a way to configure jenkins, so that, when some of tests fail, the jenkins job stops building after that.

Please help! Thank you!.

sridhar249
  • 4,471
  • 6
  • 26
  • 27
  • More info needed. You build after tests? Do you want your tests to stop testinh once some do fail? Multiple steps with status evaluation you can do with a wrapper job that executes child jobs) – Dominik Gebhart Jul 27 '16 at 13:51

1 Answers1

0

You can disable jobs using the REST API (http post to <jobUrl>/disable). You can also do that from within a running build.

So, at the end of you job, at a step that -- in case of failure -- will disable the job itself (the build will continue running to the end, but there will not be any further builds).

Alex O
  • 7,746
  • 2
  • 25
  • 38
  • can you please detail me on how can i add a step? do you mean "Add build step"? or "Add Post build action"?. I don't see any option in there to disable the job on test failures. – sridhar249 Jul 27 '16 at 16:02
  • That's implementation dependent; if you use an `Execute shell` build step for executing your tests, then you could extend that to disable the job in case of a failure. Or -- as you suggest -- you might add a conditional post-build task that only runs upon failure, and which will disable the job then. – Alex O Jul 27 '16 at 16:18
  • Just realized that your question is a duplicate -- the original questions has a nice solution using the groovy-post-build plugin. – Alex O Jul 27 '16 at 16:25
  • Thanks Alex. That should work. – sridhar249 Jul 27 '16 at 16:40