How to integrate an angular project's Jenkinsfile with Sonarqube

8 views
Skip to first unread message

Priyal George

unread,
Mar 1, 2019, 10:47:37 AM3/1/19
to Jenkins Users
I have posted the same in Stackoverflow - https://stackoverflow.com/questions/54946420/how-to-integrate-an-angular-projects-jenkinsfile-with-sonarqube

I have an angularjs project. the project has a Jenkinsfile(declarative pipeline) which can build the jenkinsjob when a push is done. I'm trying to include a sonarqube action here for static scan. Searched a lot for angular projects with my scenario. but most of the examples i checked have pom.xml file(cause they were either java related projects). 

I have written a sonar-projects.properties in root and added all necessary item: 

    sonar.projectKey=apols:webproject
    sonar.projectName=webproject
    sonar.projectVersion=1.0.0
    sonar.projectDescription=Static analysis for the AppName
    sonar.sources=www
    sonar.exclusions=**/node_modules/**,**/*.spec.ts,**/dist/**,**/docs/**,**/*.js,**/coverage/**
    sonar.tests=www 
    sonar.test.inclusions=**/*.spec.ts
    sonar.ts.tslint.configPath=tslint.json
    sonar.javascript.lcov.reportPaths=coverage/lcov.info
    sonar.ts.coverage.lcovReportPath=coverage/lcov.info

 

My Jenkinsfile's sonar scan portion - 

    stage('Sonarqube') {
    steps {
    container('maven') {
        script {
       withSonarQubeEnv('SonarQube') {
                      sh 'mvn clean package sonar:sonar'
       }
       timeout(time: 10, unit: 'MINUTES') {
            waitForQualityGate abortPipeline: true
       }
                }
    }
    }
    }

As you can see i'm using the maven container in jenkins. 

When the jenkins job runs, when it executes this line in Jenkinsfile - `sh 'mvn clean package sonar:sonar'`  , it checks for the pom.xml file and fails. So how can i point this to my sonar-projects.properties
Please help
Reply all
Reply to author
Forward
0 new messages