Re: How to get a list of jobs that are integrated with SonarQube

2020-05-28 Thread Vijay Gongle
Hi Jan/Dirk,

Tweaking the script worked in charm. Below is the perfectly working script
which gives me the results for any job that has sonarqube integrated or
sonar quality gates integrated.
It might help someone who is in similar boat. I thank a lot lot to you both
for leading me in right direction which helped  in in achieving this.

import hudson.model.*
import hudson.plugins.sonar.*
import jenkins.model.*

// Iterate over all jobs
Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
  def fName = job.getFullName()

  // Iterate over all build wrappers
  if(job.respondsTo('getBuildWrappersList')) {
  for (wrapper in job.getBuildWrappersList()) {
  if (wrapper instanceof SonarBuildWrapper) {
  println(fName + ' has SonarQube configuration.')
  }
  }
  }
  if(job.respondsTo('getPublishersList')) {
  for (String str : job.getPublishersList()) {
//def str = wrapper
if(str.contains("org.quality.gates.jenkins.plugin.QGPublisher")){
  println(fName + ' has Quality Gate plugin')
  }
  }
  }
}
println('Done.')

Thanks,
Vijay

On Thu, May 28, 2020 at 1:35 AM 'Dirk Heinrichs' via Jenkins Users <
jenkinsci-users@googlegroups.com> wrote:

> Am Mittwoch, den 27.05.2020, 21:33 -0500 schrieb Jan Monterrubio:
>
> Try printing like this:
>
> println(“${job.getFullName()} has soñar configuration”)
>
>
> The script already has a line for this.
>
> Bye...
>
> Dirk
>
> --
>
> *Dirk Heinrichs*
> Senior Systems Engineer, Delivery Pipeline
> OpenText ™ Discovery | Recommind
> *Phone*: +49 2226 15966 18
> *Email*: dhein...@opentext.com
> *Website*: www.recommind.de
> Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
> Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan,
> Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
> Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
> irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
> vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
> Weitergabe dieser Mail sind nicht gestattet.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/32fc3047756383f007e116e41011f3fe021eda88.camel%40opentext.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAMrMyDna-bhhN%2Br6wYtGWFfPGNDxfwJRKrv72s9GNtgRsidhfg%40mail.gmail.com.


Re: How to get a list of jobs that are integrated with SonarQube

2020-05-27 Thread 'Dirk Heinrichs' via Jenkins Users
Am Mittwoch, den 27.05.2020, 21:33 -0500 schrieb Jan Monterrubio:

> Try printing like this:
> println(“${job.getFullName()} has soñar configuration”)

The script already has a line for this.

Bye...

   Dirk
-- 
Dirk HeinrichsSenior Systems Engineer, Delivery PipelineOpenText ™ Discovery | 
RecommindPhone: +49 2226 15966 18Email: dheinric@opentext.comWebsite: 
www.recommind.deRecommind GmbH, Von-Liebig-Straße 1, 53359 
RheinbachVertretungsberechtigte Geschäftsführer Gordon Davies, Madhu
Ranganathan, Christian Waida, Registergericht Amtsgericht Bonn,
Registernummer HRB 10646This e-mail may contain confidential and/or privileged 
information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure or distribution of the material in
this e-mail is strictly forbiddenDiese E-Mail enthält vertrauliche und/oder 
rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-
Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser Mail sind nicht gestattet.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/32fc3047756383f007e116e41011f3fe021eda88.camel%40opentext.com.


signature.asc
Description: This is a digitally signed message part


Re: How to get a list of jobs that are integrated with SonarQube

2020-05-27 Thread Jan Monterrubio
Try printing like this:

println(“${job.getFullName()} has soñar configuration”)

It’s groovy interpolation. If that doesn’t work maybe just job.getName
might do it.

On Wed, May 27, 2020 at 15:27 Vijay Gongle  wrote:

> Hi Jan/Dirk,
> I used the below script and I'm getting all the plugins list that jobs are
> using but not the actual job name. Can you please help me how to tweak it.
>
> When I run the below script I get the results which shows "
> org.quality.gates.jenkins.plugin.QGPublisher@75f89c52" along with other
> such plugin details. But I would like to see which job is using this
> quality gate plugin.
>
> import hudson.model.*
> import hudson.plugins.sonar.*
> import jenkins.model.*
>
> // Iterate over all jobs
> Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
>   def fName = job.getFullName()
>
>   // Iterate over all build wrappers
>   if(job.respondsTo('getBuildWrappersList')) {
>   for (wrapper in job.getBuildWrappersList()) {
>   if (wrapper instanceof SonarBuildWrapper) {
>   println(fName + ' has SonarQube configuration.')
>   }
>   }
>   }
>   //if(job.respondsTo('getPublishersList')) {
>   for (wrapper in job.getPublishersList()) {
>   //if (wrapper instanceof SonarPublisher) {
>   println(wrapper)
>   //}
>   //}
>   }
> }
> println('Done.')
>
> Thanks,
> Vijay
>
> On Wed, May 27, 2020 at 12:15 AM Jan Monterrubio 
> wrote:
>
>> >   Do I have to run it separately or it can be combined in the above
>> script?
>>
>> you can combine it:
>>
>> if (buildWrappersList() { // the logic for the build wrappers }
>>
>> if (publishersList() { // find sonar publisher }
>>
>>
>> On Tue, May 26, 2020 at 10:06 PM Vijay Gongle 
>> wrote:
>>
>>> Thanks a lot Jan and Dirk. The below script worked for about 50%.
>>> Looking at the results, found that there are missing parts.
>>> import hudson.model.*
>>> import hudson.plugins.sonar.*
>>> import jenkins.model.*
>>>
>>> // Iterate over all jobs
>>> Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
>>>   def fName = job.getFullName()
>>>
>>>   // Iterate over all build wrappers
>>>   if(job.respondsTo('getBuildWrappersList')) {
>>>   for (wrapper in job.getBuildWrappersList()) {
>>>   if (wrapper instanceof SonarBuildWrapper) {
>>>   println(fName + ' has SonarQube configuration.')
>>>   }
>>>   }
>>>   }
>>>   else{
>>> println(fName + ' has some issues.')
>>>   }
>>> }
>>> println('Done.')
>>>
>>> I don't see anything that has sonar quality gate. Do I have to run it
>>> separately or it can be combined in the above script?
>>> Below is the config xml. What needs to be replaced with, to get the
>>> results which has Sonar quality gates as well in the jobs?
>>>
>>> 
>>> 
>>> portal
>>> Sonar
>>> FAILED
>>> 
>>> 
>>> 
>>> 
>>> 
>>> false
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> false
>>> 
>>>
>>> Thanks,
>>>
>>> On Tue, May 26, 2020 at 2:17 PM Jan Monterrubio <
>>> janmonterru...@gmail.com> wrote:
>>>
 It seems that we do something like this to check if its gonna respond
 to that method:

 if(project.respondsTo('getBuildWrappersList')) { // do other things
 here } MavenModuleSet doesn't have a buildWrappersList:
 https://javadoc.jenkins.io/plugin/maven-plugin/hudson/maven/MavenModule.html
 MavenModuleSet on the other hand, does:
 https://javadoc.jenkins.io/plugin/maven-plugin/hudson/maven/MavenModuleSet.html#getBuildWrappersList--
 So you might have to check if the project responds to that method, and if
 so, check if it has sonar. If not, print out the job name and lets check if
 it has the same configuration object type: *maven2-moduleset*

 On Tue, May 26, 2020 at 12:56 PM Vijay Gongle 
 wrote:

> Ya sure, I haven't tweaked it honestly as I'm not aware of Groovy. So
> I have pasted the below script provided by Drik.
>
> import hudson.model.*
> import hudson.plugins.sonar.*
> import jenkins.model.*
>
> // Iterate over all jobs
> Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
>   def fName = job.getFullName()
>
>   // Iterate over all build wrappers
>   for (wrapper in job.getBuildWrappersList()) {
>   if (wrapper instanceof SonarBuildWrapper) {
>   println(fName + ' has SonarQube configuration.')
>   }
>   }
> }
> println('Done.')
>
>
> Thanks
>
> On Tue, May 26, 2020 at 1:52 PM Jan Monterrubio <
> janmonterru...@gmail.com> wrote:
>
>>  at Script1.run(Script1.groovy:6)
>>
>> do you mind copy pasting your script here so we can check it out (with 
>> whatever modifications you have).
>>
>> Based on what Dirk said, you might have to tweak it:
>>
>> "Paste it into the Script Console and see how it works. We don't use 
>> SonarCube ourselves, so it may work or not, but it should point you into 
>> the right direction."
>>
>>
>> On Tue, May 26, 2020 at 12:44 PM Vijay 

Re: How to get a list of jobs that are integrated with SonarQube

2020-05-27 Thread Vijay Gongle
Hi Jan/Dirk,
I used the below script and I'm getting all the plugins list that jobs are
using but not the actual job name. Can you please help me how to tweak it.

When I run the below script I get the results which shows "
org.quality.gates.jenkins.plugin.QGPublisher@75f89c52" along with other
such plugin details. But I would like to see which job is using this
quality gate plugin.

import hudson.model.*
import hudson.plugins.sonar.*
import jenkins.model.*

// Iterate over all jobs
Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
  def fName = job.getFullName()

  // Iterate over all build wrappers
  if(job.respondsTo('getBuildWrappersList')) {
  for (wrapper in job.getBuildWrappersList()) {
  if (wrapper instanceof SonarBuildWrapper) {
  println(fName + ' has SonarQube configuration.')
  }
  }
  }
  //if(job.respondsTo('getPublishersList')) {
  for (wrapper in job.getPublishersList()) {
  //if (wrapper instanceof SonarPublisher) {
  println(wrapper)
  //}
  //}
  }
}
println('Done.')

Thanks,
Vijay

On Wed, May 27, 2020 at 12:15 AM Jan Monterrubio 
wrote:

> >   Do I have to run it separately or it can be combined in the above
> script?
>
> you can combine it:
>
> if (buildWrappersList() { // the logic for the build wrappers }
>
> if (publishersList() { // find sonar publisher }
>
>
> On Tue, May 26, 2020 at 10:06 PM Vijay Gongle  wrote:
>
>> Thanks a lot Jan and Dirk. The below script worked for about 50%. Looking
>> at the results, found that there are missing parts.
>> import hudson.model.*
>> import hudson.plugins.sonar.*
>> import jenkins.model.*
>>
>> // Iterate over all jobs
>> Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
>>   def fName = job.getFullName()
>>
>>   // Iterate over all build wrappers
>>   if(job.respondsTo('getBuildWrappersList')) {
>>   for (wrapper in job.getBuildWrappersList()) {
>>   if (wrapper instanceof SonarBuildWrapper) {
>>   println(fName + ' has SonarQube configuration.')
>>   }
>>   }
>>   }
>>   else{
>> println(fName + ' has some issues.')
>>   }
>> }
>> println('Done.')
>>
>> I don't see anything that has sonar quality gate. Do I have to run it
>> separately or it can be combined in the above script?
>> Below is the config xml. What needs to be replaced with, to get the
>> results which has Sonar quality gates as well in the jobs?
>>
>> 
>> 
>> portal
>> Sonar
>> FAILED
>> 
>> 
>> 
>> 
>> 
>> false
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> false
>> 
>>
>> Thanks,
>>
>> On Tue, May 26, 2020 at 2:17 PM Jan Monterrubio 
>> wrote:
>>
>>> It seems that we do something like this to check if its gonna respond to
>>> that method:
>>>
>>> if(project.respondsTo('getBuildWrappersList')) { // do other things
>>> here } MavenModuleSet doesn't have a buildWrappersList:
>>> https://javadoc.jenkins.io/plugin/maven-plugin/hudson/maven/MavenModule.html
>>> MavenModuleSet on the other hand, does:
>>> https://javadoc.jenkins.io/plugin/maven-plugin/hudson/maven/MavenModuleSet.html#getBuildWrappersList--
>>> So you might have to check if the project responds to that method, and if
>>> so, check if it has sonar. If not, print out the job name and lets check if
>>> it has the same configuration object type: *maven2-moduleset*
>>>
>>> On Tue, May 26, 2020 at 12:56 PM Vijay Gongle 
>>> wrote:
>>>
 Ya sure, I haven't tweaked it honestly as I'm not aware of Groovy. So I
 have pasted the below script provided by Drik.

 import hudson.model.*
 import hudson.plugins.sonar.*
 import jenkins.model.*

 // Iterate over all jobs
 Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
   def fName = job.getFullName()

   // Iterate over all build wrappers
   for (wrapper in job.getBuildWrappersList()) {
   if (wrapper instanceof SonarBuildWrapper) {
   println(fName + ' has SonarQube configuration.')
   }
   }
 }
 println('Done.')


 Thanks

 On Tue, May 26, 2020 at 1:52 PM Jan Monterrubio <
 janmonterru...@gmail.com> wrote:

>   at Script1.run(Script1.groovy:6)
>
> do you mind copy pasting your script here so we can check it out (with 
> whatever modifications you have).
>
> Based on what Dirk said, you might have to tweak it:
>
> "Paste it into the Script Console and see how it works. We don't use 
> SonarCube ourselves, so it may work or not, but it should point you into 
> the right direction."
>
>
> On Tue, May 26, 2020 at 12:44 PM Vijay Gongle 
> wrote:
>
>> All the jobs has similar configurations for SonarQube as posted in
>> the above config.xml
>> It throws the below error:
>>
>> groovy.lang.MissingMethodException: No signature of method: 
>> hudson.maven.MavenModule.getBuildWrappersList() is applicable for 
>> argument types: () values: []
>>  at 
>> 

Re: [EXTERNAL] - Re: How to get a list of jobs that are integrated with SonarQube

2020-05-26 Thread 'Dirk Heinrichs' via Jenkins Users
Am Dienstag, den 26.05.2020, 12:51 -0400 schrieb Vijay Gongle:

> I ran the above script and I get the below result with two of the job
> names which has SonarQube configurations. But I'm sure there are even
> more. 
> 
> Result* has SonarQube configuration.* has SonarQube
> configuration.groovy.lang.MissingMethodException: No signature of
> method: hudson.maven.MavenModule.getBuildWrappersList() is applicable
> for argument types: () values: []

Hmm, according to the module documentation (as posted by Jan), it
should have that method. Maybe you just need to import the module. Try
adding

import hudson.maven.MavenModuleSet.*

to the list of imports. We don't have any Maven jobs ourselves, so I
never needed to care .

HTH...

Dirk
-- 
Dirk HeinrichsSenior Systems Engineer, Delivery PipelineOpenText ™ Discovery | 
RecommindPhone: +49 2226 15966 18Email: dheinric@opentext.comWebsite: 
www.recommind.deRecommind GmbH, Von-Liebig-Straße 1, 53359 
RheinbachVertretungsberechtigte Geschäftsführer Gordon Davies, Madhu
Ranganathan, Christian Waida, Registergericht Amtsgericht Bonn,
Registernummer HRB 10646This e-mail may contain confidential and/or privileged 
information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure or distribution of the material in
this e-mail is strictly forbiddenDiese E-Mail enthält vertrauliche und/oder 
rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-
Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser Mail sind nicht gestattet.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/030526ffa4549b8c14d720010d4fc83f7d93ee2c.camel%40opentext.com.


signature.asc
Description: This is a digitally signed message part


Re: How to get a list of jobs that are integrated with SonarQube

2020-05-26 Thread Jan Monterrubio
>   Do I have to run it separately or it can be combined in the above
script?

you can combine it:

if (buildWrappersList() { // the logic for the build wrappers }

if (publishersList() { // find sonar publisher }


On Tue, May 26, 2020 at 10:06 PM Vijay Gongle  wrote:

> Thanks a lot Jan and Dirk. The below script worked for about 50%. Looking
> at the results, found that there are missing parts.
> import hudson.model.*
> import hudson.plugins.sonar.*
> import jenkins.model.*
>
> // Iterate over all jobs
> Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
>   def fName = job.getFullName()
>
>   // Iterate over all build wrappers
>   if(job.respondsTo('getBuildWrappersList')) {
>   for (wrapper in job.getBuildWrappersList()) {
>   if (wrapper instanceof SonarBuildWrapper) {
>   println(fName + ' has SonarQube configuration.')
>   }
>   }
>   }
>   else{
> println(fName + ' has some issues.')
>   }
> }
> println('Done.')
>
> I don't see anything that has sonar quality gate. Do I have to run it
> separately or it can be combined in the above script?
> Below is the config xml. What needs to be replaced with, to get the
> results which has Sonar quality gates as well in the jobs?
>
> 
> 
> portal
> Sonar
> FAILED
> 
> 
> 
> 
> 
> false
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> false
> 
>
> Thanks,
>
> On Tue, May 26, 2020 at 2:17 PM Jan Monterrubio 
> wrote:
>
>> It seems that we do something like this to check if its gonna respond to
>> that method:
>>
>> if(project.respondsTo('getBuildWrappersList')) { // do other things here
>> } MavenModuleSet doesn't have a buildWrappersList:
>> https://javadoc.jenkins.io/plugin/maven-plugin/hudson/maven/MavenModule.html
>> MavenModuleSet on the other hand, does:
>> https://javadoc.jenkins.io/plugin/maven-plugin/hudson/maven/MavenModuleSet.html#getBuildWrappersList--
>> So you might have to check if the project responds to that method, and if
>> so, check if it has sonar. If not, print out the job name and lets check if
>> it has the same configuration object type: *maven2-moduleset*
>>
>> On Tue, May 26, 2020 at 12:56 PM Vijay Gongle 
>> wrote:
>>
>>> Ya sure, I haven't tweaked it honestly as I'm not aware of Groovy. So I
>>> have pasted the below script provided by Drik.
>>>
>>> import hudson.model.*
>>> import hudson.plugins.sonar.*
>>> import jenkins.model.*
>>>
>>> // Iterate over all jobs
>>> Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
>>>   def fName = job.getFullName()
>>>
>>>   // Iterate over all build wrappers
>>>   for (wrapper in job.getBuildWrappersList()) {
>>>   if (wrapper instanceof SonarBuildWrapper) {
>>>   println(fName + ' has SonarQube configuration.')
>>>   }
>>>   }
>>> }
>>> println('Done.')
>>>
>>>
>>> Thanks
>>>
>>> On Tue, May 26, 2020 at 1:52 PM Jan Monterrubio <
>>> janmonterru...@gmail.com> wrote:
>>>
at Script1.run(Script1.groovy:6)

 do you mind copy pasting your script here so we can check it out (with 
 whatever modifications you have).

 Based on what Dirk said, you might have to tweak it:

 "Paste it into the Script Console and see how it works. We don't use 
 SonarCube ourselves, so it may work or not, but it should point you into 
 the right direction."


 On Tue, May 26, 2020 at 12:44 PM Vijay Gongle 
 wrote:

> All the jobs has similar configurations for SonarQube as posted in the
> above config.xml
> It throws the below error:
>
> groovy.lang.MissingMethodException: No signature of method: 
> hudson.maven.MavenModule.getBuildWrappersList() is applicable for 
> argument types: () values: []
>   at 
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
>   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49)
>   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
>   at 
> hudson.model.BuildableItemWithBuildWrappers$getBuildWrappersList.call(Unknown
>  Source)
>   at Script1$_run_closure1.doCall(Script1.groovy:10)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
>   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
>   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
>   at groovy.lang.Closure.call(Closure.java:414)
>   at groovy.lang.Closure.call(Closure.java:430)
>   at 
> 

Re: How to get a list of jobs that are integrated with SonarQube

2020-05-26 Thread Jan Monterrubio
That looks like it would be in the set of Publishers?
https://javadoc.jenkins.io/plugin/maven-plugin/hudson/maven/MavenModuleSet.html#getPublishers--

So maybe try iterating through the publishers and if one of them is an
instance of hudson.plugins.sonar.SonarPublisher , then you found another
thing with sonar!

On Tue, May 26, 2020 at 10:06 PM Vijay Gongle  wrote:

> Thanks a lot Jan and Dirk. The below script worked for about 50%. Looking
> at the results, found that there are missing parts.
> import hudson.model.*
> import hudson.plugins.sonar.*
> import jenkins.model.*
>
> // Iterate over all jobs
> Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
>   def fName = job.getFullName()
>
>   // Iterate over all build wrappers
>   if(job.respondsTo('getBuildWrappersList')) {
>   for (wrapper in job.getBuildWrappersList()) {
>   if (wrapper instanceof SonarBuildWrapper) {
>   println(fName + ' has SonarQube configuration.')
>   }
>   }
>   }
>   else{
> println(fName + ' has some issues.')
>   }
> }
> println('Done.')
>
> I don't see anything that has sonar quality gate. Do I have to run it
> separately or it can be combined in the above script?
> Below is the config xml. What needs to be replaced with, to get the
> results which has Sonar quality gates as well in the jobs?
>
> 
> 
> portal
> Sonar
> FAILED
> 
> 
> 
> 
> 
> false
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> false
> 
>
> Thanks,
>
> On Tue, May 26, 2020 at 2:17 PM Jan Monterrubio 
> wrote:
>
>> It seems that we do something like this to check if its gonna respond to
>> that method:
>>
>> if(project.respondsTo('getBuildWrappersList')) { // do other things here
>> } MavenModuleSet doesn't have a buildWrappersList:
>> https://javadoc.jenkins.io/plugin/maven-plugin/hudson/maven/MavenModule.html
>> MavenModuleSet on the other hand, does:
>> https://javadoc.jenkins.io/plugin/maven-plugin/hudson/maven/MavenModuleSet.html#getBuildWrappersList--
>> So you might have to check if the project responds to that method, and if
>> so, check if it has sonar. If not, print out the job name and lets check if
>> it has the same configuration object type: *maven2-moduleset*
>>
>> On Tue, May 26, 2020 at 12:56 PM Vijay Gongle 
>> wrote:
>>
>>> Ya sure, I haven't tweaked it honestly as I'm not aware of Groovy. So I
>>> have pasted the below script provided by Drik.
>>>
>>> import hudson.model.*
>>> import hudson.plugins.sonar.*
>>> import jenkins.model.*
>>>
>>> // Iterate over all jobs
>>> Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
>>>   def fName = job.getFullName()
>>>
>>>   // Iterate over all build wrappers
>>>   for (wrapper in job.getBuildWrappersList()) {
>>>   if (wrapper instanceof SonarBuildWrapper) {
>>>   println(fName + ' has SonarQube configuration.')
>>>   }
>>>   }
>>> }
>>> println('Done.')
>>>
>>>
>>> Thanks
>>>
>>> On Tue, May 26, 2020 at 1:52 PM Jan Monterrubio <
>>> janmonterru...@gmail.com> wrote:
>>>
at Script1.run(Script1.groovy:6)

 do you mind copy pasting your script here so we can check it out (with 
 whatever modifications you have).

 Based on what Dirk said, you might have to tweak it:

 "Paste it into the Script Console and see how it works. We don't use 
 SonarCube ourselves, so it may work or not, but it should point you into 
 the right direction."


 On Tue, May 26, 2020 at 12:44 PM Vijay Gongle 
 wrote:

> All the jobs has similar configurations for SonarQube as posted in the
> above config.xml
> It throws the below error:
>
> groovy.lang.MissingMethodException: No signature of method: 
> hudson.maven.MavenModule.getBuildWrappersList() is applicable for 
> argument types: () values: []
>   at 
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
>   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49)
>   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
>   at 
> hudson.model.BuildableItemWithBuildWrappers$getBuildWrappersList.call(Unknown
>  Source)
>   at Script1$_run_closure1.doCall(Script1.groovy:10)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
>   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
>   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
>   at groovy.lang.Closure.call(Closure.java:414)
>   at 

Re: How to get a list of jobs that are integrated with SonarQube

2020-05-26 Thread Vijay Gongle
Thanks a lot Jan and Dirk. The below script worked for about 50%. Looking
at the results, found that there are missing parts.
import hudson.model.*
import hudson.plugins.sonar.*
import jenkins.model.*

// Iterate over all jobs
Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
  def fName = job.getFullName()

  // Iterate over all build wrappers
  if(job.respondsTo('getBuildWrappersList')) {
  for (wrapper in job.getBuildWrappersList()) {
  if (wrapper instanceof SonarBuildWrapper) {
  println(fName + ' has SonarQube configuration.')
  }
  }
  }
  else{
println(fName + ' has some issues.')
  }
}
println('Done.')

I don't see anything that has sonar quality gate. Do I have to run it
separately or it can be combined in the above script?
Below is the config xml. What needs to be replaced with, to get the results
which has Sonar quality gates as well in the jobs?



portal
Sonar
FAILED





false













false


Thanks,

On Tue, May 26, 2020 at 2:17 PM Jan Monterrubio 
wrote:

> It seems that we do something like this to check if its gonna respond to
> that method:
>
> if(project.respondsTo('getBuildWrappersList')) { // do other things here
> } MavenModuleSet doesn't have a buildWrappersList:
> https://javadoc.jenkins.io/plugin/maven-plugin/hudson/maven/MavenModule.html
> MavenModuleSet on the other hand, does:
> https://javadoc.jenkins.io/plugin/maven-plugin/hudson/maven/MavenModuleSet.html#getBuildWrappersList--
> So you might have to check if the project responds to that method, and if
> so, check if it has sonar. If not, print out the job name and lets check if
> it has the same configuration object type: *maven2-moduleset*
>
> On Tue, May 26, 2020 at 12:56 PM Vijay Gongle  wrote:
>
>> Ya sure, I haven't tweaked it honestly as I'm not aware of Groovy. So I
>> have pasted the below script provided by Drik.
>>
>> import hudson.model.*
>> import hudson.plugins.sonar.*
>> import jenkins.model.*
>>
>> // Iterate over all jobs
>> Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
>>   def fName = job.getFullName()
>>
>>   // Iterate over all build wrappers
>>   for (wrapper in job.getBuildWrappersList()) {
>>   if (wrapper instanceof SonarBuildWrapper) {
>>   println(fName + ' has SonarQube configuration.')
>>   }
>>   }
>> }
>> println('Done.')
>>
>>
>> Thanks
>>
>> On Tue, May 26, 2020 at 1:52 PM Jan Monterrubio 
>> wrote:
>>
>>> at Script1.run(Script1.groovy:6)
>>>
>>> do you mind copy pasting your script here so we can check it out (with 
>>> whatever modifications you have).
>>>
>>> Based on what Dirk said, you might have to tweak it:
>>>
>>> "Paste it into the Script Console and see how it works. We don't use 
>>> SonarCube ourselves, so it may work or not, but it should point you into 
>>> the right direction."
>>>
>>>
>>> On Tue, May 26, 2020 at 12:44 PM Vijay Gongle 
>>> wrote:
>>>
 All the jobs has similar configurations for SonarQube as posted in the
 above config.xml
 It throws the below error:

 groovy.lang.MissingMethodException: No signature of method: 
 hudson.maven.MavenModule.getBuildWrappersList() is applicable for argument 
 types: () values: []
