Do not allow a Jenkins build to be triggered in case of test failure

Small Jenkins question about Jenkins triggering mechanism.
I want a build that have unit test failure to not be automatically triggered anymore.
The developper that break the test(s) has to fix it and to launch the build manually.

I tried to find a solution, and the 'best' solution I found is to use the Disable Failed Job Plugin. But I'm not satisfied of it because the build is totally disabled.

Is it possible in Jenkins to do it, or does it exists some plugin that can helps me ?

Thank you,

Seb

Upvotes: 0

Views: 1473

Answers (3)

Alex O
Alex O

Reputation: 8164

There is no simple solution for that. If the job has the SCM polling build trigger configured, then it will run whenever there's a change.

So, if you want to prevent that without disabling the job, then you must remove the SCM trigger from the Job configuration. It is possible to do that automatically, but you'll end up with an ugly setup, since

  • the job configuration will be changed dynamically by the job itself, thus
  • possibly interfering with manual configuration work.

I recommend to stick with disabling the job upon failure. Possibly, you can additionally setup a copy of the job that developers can trigger manually.

Upvotes: 1

diamond
diamond

Reputation: 171

Write Groovy script / Java program,

Read Unit test log from the jenkins console, it will consolidate and give you no of test cases passed/failed. if failed test cases is more than 0, set System.exit(1).

after ur application build step execution, call this script or java program from command line from batch or sh.

Upvotes: 2

mahinlma
mahinlma

Reputation: 1258

Try Multijob plugin

Use sequential work flow, here you have option to execute next test(job) even the current job fails.

Upvotes: 1

Related Questions