Integration Jenkins and SonarQube and Integration Jenkins and Jira

828 views
Skip to first unread message

javad...@gmail.com

unread,
Jun 28, 2016, 8:16:55 AM6/28/16
to SonarQube
Hello All,

Using Java Technology Maven
1). I am new to Jenkins and SonarQube.
Target: 
  To Deploy my application in SonarQube Dashboard through Jenkins once after the build.

I am using below Tools:
 Jenkins 2.8
 SonarQube 5.4
 SonarQube Runner 2.4

Please help me how to setup/intergrate Jenkins and SonarQube.

After preparing few docments i started doing my self, What i have done :
1). Installed SonarQube and SonarRunner.
2). In Jenkins added plugin "SonarQube Plugin" and  configured SonarQube and SonarRunner.
When i created a new Job i am unable to see("Invoke Standalone Sonar Analysis isn't an option on Jenkins)‘Invoke Standalone Sonar Analysis" in Build step.

Please help me how to get "‘Invoke Standalone Sonar Analysis" or is there any way to deploy my project in SonarQube Dashboard through Jenkins after build.

when the devloper changes code and commit in SVN/GIT,it should reflet in the code should reflect in SonarQube dashboard.

2).
I am using Jira 7.1 and the same above softwares
Target is: When the build fails in Jenkins the Incident should generate in Jira.
I am not able to do this.

Please some one can guide me how to do above 2 steps.

Regards,

G. Ann Campbell

unread,
Jun 29, 2016, 12:22:43 PM6/29/16
to SonarQube
Hello,


On Tuesday, 28 June 2016 08:16:55 UTC-4, javad...@gmail.com wrote:
Hello All,

Using Java Technology Maven
1). I am new to Jenkins and SonarQube.
Target: 
  To Deploy my application in SonarQube Dashboard through Jenkins once after the build.

I am using below Tools:
 Jenkins 2.8
 SonarQube 5.4
 SonarQube Runner 2.4

Please help me how to setup/intergrate Jenkins and SonarQube.

After preparing few docments i started doing my self, What i have done :
1). Installed SonarQube and SonarRunner.
2). In Jenkins added plugin "SonarQube Plugin" and  configured SonarQube and SonarRunner.
When i created a new Job i am unable to see("Invoke Standalone Sonar Analysis isn't an option on Jenkins)‘Invoke Standalone Sonar Analysis" in Build step.

I'm not sure there's enough to go on here. What's your job type? Freestyle? Maven?

And maybe a confirming screenshot of your global SQ configuration? Obviously you want to blur any sensitive data.
 

Please help me how to get "‘Invoke Standalone Sonar Analysis" or is there any way to deploy my project in SonarQube Dashboard through Jenkins after build.

when the devloper changes code and commit in SVN/GIT,it should reflet in the code should reflect in SonarQube dashboard.

This is a question of how the job is triggered. Just look at the Build Triggers section of the job configuration
 

2).
I am using Jira 7.1 and the same above softwares
Target is: When the build fails in Jenkins the Incident should generate in Jira.
I am not able to do this.

There is no current functionality for this.
 

Ann

javad...@gmail.com

unread,
Jun 29, 2016, 1:11:07 PM6/29/16
to SonarQube
ThanQ Ann

Here i select Job Type as : Maven Project.

1). Firstly, i wanted to integrate Jenkins with Sonar, by this i wanted to check my code quality after the build and deploy.

for this i added sonarQube plugins, Sonargraph Integration Jenkins Plugin and Sonargraph Plugin

In Configuration for sonarQube i tried to add "SonarQube analysis with Maven"  in Post Build Action but it is saying as depreciated, i tried for 2nd Option as "Invoke Standalone Sonar Analysis" but the option is not avaible. Just looking what might be the reason . I tried  using Jenkins 2.8 and 2.9 but cant see "Invoke Standalone Sonar Analysis".
I am trying to get deployed my project in SonarQube through Jenkins is there any way.

2). Secondly, I am trying to integrate Jenkins with Jira

Is there any scenario when my project is build in Jenkins and if it fails it should create case in Jira. So that i can assign the case to particular person who made mistakes in his code.

Please guide me above 2 points.

Thank you in advance.

G. Ann Campbell

unread,
Jun 29, 2016, 2:22:53 PM6/29/16
to SonarQube
Hi,

On Wednesday, 29 June 2016 13:11:07 UTC-4, javad...@gmail.com wrote:
ThanQ Ann

Here i select Job Type as : Maven Project.

Using a Maven Project as your job type is why you're not seeing the Build Step you expect. Use a Freestyle Job instead.

If you must use a Maven Project, then the Post Build Step is your only option, altho yes, it is deprecated.

BTW, I believe that the Maven Project job type has some long-standing bugs in it that simply haven't been addressed. I know we've faced issues with it in our testing that were due to some of these bugs. 
 
1). Firstly, i wanted to integrate Jenkins with Sonar, by this i wanted to check my code quality after the build and deploy.

for this i added sonarQube plugins, Sonargraph Integration Jenkins Plugin and Sonargraph Plugin

Uhm... I don't know what the "Sonargraph Integration Jenkins Plugin" is, but Sonargraph is entirely unconnected to SonarQube, and you don't need the Sonargraph Plugin for SonarQube for this integration.
 

In Configuration for sonarQube i tried to add "SonarQube analysis with Maven"  in Post Build Action but it is saying as depreciated, i tried for 2nd Option as "Invoke Standalone Sonar Analysis" but the option is not avaible. Just looking what might be the reason . I tried  using Jenkins 2.8 and 2.9 but cant see "Invoke Standalone Sonar Analysis".
I am trying to get deployed my project in SonarQube through Jenkins is there any way.

2). Secondly, I am trying to integrate Jenkins with Jira

Is there any scenario when my project is build in Jenkins and if it fails it should create case in Jira. So that i can assign the case to particular person who made mistakes in his code.

Please guide me above 2 points.

Is there a scenario where it should? Since this is an opinion question, I'll answer with "no."

Should you automatically create a new Jira ticket for a new issue? In SonarSource's opinion, no. Not every issue deserves a ticket. Sometimes many issues should be handled by one ticket. Sometimes they're closed False Positive or Won't Fix.

What I would advise is the use of SonarLint to prevent new issues in the IDE, and pull request analysis if your infrastructure allows.
 
I appreciate and applaud your desire to vigilantly manage the leak, but a human intervention step is still required.


Ann

Ronald Chmara

unread,
Jun 29, 2016, 4:35:36 PM6/29/16
to G. Ann Campbell, SonarQube, javad...@gmail.com
On Wed, Jun 29, 2016 at 11:22 AM, G. Ann Campbell
<ann.ca...@sonarsource.com> wrote:
> On Wednesday, 29 June 2016 13:11:07 UTC-4, javad...@gmail.com wrote:
>> 2). Secondly, I am trying to integrate Jenkins with Jira
>>
>> Is there any scenario when my project is build in Jenkins and if it fails
>> it should create case in Jira. So that i can assign the case to particular
>> person who made mistakes in his code.
>> Please guide me above 2 points.
> Is there a scenario where it should? Since this is an opinion question, I'll
> answer with "no."
>
> Should you automatically create a new Jira ticket for a new issue? In
> SonarSource's opinion, no. Not every issue deserves a ticket. Sometimes many
> issues should be handled by one ticket. Sometimes they're closed False
> Positive or Won't Fix.

I have created such workflows with Jenkins, where a failed build can
create a jira ticket, (using build notifications emails, being sent to
Jira,)

Jenkins output:
https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin
Jira input:
https://confluence.atlassian.com/adminjiraserver071/creating-issues-and-comments-from-email-802592933.html

When build failures are rare, because all of your testing is very
dialed in, and all of your build parameters are dialed in, it can be
useful.

When a single setting is slightly changed in Sonarqube (or jenkins, or
your SCM system, or a publishing target, etc.), and hundreds of
different automated builds fail, and hundreds of jira tickets are
created, in a matter of minutes/hours, it is less useful.
Likewise, when a single build is repeatedly failing, and generating a
new Jira failure ticket every 2-3 minutes, it is also less useful.

There are several ways to deal with both situations, depending on
one's environment.

-Ronabop

javad...@gmail.com

unread,
Jun 30, 2016, 1:57:08 AM6/30/16
to SonarQube
Hi Ann, thanQ for the reply.

1). I tried using Freestyle Job instead of Maven but still i am unable to see "Invoke Standalone Sonar Analysis"  under build or post build action.
 Is there any other option. So that i can see my application in SonarQube dashboard.
 I am trying to integrate Jenkins with Sonar, by this i wanted to check my code quality after the build and deploy.
If yes, please let me know how to configure.
For Dot net i used "SonarQube Scanner for MSBuild"  option is available but i am stuck with Java.

2). Coming to " Sonargraph Integration Jenkins Plugin and Sonargraph Plugin " yes, these are not required for SonarQube just wanted to inform you what are the plugins i used.

3). I am trying to integrate Jenkins with Jira, Suppose i build my project, if the build fails it should be created incident in Jira. 

Thanks for the Support and thank you in advance

---------------------------

G. Ann Campbell

unread,
Jun 30, 2016, 7:46:39 AM6/30/16
to javad...@gmail.com, SonarQube
Hi,

Jenkins + Jira is a topic for a different group.

Regarding the missing build step, please send confirming screenshots of your global setup demonstrating that you have both an instance of SonarQube Scanner and a SonarQube server configured at the global level.


Ann



---
G. Ann CAMPBELL | SonarSource
Product Owner

--
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/ctsDuJdwWYw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/8e0b5e27-f768-4067-9fdb-0e4e5812e9f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

java devops

unread,
Jul 1, 2016, 12:32:55 PM7/1/16
to G. Ann Campbell, SonarQube
Hello Ann,

Please find the attachment of SonarQube Server , SonarQube Scanner and Build.
Sonar-Qube Server.png
sonarQube-scanner.png
Build.png

G. Ann Campbell

unread,
Jul 1, 2016, 1:20:18 PM7/1/16
to SonarQube, ann.ca...@sonarsource.com
Hi,

So, after looking at your screenshots, I went to our Cloudbees instance to look at the list of build steps. We don't have an "Invoke Standalone Sonar Analysis" step either. Since I know we're running analyses, I took a closer look at the list of steps. Then did a massive facepalm.

The step has been renamed "Execute SonarQube Scanner". In fact, it's there in your screenshot.


Ann
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages