Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

How to integrate an angular project's Jenkinsfile with Sonarqube #66

Closed
PiyalGeorge opened this issue Mar 2, 2019 · 1 comment
Closed

Comments

@PiyalGeorge
Copy link

Hi, I see you are working in sonarqube. can you please help me on this-

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 .

I'm not using maven for the project. I know we can set sonar-scanner from jenkins-job configuration. But In our work the client doesn't provide that from their side. But we can do anything from coding side. like in above case, the 'maven' container used is from jenkins.yaml file. So is it possible to have the 'sonar-scanner' container in jenkins.yaml file so that i can use it in jenkinsfile?

Please help

@bellingard
Copy link
Owner

bellingard commented Mar 5, 2019

This has nothing to do with this project (which BTW is a personal project). Please go and ask the question on the dedicated forums: https://community.sonarsource.com/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants