Discussion:
Disabling Sonar while running Jenkins
GeertVc
2013-08-09 13:07:01 UTC
Permalink
Hi,

Using SonarQube 3.6 - SonarRunner 2.2.2 - Jenkins plugin 2.1

Is it possible to temporarily disable Sonar when Jenkins is run? I've tried
with the "Disable" tick box in the Sonar section of the Jenkins manager.

Sonar is indeed not running, but it is flagged as a failure at the end of
the Jenkins build, not allowing me to push changes into Gerrit with our
mechanism used (using "repo upload')...

------------------------------------------------------------------------
SONAR ANALYSIS FAILED
------------------------------------------------------------------------
FATAL: Sonar is disabled (Sonar beqbrgbrg1ux054). See global configuration.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure
Notifying upstream projects of job completion
Finished: FAILURE

This is not what I understood when I asked to disable Sonar. I thought it
would simply not do "anything", not even returning a failure to Gerrit.

Any suggestions?




-----

Best rgds,
--Geert
--
View this message in context: http://sonar.15.x6.nabble.com/Disabling-Sonar-while-running-Jenkins-tp5015920.html
Sent from the Sonar user mailing list archive at Nabble.com.
Ann Campbell
2013-08-09 13:17:38 UTC
Permalink
Wrap the analysis in a Conditional build step (assuming you're not doing a
Maven analysis), add a boolean parameter to the build (default true) and
feed the parameter result into the conditional.



---
G. Ann Campbell
Systems Architect II
Shaw Industries Inc,
201 S. Hamilton St.
Dalton Ga 30720


On Fri, Aug 9, 2013 at 9:07 AM, GeertVc
Post by GeertVc
Hi,
Using SonarQube 3.6 - SonarRunner 2.2.2 - Jenkins plugin 2.1
Is it possible to temporarily disable Sonar when Jenkins is run? I've tried
with the "Disable" tick box in the Sonar section of the Jenkins manager.
Sonar is indeed not running, but it is flagged as a failure at the end of
the Jenkins build, not allowing me to push changes into Gerrit with our
mechanism used (using "repo upload')...
------------------------------------------------------------------------
SONAR ANALYSIS FAILED
------------------------------------------------------------------------
FATAL: Sonar is disabled (Sonar beqbrgbrg1ux054). See global configuration.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure
Notifying upstream projects of job completion
Finished: FAILURE
This is not what I understood when I asked to disable Sonar. I thought it
would simply not do "anything", not even returning a failure to Gerrit.
Any suggestions?
-----
Best rgds,
--Geert
--
http://sonar.15.x6.nabble.com/Disabling-Sonar-while-running-Jenkins-tp5015920.html
Sent from the Sonar user mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
**********************************************************
Privileged and/or confidential information may be contained in this
message. If you are not the addressee indicated in this message (or are not
responsible for delivery of this message to that person) , you may not copy
or deliver this message to anyone. In such case, you should destroy this
message and notify the sender by reply e-mail.
If you or your employer do not consent to Internet e-mail for messages of
this kind, please advise the sender.
Shaw Industries does not provide or endorse any opinions, conclusions or
other information in this message that do not relate to the official
business of the company or its subsidiaries.
**********************************************************
Steffen Breitbach
2013-08-09 13:25:09 UTC
Permalink
Post by Ann Campbell
Wrap the analysis in a Conditional build step (assuming you're not
doing a Maven analysis), add a boolean parameter to the build (default
true) and feed the parameter result into the conditional.
With parametrized builds, you could also run the Sonar analysis as a
downstream job.
GeertVc
2013-08-09 13:26:44 UTC
Permalink
Ann,

Could you elaborate a bit more on that one? Not clear to me what you mean
(and no, I don't to Maven analysis). An example would do good as to where
to add the conditional build step...

TIA,

Best rgds,
--Geert



-----

Best rgds,
--Geert
--
View this message in context: http://sonar.15.x6.nabble.com/Disabling-Sonar-while-running-Jenkins-tp5015920p5015922.html
Sent from the Sonar user mailing list archive at Nabble.com.
Ann Campbell
2013-08-09 13:42:46 UTC
Permalink
I believe the name of the plugin you'll need is the Conditional Build Step
plugin.

[image: Inline image 1]

We always use the multiple step option because there doesn't seem to be a
downside to it, and it makes life much easier if you need to run more steps
on the same condition down the road.
[image: Inline image 2]

HTH




---
G. Ann Campbell
Systems Architect II
Shaw Industries Inc,
201 S. Hamilton St.
Dalton Ga 30720


On Fri, Aug 9, 2013 at 9:26 AM, GeertVc
Post by GeertVc
Ann,
Could you elaborate a bit more on that one? Not clear to me what you mean
(and no, I don't to Maven analysis). An example would do good as to where
to add the conditional build step...
TIA,
Best rgds,
--Geert
-----
Best rgds,
--Geert
--
http://sonar.15.x6.nabble.com/Disabling-Sonar-while-running-Jenkins-tp5015920p5015922.html
Sent from the Sonar user mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
**********************************************************
Privileged and/or confidential information may be contained in this
message. If you are not the addressee indicated in this message (or are not
responsible for delivery of this message to that person) , you may not copy
or deliver this message to anyone. In such case, you should destroy this
message and notify the sender by reply e-mail.
If you or your employer do not consent to Internet e-mail for messages of
this kind, please advise the sender.
Shaw Industries does not provide or endorse any opinions, conclusions or
other information in this message that do not relate to the official
business of the company or its subsidiaries.
**********************************************************
GeertVc
2013-08-09 14:37:54 UTC
Permalink
Your input is invaluable, Ann!

Tried out your proposal and it seems to work. But I do face a strange
thing:

*1. When I tick the "Default" tick box*

Then apparently Sonar is doing the analysis. Which is OK. I do see the
following output at the end of the build:

+ export RUNSONAR=true
+ RUNSONAR=true
Run condition [Boolean condition] enabling perform for step [BuilderChain]
FATAL: Unable to find Sonar project settings at
/mnt/localdata/jenkins/.jenkins/jobs/Sonar_POC/workspace/device/tpvision/common/sde/build/sonar-project.properties
Build step 'Conditional steps (multiple)' marked build as failure
Notifying upstream projects of job completion
Finished: FAILURE

Logical that Sonar fails, since there's no properties file in that directory
=> OK (but at least, it proves that Sonar was called to do the analysis).

*2. When I untick the "Default" tick box*

Then I assume the boolean value is false, right? Seems to work fine too,
because then Sonar is not called, as I don't see the same error message as
above. But... When looking to the output, then I see that the variable
RUNSONAR is still set to "true", while I was expecting to see "false"...

+ export RUNSONAR=true
+ RUNSONAR=true
Run condition [Boolean condition] preventing perform for step [BuilderChain]
Notifying upstream projects of job completion
Finished: SUCCESS

Any explanation for this?

Best rgds,
--Geert



-----

Best rgds,
--Geert
--
View this message in context: http://sonar.15.x6.nabble.com/Disabling-Sonar-while-running-Jenkins-tp5015920p5015929.html
Sent from the Sonar user mailing list archive at Nabble.com.
GeertVc
2013-08-09 14:44:46 UTC
Permalink
Hi Ann,

Forget about the above message. Totally my fault...

Works like a charm, your solution.

Thanks very much!

Best rgds,
--Geert



-----

Best rgds,
--Geert
--
View this message in context: http://sonar.15.x6.nabble.com/Disabling-Sonar-while-running-Jenkins-tp5015920p5015930.html
Sent from the Sonar user mailing list archive at Nabble.com.
nate
2014-01-14 12:45:31 UTC
Permalink
Hi ann, I am trying to use jenkins conditional build step plugin, but for
some reason in my case it is not being able to evalute the boolean
condition. So, I am wondering where do you specify ${runsonar} value to
true?

your help would be appreciated a lot

Thank you
I believe the name of the plugin you'll need is the Conditional Build Step
plugin.
We always use the multiple step option because there doesn't seem to be a
downside to it, and it makes life much easier if you need to run more steps
on the same condition down the road.
HTH
---
G. Ann Campbell
Systems Architect II
Shaw Industries Inc,
201 S. Hamilton St.
Dalton Ga 30720
On Fri, Aug 9, 2013 at 9:26 AM, GeertVc <geert.vancompernolle-
Ann,
Could you elaborate a bit more on that one?  Not clear to me what you mean
(and no, I don't to Maven analysis).  An example would do good as to where
to add the conditional build step...
TIA,
Best rgds,
--Geert
-----
Best rgds,
--Geert
--
View this message in context: http://sonar.15.x6.nabble.com/Disabling-
Sonar-while-running-Jenkins-tp5015920p5015922.html
Sent from the Sonar user mailing list archive at Nabble.com.
---------------------------------------------------------------------
    http://xircles.codehaus.org/manage_email
**********************************************************
Privileged and/or confidential information may be contained in this
message. If you are not the addressee indicated in this message (or are not
responsible for delivery of this message to that person) , you may not copy
or deliver this message to anyone. In such case, you should destroy this
message and notify the sender by reply e-mail.
If you or your employer do not consent to Internet e-mail for messages of
this kind, please advise the sender.
Shaw Industries does not provide or endorse any opinions, conclusions or
other information in this message that do not relate to the official
business of the company  or its subsidiaries.
**********************************************************
Ann Campbell
2014-01-15 17:42:05 UTC
Permalink
A picture is worth 1,000 words. These are from one of my jobs:

[image: Inline image 1]
...
[image: Inline image 2]



---
G. Ann Campbell
Systems Architect II
Shaw Industries Inc,
201 S. Hamilton St.
Dalton Ga 30720
Post by nate
Hi ann, I am trying to use jenkins conditional build step plugin, but for
some reason in my case it is not being able to evalute the boolean
condition. So, I am wondering where do you specify ${runsonar} value to
true?
your help would be appreciated a lot
Thank you
I believe the name of the plugin you'll need is the Conditional Build
Step
plugin.
We always use the multiple step option because there doesn't seem to be a
downside to it, and it makes life much easier if you need to run more steps
on the same condition down the road.
HTH
---
G. Ann Campbell
Systems Architect II
Shaw Industries Inc,
201 S. Hamilton St.
Dalton Ga 30720
On Fri, Aug 9, 2013 at 9:26 AM, GeertVc <geert.vancompernolle-
Ann,
Could you elaborate a bit more on that one? Not clear to me what you
mean
(and no, I don't to Maven analysis). An example would do good as to
where
to add the conditional build step...
TIA,
Best rgds,
--Geert
-----
Best rgds,
--Geert
--
View this message in context: http://sonar.15.x6.nabble.com/Disabling-
Sonar-while-running-Jenkins-tp5015920p5015922.html
Sent from the Sonar user mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
**********************************************************
Privileged and/or confidential information may be contained in this
message. If you are not the addressee indicated in this message (or are not
responsible for delivery of this message to that person) , you may not copy
or deliver this message to anyone. In such case, you should destroy this
message and notify the sender by reply e-mail.
If you or your employer do not consent to Internet e-mail for messages of
this kind, please advise the sender.
Shaw Industries does not provide or endorse any opinions, conclusions or
other information in this message that do not relate to the official
business of the company or its subsidiaries.
**********************************************************
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
**********************************************************
Privileged and/or confidential information may be contained in this
message. If you are not the addressee indicated in this message (or are not
responsible for delivery of this message to that person) , you may not copy
or deliver this message to anyone. In such case, you should destroy this
message and notify the sender by reply e-mail.
If you or your employer do not consent to Internet e-mail for messages of
this kind, please advise the sender.
Shaw Industries does not provide or endorse any opinions, conclusions or
other information in this message that do not relate to the official
business of the company or its subsidiaries.
**********************************************************
tobi42
2014-02-26 10:35:28 UTC
Permalink
Post by GeertVc
Is it possible to temporarily disable Sonar when Jenkins is run?
[..]
Any suggestions?
Hi,

I also wanted to *temporarily* disable the sonar runners.
For me, it worked by simply disabling the plugin in the plugin manager
(disable, not unistall ;-) )

Best regards
Tobi



--
View this message in context: http://sonarqube.15.x6.nabble.com/Disabling-Sonar-while-running-Jenkins-tp5015920p5022483.html
Sent from the SonarQube Users mailing list archive at Nabble.com.
Loading...