Fail Pipeline in Jenkins

I have used Jenkins to create a CI pipeline for my node js application. My pipeline includes jobs such as build,unit test,integration test,code analysis etc. I was wondering if it is possible to fail a build if for example by implementing threshold like z number of tests failed or pass rate < z% ? I know by default a build will fail if even one test case fails.

  • Is there any way to revert the current build in Jenkins?
  • How do I use Jenkins with multiple projects in the same large git repository?
  • Jenkins pipeline environment variables
  • SSH git commands with username and password
  • Jenkins CI integrate with NodeJS and Github problems in configuring build
  • How to set a JVM option in Jenkins globally for every job?
  • How do I clone a job in jenkins?
  • Jenkins hangs when fetching code from Git
  • Why won't groovy run in Jenkins pipeline?
  • Jenkins/Hudson SVN Issue
  • What's (by default) on the classpath when you run a Jenkins job?
  • Making HTTP requests during maven archetype:generate
  • 2 Solutions collect form web for “Fail Pipeline in Jenkins”

    Your unit test script will need to handle the math & logic to determine what percent of tests failing is bad enough to fail the whole job. Then your unit test script can return pass (zero) or fail (anything else) and Jenkins will mark the build accordingly.

    Try Multijob Plugin

    This plugin also helps to run your pipelined jobs

    Git Baby is a git and github fan, let's start git clone.