Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,615
Community Members
 
Community Events
176
Community Groups

Sonar Gradle task fails with error "SONAR4BAMBOO: was not able to find a SonarQube result URL"

Edited

I have just installed the Sonar for Bamboo plugin, and have trouble getting it to work.

I have followed the steps on https://mibexsoftware.atlassian.net/wiki/spaces/MSS/pages/1339883529/Getting+started+with+Sonar+for+Bamboo to the best of my abilities, but when I try to run the build, the Sonar Gradle task fails with the following, not very descriptive reply:

15-May-2020 11:05:02 Starting task 'SonarQube' of type 'ch.mibex.bamboo.sonar4bamboo:sonar4bamboo.gradletask'
15-May-2020 11:05:02 SONAR4BAMBOO: No branch target found, will not configure sonar.branch.target.
15-May-2020 11:05:02
Beginning to execute external process for build 'Project - Module - Build and Unit tests #71 (PRO-MOD-JOB1-71)'
... running command line:
./gradlew sonarqube --info -Dsonar.host.url=http://localhost:9000 -Dsonar.login=****** -Dsonar.password=****** ... in: /var/atlassian/application-data/bamboo/xml-data/build-dir/PRO-MOD-JOB1
... using extra environment variables:

[Long list of environment variables]

15-May-2020 11:05:02 Failing task since return code of [./gradlew sonarqube --info -Dsonar.host.url=http://localhost:9000 -Dsonar.login=****** -Dsonar.password=****** was -1 while expected 0
15-May-2020 11:05:02 SONAR4BAMBOO: was not able to find a SonarQube result URL
15-May-2020 11:05:02 Finished task 'SonarQube' with result: Failed

My environment setup is that I have Bamboo and SonarQube running on the same server on different ports. SonarQube is running in a Docker Container that is accessible via port 9000, and I can successfully log in to its web interface, so I can say for sure that it's accessible.

However, I have no idea why the Sonar Gradle build step fails, primarily because apart from the above lines no error is generated, so I don't have any idea what could be wrong here.

Any advice on this would be greatly appreciated.

2 answers

1 accepted

0 votes
Answer accepted

I figured out what was missing. All the other build steps had a working subdirectory set, and once I set that to the same value for the Sonar Gradle step, it worked fine.

By the way, is there a way to globally set the working subdirectory for the entire build? This has happened so many times now with different steps, it's actually embarrassing that it wasn't the first thing I tried. =<,<=

Hi Kira,

Could you tell what did you write in working subdirectory  because i'm also getting this:

SONAR4BAMBOO: was not able to find a SonarQube result URL
Finished task 'SonarQube' with result: Failed

Well, that will probably not help you much, since it is just one word.

So I'll try to elaborate: We have a project structure that looks like this:

project
├module-a
├module-b
└module-c

The build for module-a has "module-a" written in the "working subdirectory" field of all its build steps, the build for module-b has "module-b" written in all of them, etc...

It's literally just "module-a", without any /, \, . or whatever

Hi,

The app fails when it tries to parse the build log for the result URL to be able to show a link to the SonarQube analysis results on the Bamboo build page. Do you see a message like

17:01:02.199 INFO  - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/MY-GRADLE-JOB1

in your build log? That is what the app is looking for, and otherwise it will fail with the above message. This could be due to the SonarQube analysis not being successful which I cannot see in your log excerpt.

Thanks,

Michael (app vendor)

Nope, the error was actually that the working subdirectory was not set correctly. It took me a while to figure this out, though, since the Sonar Gradle task did not display any indication of this in its log. The above messages were literally all the messages that Sonar Gradle gave me, so I just did not know what went wrong.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events