Unable to skip SonarQube execution with boolean parameter in Jenkins

995 views
Skip to first unread message

craf...@gmail.com

unread,
Jan 26, 2017, 3:56:06 PM1/26/17
to SonarQube
Hello,

I have an issue with the latest SonarQube plugin for Jenkins. I am unable to ignore the execution of the SonarQube Server with boolean parameter set in my project configuration.

I am using Jenkins 2.42 and I have the SonarQube plugin 2.5. and my sonarqube server is 6.2


Here is my config in jenkins :



And here my project configuration :



And with this configuration always SonarQube analysis is launched.

The only way to have this functionnality is to used the deprecated method like this :


And another point is that with the deprecated option launch after the build when the analysis is skipped the resume is wrong because I can see the icon of sonar in the build queue :


Please could investigate this point ?

Or is it impossible to lauch sonar analysis with boolean parameter in a build ?

In advance, thank you very much for your help about this problem.

Best regards.

G. Ann Campbell

unread,
Jan 31, 2017, 12:17:20 PM1/31/17
to SonarQube, craf...@gmail.com
Hi,

As I understand it, you want to skip analysis if the compilation fails. That makes sense to me. What doesn't make sense is why you want to run analysis as a post build step. If you do it as a build step, it should automatically be skipped if compilation fails. Or am I mis-remembering my Jenkins functionality?

Regarding the conditionality of the analysis:
* I don't see how your skipSonarQube variable comes into the mix (nor how it's set to false if compilation fails)
* Whether or not your "Run only if build succeeds" post step is executing as expected is really not a question of SonarQube Scanner for Jenkins functionality, but of that post step
* The Post Build analysis Action is, as you noted, deprecated, so we won't be investigating the question of the analysis icon in the build list.


Ann

craf...@gmail.com

unread,
Feb 1, 2017, 3:59:38 AM2/1/17
to SonarQube, craf...@gmail.com
Hi,

In fact, I would like to have a checkbox when I clic on the launch build button to choose if I want to have or not a sonar analysis.

As mention in my screenshot, the skipSonarQube variable is injected via a boolean parameter in the job configuration.

Please could you give some screenshots to configure my jenkins build job to have the best configuration ? I don't understand how to configure it as a build step that will not start the analysis.

What is the best way to have in one job maven build + sonar analysis ? Is it to have two different job ? Is it a best way to have sonar analysis for each commit ?
I don't find a very usefull example in the documentation.

Thank you very much.

Best regards,

G. Ann Campbell

unread,
Feb 1, 2017, 7:24:13 AM2/1/17
to craf...@gmail.com, SonarQube
Hi,

No, I can't send you screenshots. But I can recommend you take a look at the Conditional Build Step Plugin for Jenkins. In your job setup you'll turn on "This project is parameterized" and set up your boolean param. This will give you your "run analysis?" button. Then feed the result of the button into the Conditional Build Step, in which you've put a simple maven execution that runs the analysis.


Good luck, 
Ann


---
G. Ann CAMPBELL | SonarSource
Product Manager

On Wed, Feb 1, 2017 at 3:59 AM, <craf...@gmail.com> wrote:
Hi,

In fact, I would like to have a checkbox when I clic on the launch build button to choose if I want to have or not a sonar analysis.

As mention in my screenshot, the skipSonarQube variable is injected via a boolean parameter in the job configuration.

Please could you give some screenshots to configure my jenkins build job to have the best configuration ? I don't understand how to configure it as a build step that will not start the analysis.

What is the best way to have in one job maven build + sonar analysis ? Is it to have two different job ? Is it a best way to have sonar analysis for each commit ?
I don't find a very usefull example in the documentation.

Thank you very much.

Best regards,

Le mardi 31 janvier 2017 18:17:20 UTC+1, G. Ann Campbell a écrit :
Hi,

As I understand it, you want to skip analysis if the compilation fails. That makes sense to me. What doesn't make sense is why you want to run analysis as a post build step. If you do it as a build step, it should automatically be skipped if compilation fails. Or am I mis-remembering my Jenkins functionality?

Regarding the conditionality of the analysis:
* I don't see how your skipSonarQube variable comes into the mix (nor how it's set to false if compilation fails)
* Whether or not your "Run only if build succeeds" post step is executing as expected is really not a question of SonarQube Scanner for Jenkins functionality, but of that post step
* The Post Build analysis Action is, as you noted, deprecated, so we won't be investigating the question of the analysis icon in the build list.


Ann

On Thursday, 26 January 2017 15:56:06 UTC-5, craf...@gmail.com wrote:
Hello,

I have an issue with the latest SonarQube plugin for Jenkins. I am unable to ignore the execution of the SonarQube Server with boolean parameter set in my project configuration.

I am using Jenkins 2.42 and I have the SonarQube plugin 2.5. and my sonarqube server is 6.2


Here is my config in jenkins :




And here my project configuration :





And with this configuration always SonarQube analysis is launched.

The only way to have this functionnality is to used the deprecated method like this :



And another point is that with the deprecated option launch after the build when the analysis is skipped the resume is wrong because I can see the icon of sonar in the build queue :



Please could investigate this point ?

Or is it impossible to lauch sonar analysis with boolean parameter in a build ?

In advance, thank you very much for your help about this problem.

Best regards.

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/mtEOM0dKWR4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/0cf052bf-bc7b-421b-b9c6-570e5d3e08b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages