Is there a way to scan multiple repos simultaneously instead of doing one by one

scanner
jenkins

(Jose Alvarez) #1

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) 6.7.4.38452
  • what are you trying to achieve- i want to scan multiple repositories at the same time with one jenkins job so i dont have to write a new jenkins job for each repo
  • what have you tried so far to achieve this- nothing so far as i am not sure it is even possible

(Nicolas Bontoux) #2

Hi Jose,

One thing for sure is that for the time being one SonarQube Scanner execution corresponds to one and only one project analysis.

I’m not a Jenkins guru but I don’t think that necessarily means you need to replicate as many Jenkins job as projects. Surely you can use some generic job, and then leverage environment variables with the Scanner for Jenkins to do things in a generic manner.


(Jose Alvarez) #3

Hi Nicolas,
Im not sure i understand how to proceed however I did add the checkbox for injecting env. variables but im not sure how that will allow me to tell the scanner to jump to the next repo when its done scanning the first in the github organization automatically?
thx,
jose


(Nicolas Bontoux) #4

Hi Jose,

You might want to share more details about your Jenkins setup/workflow, that might help others share their experience/setup too. My point at this stage is simply to confirm that yes, analyzing multiple repositories will definitely require multiple scanner executions, and you can then use scripts/variables (or other Jenkins techniques I’m not aware of) to have the right parameters passed to each scanner execution.


(Jose Alvarez) #5

Basically,
I dont want to have to create a new jenkins job for every repository… but it seems like that would not be possilbe… I have hundreds of repos and i really dont want to have to make 400 plus jenkins jobs to scan each one…
thx,
jose


(Xavier Bourguignon) #6

Hi Jose,

Have a look at this Jenkins plugin: Job DSL. This will give you the ability to code the generation of your Jenkins jobs.

And this series of blog post could also help you: https://marcesher.com/2016/06/08/jenkins-as-code-creating-jenkins-jobs-with-text-not-clicks/


(Jose Alvarez) #7

Xavier,
Thanks for the input!.. ill get back to you on this if i run into any issues…
thx,
jose