Hi All, I’m having trouble with a Sonar Maven 3 task in our nightly build plan in Bamboo.
In the "Default plan configuration", I have a "Default Job" in the "Default Stage". In the "Default Job" there are 3 tasks:
-Source Code Checkout
-Maven 3.x (Build)
-Sonar Maven 3
Now, I created an additional "Sonar Maven 3" task with the same settings as the already existing task. The 1st task (created years ago) executes fine. The 2nd task with the exact same settings as task 1 doesn't! I disabled the 1st task that runs fine and let the 2nd one run during the plan run, but it fails! The error message.. I will come back to it. My question is why does the exact same task fail?!
I see a difference in the build logs of the two identical tasks, which I think is the reason why the 2nd task fails! I hope you can explain why and how to solve it.
Log task 1:
simple 12-Dec-2023 16:49:31 Starting task 'Sonar' of type 'ch.mibex.bamboo.sonar4bamboo:sonar4bamboo.maven3task'
command 12-Dec-2023 16:49:31 Substituting password variable: ${bamboo.sonar.token.passphrase}
simple 12-Dec-2023 16:49:31
simple 12-Dec-2023 16:49:31 SONAR4BAMBOO: Going to use executable home /usr/local/apache-maven-3.8
command 12-Dec-2023 16:49:31 Beginning to execute external process for build 'Com - flip - Default Job #628 (TRCK-NIGHT-JOB1-628)'\n ... running command line: \n/usr/local/apache-maven-3.8/bin/mvn sonar:sonar -Dsonar.projectKey=com.domain.flip:flip -Dsonar.projectName=com.domain.flip:flip -Dsonar.host.url=https://sonar.compdomain.com -Dsonar.login=****** ... in: /var/atlassian/bamboo-agent-home/xml-data/build-dir/TRCK-NIGHT-JOB1\n
Log task 2:
simple 12-Dec-2023 16:16:06 Starting task 'sonar_marc' of type 'ch.mibex.bamboo.sonar4bamboo:sonar4bamboo.maven3task'
command 12-Dec-2023 16:16:06 Substituting password variable: ${bamboo.sonar.token.passphrase}
simple 12-Dec-2023 16:16:06
simple 12-Dec-2023 16:16:06 SONAR4BAMBOO: Will use develop as sonar.branch.name.
simple 12-Dec-2023 16:16:06 SONAR4BAMBOO: Going to use executable home /usr/local/apache-maven-3.8
command 12-Dec-2023 16:16:06 Beginning to execute external process for build 'CommonTrack - flip-nightly - Default Job #627 (TRCK-NIGHT-JOB1-627)'\n ... running command line: \n/usr/local/apache-maven-3.8/bin/mvn sonar:sonar -Dsonar.branch.name=develop -Dsonar.host.url=https://sonar.compdomain.com -Dsonar.login=****** ... in: /var/atlassian/bamboo-agent-home/xml-data/build-dir/TRCK-NIGHT-JOB1\n
Why in task 2 at "Beginning to execute external process" it is eventually NOT using command "mvn sonar:sonar -Dsonar.projectKey=com.domain.flip:flip" as in task 1, but is it using "mvn sonar:sonar -Dsonar.branch.name=develop"?!?
I believe if task 2 would also use the "-Dsonar.projectKey=com.domain.flip:flip" parameter it will run successful! Any idea where I can configure this?
The use of Dsonar.branch.name=develop is evenutally causing the error, because this parameter is not allowed in Sonar Community Edition.
The error in the log of the buildplan with task nr 2 is:
build 12-Dec-2023 16:16:11 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project flip: Validation of project reactor failed:
build 12-Dec-2023 16:16:11 [ERROR] o To use the property "sonar.branch.name" and analyze branches, Developer Edition or above is required. See https://redirect.sonarsource.com/doc/branches.html for more information.
An important note about the 2nd task I created: I get the same error with multiple applications when creating a 2nd task. Also, when my colleagues create this 2nd task they get the same error, so apparently it's not a permissions issue (unless it's on group level)!! Even if I remove the 1st task and only have the 2nd exist and run I get the same error.
Currently it is blocking my nightly build for application "flip-core". I don't have a 'task 1' anymore and I created a new "2nd" task that now fails with the details as mentioned before in the log.
Who can help to solve why task 2 is running different and is using parameter "-Dsonar.branch.name=develop" instead of "mvn sonar:sonar -Dsonar.projectKey=com.domain.flip:flip"?
Hi @Marciano Wong-Swie-San and welcome to the Atlassian community!
Looking at your problem description, I think task 2 is using a different server configuration in the task field "Choose a server for this task (required)". Is that possible?
Because that could be the reason why it is configuring the branch name with "develop", while task 1 is not.
I guess you are on a Bamboo plan branch called "develop"?
Thanks,
Michael (app vendor)
Hi @Michael Rüegg _Mibex Software_
Thank you for welcoming me. And, thank you for looking into this and replying!
Hmm.. I'm not seeing any task field with "Choose a server for this task (required)". I'm mostly having default settings in the task:
And these settings are similar as task 1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're very welcome, and thanks for your feedback.
For the field "Choose a server for this task", do you use "community" for both tasks 1+2?
Best regards,
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your feedback.
Would you mind creating a support ticket at https://support.mibexsoftware.com so that you can share the task logs? That would help us a lot.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.