at 
 org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
at 
 org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49)
at 
 org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at 
 hudson.model.BuildableItemWithBuildWrappers$getBuildWrappersList.call(Unknown
  Source)
at Script1$_run_closure1.doCall(Script1.groovy:10)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at 
 org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at 
 org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at 
 org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
at 
 org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
at 
 org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2066)
at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
at 
 org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at 
 

Re: How to get a list of jobs that are integrated with SonarQube

2020-05-26 Thread Jan Monterrubio
It seems that we do something like this to check if its gonna respond to
that method:

if(project.respondsTo('getBuildWrappersList')) { // do other things here }
MavenModuleSet doesn't have a buildWrappersList:
https://javadoc.jenkins.io/plugin/maven-plugin/hudson/maven/MavenModule.html
MavenModuleSet on the other hand, does:
https://javadoc.jenkins.io/plugin/maven-plugin/hudson/maven/MavenModuleSet.html#getBuildWrappersList--
So you might have to check if the project responds to that method, and if
so, check if it has sonar. If not, print out the job name and lets check if
it has the same configuration object type: *maven2-moduleset*

On Tue, May 26, 2020 at 12:56 PM Vijay Gongle  wrote:

> Ya sure, I haven't tweaked it honestly as I'm not aware of Groovy. So I
> have pasted the below script provided by Drik.
>
> import hudson.model.*
> import hudson.plugins.sonar.*
> import jenkins.model.*
>
> // Iterate over all jobs
> Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
>   def fName = job.getFullName()
>
>   // Iterate over all build wrappers
>   for (wrapper in job.getBuildWrappersList()) {
>   if (wrapper instanceof SonarBuildWrapper) {
>   println(fName + ' has SonarQube configuration.')
>   }
>   }
> }
> println('Done.')
>
>
> Thanks
>
> On Tue, May 26, 2020 at 1:52 PM Jan Monterrubio 
> wrote:
>
>>  at Script1.run(Script1.groovy:6)
>>
>> do you mind copy pasting your script here so we can check it out (with 
>> whatever modifications you have).
>>
>> Based on what Dirk said, you might have to tweak it:
>>
>> "Paste it into the Script Console and see how it works. We don't use 
>> SonarCube ourselves, so it may work or not, but it should point you into the 
>> right direction."
>>
>>
>> On Tue, May 26, 2020 at 12:44 PM Vijay Gongle 
>> wrote:
>>
>>> All the jobs has similar configurations for SonarQube as posted in the
>>> above config.xml
>>> It throws the below error:
>>>
>>> groovy.lang.MissingMethodException: No signature of method: 
>>> hudson.maven.MavenModule.getBuildWrappersList() is applicable for argument 
>>> types: () values: []
>>> at 
>>> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
>>> at 
>>> org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49)
>>> at 
>>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
>>> at 
>>> hudson.model.BuildableItemWithBuildWrappers$getBuildWrappersList.call(Unknown
>>>  Source)
>>> at Script1$_run_closure1.doCall(Script1.groovy:10)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at 
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>> at 
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:498)
>>> at 
>>> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
>>> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>>> at 
>>> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
>>> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
>>> at groovy.lang.Closure.call(Closure.java:414)
>>> at groovy.lang.Closure.call(Closure.java:430)
>>> at 
>>> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
>>> at 
>>> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
>>> at 
>>> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2066)
>>> at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
>>> at 
>>> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
>>> at 
>>> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
>>> at 
>>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
>>> at 
>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
>>> at 
>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
>>> at Script1.run(Script1.groovy:6)
>>> at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
>>> at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
>>> at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
>>> at 
>>> hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:142)
>>> at 
>>> hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:114)
>>> at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
>>> at 
>>> hudson.util.RemotingDiagnostics.executeGroovy(RemotingDiagnostics.java:111)
>>> at jenkins.model.Jenkins._doScript(Jenkins.java:4381)
>>> at jenkins.model.Jenkins.doScript(Jenkins.java:4352)
>>> at 

Re: How to get a list of jobs that are integrated with SonarQube

2020-05-26 Thread Vijay Gongle
Ya sure, I haven't tweaked it honestly as I'm not aware of Groovy. So I
have pasted the below script provided by Drik.

import hudson.model.*
import hudson.plugins.sonar.*
import jenkins.model.*

// Iterate over all jobs
Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
  def fName = job.getFullName()

  // Iterate over all build wrappers
  for (wrapper in job.getBuildWrappersList()) {
  if (wrapper instanceof SonarBuildWrapper) {
  println(fName + ' has SonarQube configuration.')
  }
  }
}
println('Done.')


Thanks

On Tue, May 26, 2020 at 1:52 PM Jan Monterrubio 
wrote:

>   at Script1.run(Script1.groovy:6)
>
> do you mind copy pasting your script here so we can check it out (with 
> whatever modifications you have).
>
> Based on what Dirk said, you might have to tweak it:
>
> "Paste it into the Script Console and see how it works. We don't use 
> SonarCube ourselves, so it may work or not, but it should point you into the 
> right direction."
>
>
> On Tue, May 26, 2020 at 12:44 PM Vijay Gongle  wrote:
>
>> All the jobs has similar configurations for SonarQube as posted in the
>> above config.xml
>> It throws the below error:
>>
>> groovy.lang.MissingMethodException: No signature of method: 
>> hudson.maven.MavenModule.getBuildWrappersList() is applicable for argument 
>> types: () values: []
>>  at 
>> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
>>  at 
>> org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49)
>>  at 
>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
>>  at 
>> hudson.model.BuildableItemWithBuildWrappers$getBuildWrappersList.call(Unknown
>>  Source)
>>  at Script1$_run_closure1.doCall(Script1.groovy:10)
>>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>  at 
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>  at 
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>  at java.lang.reflect.Method.invoke(Method.java:498)
>>  at 
>> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
>>  at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>>  at 
>> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
>>  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
>>  at groovy.lang.Closure.call(Closure.java:414)
>>  at groovy.lang.Closure.call(Closure.java:430)
>>  at 
>> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
>>  at 
>> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
>>  at 
>> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2066)
>>  at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
>>  at 
>> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
>>  at 
>> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
>>  at 
>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
>>  at 
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
>>  at 
>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
>>  at Script1.run(Script1.groovy:6)
>>  at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
>>  at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
>>  at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
>>  at 
>> hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:142)
>>  at 
>> hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:114)
>>  at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
>>  at 
>> hudson.util.RemotingDiagnostics.executeGroovy(RemotingDiagnostics.java:111)
>>  at jenkins.model.Jenkins._doScript(Jenkins.java:4381)
>>  at jenkins.model.Jenkins.doScript(Jenkins.java:4352)
>>  at 
>> java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
>>  at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
>>  at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
>>  at 
>> org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
>>  at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
>>  at 
>> org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
>>  at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734)
>>  at org.kohsuke.stapler.Stapler.invoke(Stapler.java:864)
>>  at org.kohsuke.stapler.Stapler.invoke(Stapler.java:668)
>>  at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
>>  at 

Re: How to get a list of jobs that are integrated with SonarQube

2020-05-26 Thread Jan Monterrubio
at Script1.run(Script1.groovy:6)

do you mind copy pasting your script here so we can check it out (with
whatever modifications you have).

Based on what Dirk said, you might have to tweak it:

"Paste it into the Script Console and see how it works. We don't use
SonarCube ourselves, so it may work or not, but it should point you
into the right direction."


On Tue, May 26, 2020 at 12:44 PM Vijay Gongle  wrote:

> All the jobs has similar configurations for SonarQube as posted in the
> above config.xml
> It throws the below error:
>
> groovy.lang.MissingMethodException: No signature of method: 
> hudson.maven.MavenModule.getBuildWrappersList() is applicable for argument 
> types: () values: []
>   at 
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
>   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49)
>   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
>   at 
> hudson.model.BuildableItemWithBuildWrappers$getBuildWrappersList.call(Unknown 
> Source)
>   at Script1$_run_closure1.doCall(Script1.groovy:10)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
>   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
>   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
>   at groovy.lang.Closure.call(Closure.java:414)
>   at groovy.lang.Closure.call(Closure.java:430)
>   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
>   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
>   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2066)
>   at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
>   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
>   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
>   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
>   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
>   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
>   at Script1.run(Script1.groovy:6)
>   at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
>   at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
>   at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
>   at 
> hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:142)
>   at 
> hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:114)
>   at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
>   at 
> hudson.util.RemotingDiagnostics.executeGroovy(RemotingDiagnostics.java:111)
>   at jenkins.model.Jenkins._doScript(Jenkins.java:4381)
>   at jenkins.model.Jenkins.doScript(Jenkins.java:4352)
>   at 
> java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
>   at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
>   at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
>   at 
> org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
>   at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
>   at 
> org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
>   at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734)
>   at org.kohsuke.stapler.Stapler.invoke(Stapler.java:864)
>   at org.kohsuke.stapler.Stapler.invoke(Stapler.java:668)
>   at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
>   at 
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
>   at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
>   at 
> hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
>   at 
> org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:225)
>   at 
> hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
>   at 
> io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)
>   at 
> 

Re: How to get a list of jobs that are integrated with SonarQube

2020-05-26 Thread Vijay Gongle
All the jobs has similar configurations for SonarQube as posted in the
above config.xml
It throws the below error:

groovy.lang.MissingMethodException: No signature of method:
hudson.maven.MavenModule.getBuildWrappersList() is applicable for
argument types: () values: []
at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
at 
org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49)
at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at 
hudson.model.BuildableItemWithBuildWrappers$getBuildWrappersList.call(Unknown
Source)
at Script1$_run_closure1.doCall(Script1.groovy:10)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at 
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at 
org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at 
org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
at 
org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
at 
org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2066)
at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
at 
org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at 
org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at Script1.run(Script1.groovy:6)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
at 
hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:142)
at 
hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:114)
at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
at 
hudson.util.RemotingDiagnostics.executeGroovy(RemotingDiagnostics.java:111)
at jenkins.model.Jenkins._doScript(Jenkins.java:4381)
at jenkins.model.Jenkins.doScript(Jenkins.java:4352)
at 
java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
at 
org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
at 
org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:864)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:668)
at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at 
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at 
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
at 
hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
at 
org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:225)
at 
hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at 
io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)
at 
hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at 
io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:61)
at 
hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at 
com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:47)
at 
hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at 

Re: How to get a list of jobs that are integrated with SonarQube

2020-05-26 Thread Jan Monterrubio
Looks like the script died after some job, can you print it’s name and
check it’s config? Maybe we need to add a null check before we try to call
getBuildWrapperList or the config type is doffeeent!

On Tue, May 26, 2020 at 11:51 Vijay Gongle  wrote:

> Thank you Drik/Jan.
> I ran the above script and I get the below result with two of the job
> names which has SonarQube configurations. But I'm sure there are even more.
>
> Result
>
> * has SonarQube configuration.
> * has SonarQube configuration.
>
> groovy.lang.MissingMethodException: No signature of method: 
> hudson.maven.MavenModule.getBuildWrappersList() is applicable for argument 
> types: () values: []
>   at 
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
>   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49)
>   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
>   at 
> hudson.model.BuildableItemWithBuildWrappers$getBuildWrappersList.call(Unknown 
> Source)
>   at Script1$_run_closure1.doCall(Script1.groovy:10)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
>   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
>   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
>   at groovy.lang.Closure.call(Closure.java:414)
>   at groovy.lang.Closure.call(Closure.java:430)
>   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
>   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
>   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2066)
>   at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
>   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
>   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
>   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
>   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
>   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
>   at Script1.run(Script1.groovy:6)
>   at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
>   at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
>   at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
>   at 
> hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:142)
>   at 
> hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:114)
>   at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
>   at 
> hudson.util.RemotingDiagnostics.executeGroovy(RemotingDiagnostics.java:111)
>   at jenkins.model.Jenkins._doScript(Jenkins.java:4381)
>   at jenkins.model.Jenkins.doScript(Jenkins.java:4352)
>   at 
> java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
>   at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
>   at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
>   at 
> org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
>   at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
>   at 
> org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
>   at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734)
>   at org.kohsuke.stapler.Stapler.invoke(Stapler.java:864)
>   at org.kohsuke.stapler.Stapler.invoke(Stapler.java:668)
>   at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
>   at 
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
>   at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
>   at 
> hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
>   at 
> org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:225)
>   at 
> hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
>   at 
> io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)
>   at 
> 

Re: How to get a list of jobs that are integrated with SonarQube

2020-05-26 Thread Vijay Gongle
Thank you Drik/Jan.
I ran the above script and I get the below result with two of the job names
which has SonarQube configurations. But I'm sure there are even more.

Result

* has SonarQube configuration.
* has SonarQube configuration.

groovy.lang.MissingMethodException: No signature of method:
hudson.maven.MavenModule.getBuildWrappersList() is applicable for
argument types: () values: []
at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
at 
org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49)
at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at 
hudson.model.BuildableItemWithBuildWrappers$getBuildWrappersList.call(Unknown
Source)
at Script1$_run_closure1.doCall(Script1.groovy:10)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at 
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at 
org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at 
org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
at 
org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
at 
org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2066)
at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
at 
org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at 
org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at Script1.run(Script1.groovy:6)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
at 
hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:142)
at 
hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:114)
at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
at 
hudson.util.RemotingDiagnostics.executeGroovy(RemotingDiagnostics.java:111)
at jenkins.model.Jenkins._doScript(Jenkins.java:4381)
at jenkins.model.Jenkins.doScript(Jenkins.java:4352)
at 
java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
at 
org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
at 
org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:864)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:668)
at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at 
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at 
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
at 
hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
at 
org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:225)
at 
hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at 
io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)
at 
hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at 
io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:61)
at 
hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at 
com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:47)
at 

Re: How to get a list of jobs that are integrated with SonarQube

2020-05-26 Thread Jan Monterrubio
Thanks a lot Dirk, I was trying to write this on notepad without the
scriptconsole (we also don't use sonar and i didn't have an instance
available on my personal machine)

On Tue, May 26, 2020 at 6:31 AM 'Dirk Heinrichs' via Jenkins Users <
jenkinsci-users@googlegroups.com> wrote:

> Am Samstag, den 23.05.2020, 18:43 -0700 schrieb Vijay Gongle:
>
> We have plenty of Jenkins job and most of them are running with SonarQube
> for analysis.
>
> How to find out; how many such jobs are running with SonarQube ?
>
>
> This is derived from a script I've used in the past to modify all
> Artifactory wrappers in all our jobs:
>
> import hudson.model.*
> import hudson.plugins.sonar.*
> import jenkins.model.*
>
> // Iterate over all jobs
> Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
>   def fName = job.getFullName()
>
>   // Iterate over all build wrappers
>   for (wrapper in job.getBuildWrappersList()) {
>   if (wrapper instanceof SonarBuildWrapper) {
>   println(fName + ' has SonarQube configuration.')
>   }
>   }
> }
> println('Done.')
>
>
> Paste it into the Script Console and see how it works. We don't use
> SonarCube ourselves, so it may work or not, but it should point you into
> the right direction.
>
> HTH...
>
> Dirk
>
> --
>
> *Dirk Heinrichs*
> Senior Systems Engineer, Delivery Pipeline
> OpenText ™ Discovery | Recommind
> *Phone*: +49 2226 15966 18
> *Email*: dhein...@opentext.com
> *Website*: www.recommind.de
> Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
> Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan,
> Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
> Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
> irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
> vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
> Weitergabe dieser Mail sind nicht gestattet.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/53911cd297f0aa4bcedeac64a755e8a6aaeddcd4.camel%40opentext.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CADgiF9JujcuDk%2BU1kni9TCYUwgNSDVteAJnQNQ3eeNcfNiAp2Q%40mail.gmail.com.


Re: How to get a list of jobs that are integrated with SonarQube

2020-05-26 Thread 'Dirk Heinrichs' via Jenkins Users
Am Samstag, den 23.05.2020, 18:43 -0700 schrieb Vijay Gongle:
> We have plenty of Jenkins job and most of them are running with
> SonarQube for analysis. 
> 
> 
> 
> How to find out; how many such jobs are running with SonarQube ?

This is derived from a script I've used in the past to modify all
Artifactory wrappers in all our jobs:
import hudson.model.*
import hudson.plugins.sonar.*
import
jenkins.model.*


// Iterate over all jobs
Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
  def fName = job.getFullName()


  // Iterate over all build wrappers
  for (wrapper in job.getBuildWrappersList()) {
if (wrapper instanceof SonarBuildWrapper) {
  println(fName + ' has SonarQube configuration.')
}
  }
}
println('Done.')

Paste it into the Script Console and see how it works. We don't use
SonarCube ourselves, so it may work or not, but it should point you
into the right direction.
HTH...
Dirk-- 
Dirk HeinrichsSenior Systems Engineer, Delivery PipelineOpenText ™ Discovery | 
RecommindPhone: +49 2226 15966 18Email: dheinric@opentext.comWebsite: 
www.recommind.deRecommind GmbH, Von-Liebig-Straße 1, 53359 
RheinbachVertretungsberechtigte Geschäftsführer Gordon Davies, Madhu
Ranganathan, Christian Waida, Registergericht Amtsgericht Bonn,
Registernummer HRB 10646This e-mail may contain confidential and/or privileged 
information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure or distribution of the material in
this e-mail is strictly forbiddenDiese E-Mail enthält vertrauliche und/oder 
rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-
Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser Mail sind nicht gestattet.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/53911cd297f0aa4bcedeac64a755e8a6aaeddcd4.camel%40opentext.com.


signature.asc
Description: This is a digitally signed message part


Re: How to get a list of jobs that are integrated with SonarQube

2020-05-25 Thread Jan Monterrubio
Can you post the config xml for one of the jobs? Hitting the config.xml
should let us see what props there are.

On Sun, May 24, 2020 at 11:12 Vijay Gongle  wrote:

> Thank you for responding.
> Can you help me completing the query;
>
> I would like to fetch the jobs which has the check mark "Prepare SonarQube
> Scanner environment" in Build Environment as shown below:
>
> [image: image.png]
>
> Thanks,
> Vijay
>
>
> On Sat, May 23, 2020 at 11:09 PM Jan Monterrubio 
> wrote:
>
>> You could iterate over the list of jobs and get the configuration traits
>> for them, and check if they have sonar cube, something like
>>
>> Jenkins.getInstance().items.each { it ->
>>
>> it.configuration?.steps // not sure what XML type the sonar cube step is,
>> if it has a step
>> }
>>
>>
>> On Sat, May 23, 2020 at 8:43 PM Vijay Gongle  wrote:
>>
>>> We have plenty of Jenkins job and most of them are running with
>>> SonarQube for analysis.
>>>
>>> How to find out; how many such jobs are running with SonarQube ?
>>>
>>> Thanks
>>> Vijay
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to jenkinsci-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jenkinsci-users/d82c76df-ce71-45c3-8449-79a1b1f19bac%40googlegroups.com
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to jenkinsci-users+unsubscr...@googlegroups.com.
>>
> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/CADgiF9%2BG%3Df7AkSfE2v3xmQRUDcJvkThxNQ%2BL4nspcMsHrvhq5w%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/CAMrMyD%3Dx3_noyFk9%3D2LaboCoSUdiwwVhRopRw9d80yZ46bcJGQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CADgiF9L6-4_bqHOmqB8bTtTNF%3DdbHPKFs%3Drjmm_r5Px%3Dy%3D5DSw%40mail.gmail.com.


Re: How to get a list of jobs that are integrated with SonarQube

2020-05-24 Thread Vijay Gongle
Thank you for responding.
Can you help me completing the query;

I would like to fetch the jobs which has the check mark "Prepare SonarQube
Scanner environment" in Build Environment as shown below:

[image: image.png]

Thanks,
Vijay


On Sat, May 23, 2020 at 11:09 PM Jan Monterrubio 
wrote:

> You could iterate over the list of jobs and get the configuration traits
> for them, and check if they have sonar cube, something like
>
> Jenkins.getInstance().items.each { it ->
>
> it.configuration?.steps // not sure what XML type the sonar cube step is,
> if it has a step
> }
>
>
> On Sat, May 23, 2020 at 8:43 PM Vijay Gongle  wrote:
>
>> We have plenty of Jenkins job and most of them are running with SonarQube
>> for analysis.
>>
>> How to find out; how many such jobs are running with SonarQube ?
>>
>> Thanks
>> Vijay
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to jenkinsci-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/d82c76df-ce71-45c3-8449-79a1b1f19bac%40googlegroups.com
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/CADgiF9%2BG%3Df7AkSfE2v3xmQRUDcJvkThxNQ%2BL4nspcMsHrvhq5w%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAMrMyD%3Dx3_noyFk9%3D2LaboCoSUdiwwVhRopRw9d80yZ46bcJGQ%40mail.gmail.com.


Re: How to get a list of jobs that are integrated with SonarQube

2020-05-23 Thread Jan Monterrubio
You could iterate over the list of jobs and get the configuration traits
for them, and check if they have sonar cube, something like

Jenkins.getInstance().items.each { it ->

it.configuration?.steps // not sure what XML type the sonar cube step is,
if it has a step
}


On Sat, May 23, 2020 at 8:43 PM Vijay Gongle  wrote:

> We have plenty of Jenkins job and most of them are running with SonarQube
> for analysis.
>
> How to find out; how many such jobs are running with SonarQube ?
>
> Thanks
> Vijay
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/d82c76df-ce71-45c3-8449-79a1b1f19bac%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CADgiF9%2BG%3Df7AkSfE2v3xmQRUDcJvkThxNQ%2BL4nspcMsHrvhq5w%40mail.gmail.com.