Jenkins, Sonarqube and Github Integration without Maven project

Dear All,
I want to perform static code analysis for my GitHub code .GitHub contains Yaml and Terraform codes .
Can I perform static code analysis using Jenkins, Sonaqube and GitHub without Maven project ?

I don’t want to use Maven, Gradle and Ant and I’m using Mac machine to do setup.
Please help me I’m new to Sonarqube.

Sonarqube version: SonarQube 7.7 for Mac
**Jenkins Version : **Jenkins 2.164.3 for Mac

Thanks & Regards
Ram

Hi Ram,

Welcome to SonarQube and to the community. You can certainly analyze without a Maven project, just use the ‘vanilla’ SonarQube Scanner. Your sticking point is going to be finding analyzers for your languages. I’m not aware of one for Terraform, however there is one for YAML. It’s not installed by default, so you’ll need to make sure you add it.

 
HTH,
Ann

1 Like

Hi G Ann Campbell,
Thanks for your humble reply .I’m able to do this using below code:

node {
  stage('SCM') {
    git 'https://github.com/foo/bar.git'
  }
  stage('SonarQube analysis') {
    // requires SonarScanner 2.8+
    def scannerHome = tool 'SonarScanner 2.8';
    withSonarQubeEnv('My SonarQube Server') {
      sh "${scannerHome}/bin/sonar-scanner"
    }
  }
}

But if I’ve more than one git repositories then how can I rearrange the above code.??
Please guide me I’m not able to get this since last 1 month.

Let say I’ve below git repositories:
1#https://github.com/rammady/awesome_project.git
2# https://github.com/rammady/maven-project.git
3# https://github.com/rammady/git-github.git
4# https://github.com/rammady/maven-project.git

Then how can I arrange the above scriptive pipeline to scan all above 4 git repositories.

Thanks & Regards
Ram

Hi Ram,

Check the very bottom of this page for a helpful example: https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-jenkins/

 
Ann

1 Like