arunics
arunics

Reputation: 31

How to set Jenkins Build to be always successful irrespective of SonarQube / Runner Analysis Result or Availability?

Is there a way to set Jenkins build ignore SonarQube Analysis results (Failure / Success). This would be for the scenarios like SonarQube Upgrade / Unavailability, Ignore the Results for initial development phases.

For Windows slave, we can edit the Error Code / Exit Code to '0' in Sonar-runner.bat file. How can we do that for a Linux Based slave ? Or is there any other alternatives?

Upvotes: 0

Views: 513

Answers (1)

jwernerny
jwernerny

Reputation: 7048

For Linux, running a bash shell (arguably the de facto standard these days except in the embedded space), I use bash's ability to have more than one command on a line.

For instance, let's say doit may return 0 (passing) or !0 (failing), but I want Jenkins to always evaluate it as passing.

doit || true

Let's break that down. doit is pretty obvious, it's the command I want run. true is a little obscure, but it means to return a passing (0) value. The magic is in the ||. It tells bash to run the first command (left side), and if the first command passes (returns 0) then stop; else it will run the second command and return the result of that. Since the second command is true, the result of the line is always passing!

Upvotes: 1

Related Questions