Analysis runs on Jenkins master, not slave node


(Teswar) #1

I’m using SonarQube 7.6 developer edition and build process gradle using. In Jenkinsfile created Sonarqube analysis stage and ran
“gradlew sonarqube” command.
When I see the log files the sonarqube stage is runing on Jenkins master instead of Jenkins slave node.
Can some one help me on this. Is the sonarqube anaysis will run on Jenkins master only or Do I need to add any steps.
Thanks in advance.


(Teswar) #2

Can Anyone help me on this Please.


(Adam Gabryś) #3

In this file you described where SonarScanner for Gradle is executed. If you need to execute it on slave, then you have to configure it.

Read how to configure agent here:


(Teswar) #4

Hi Adam,

I have already configured the agent but looks like SonarQube is not running on Slave node. It is running on Jenkins master


(Adam Gabryś) #5

Please paste your Jenkinsfile.


(Teswar) #6

pipeline{
agent{
label “$slaveNode”
}

stages{
	stage('Source Checkout') {
		
		steps{
			cleanWs()
			
		}
	}
	stage('Build'){
		script
	}//End stage
	stage('Test'){
		parallel{
			stage('Jacoco') {
				
			}//End stage - Jacoco
			stage('PIT') {
				steps {
					
			}//End stage - PIT	
		}//End parallel
	}//End stage - Test
	stage('SonarQube') {
		steps {
			
				bat "gradlew.bat  -Dsonar.branch.name=$branch sonarqube"             
			
		}	
	}//End stage - SonarQube

}


(Adam Gabryś) #7

Are any of your stages is executed on slave node?


(Teswar) #8

All the remaining stages are executing slave node except sonarqube stage.


(Adam Gabryś) #9

Are you able to create a Jenkinsfile which allows reproducing the error? For now I have now idea where is the problem.


(Teswar) #10

I didn’t get error means. The sonarqube stage with developer edition is showing java heap size error. For that I passed the parameter in sonarqube stage itself as -Dorg.jvmargs=Xmx2048m

stage(‘SonarQube’) {
steps {

				bat "gradlew.bat  -Dsonar.branch.name=$branch -Dorg.gradle.jvmargs=-Xmx2048m sonarqube           
			
		}	

	}//End stage - SonarQube

Is that correct way or Can you please suggest me.


(Adam Gabryś) #11

The problem which you described in the first post is:

Analysis runs on Jenkins master, not slave node […] Is the sonarqube anaysis will run on Jenkins master only or Do I need to add any steps.

I understood that your SonarQube stage is executed on incorrect node. Now you’ve described a completely different problem:

I don’t see any logs, server configuration etc. Without well described problem and necessary data, nobody will be able to help you.