Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bitbucket Cloud] PR decoration #227

Closed
lazam opened this issue Aug 10, 2020 · 5 comments
Closed

[Bitbucket Cloud] PR decoration #227

lazam opened this issue Aug 10, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@lazam
Copy link

lazam commented Aug 10, 2020

Describe the issue
This is more of a question than a bug. So I'm using Bitbucket Cloud for our repository, the PR analysis can already be seen in the project in Sonarqube.

Under Administration -> General settings -> Pull Request decoration. I choose Bitbucket server since it's the only option for Bitbucket. I already tried both:

From the logs, it's still expecting a Bitbucket server and not Cloud but it still returrn a Status=SUCCESS

2020.08.10 11:33:12 ERROR ce[AXPYJTXVhPOkUNh][c.g.m.s.p.c.p.b.c.BitbucketServerClient] Could not determine Bitbucket Server version
java.net.ProtocolException: Too many follow-up requests: 21
2020.08.10 11:33:12 WARN ce[AXPYJTXVhPOkUNh][c.g.m.s.p.c.p.b.BitbucketPullRequestDecorator] Your Bitbucket instance does not support the Code Insights API.
2020.08.10 11:33:12 INFO ce[AXPYJTXVhPOkUNh][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request Decoration | status=SUCCESS | time=6374ms

Software Versions

  • SonarQube Version: 8.1.0.31237
  • Plugin Version: 1.4.0

The sonar context can see the following information without an issue:

sonar.projectKey=repo.test:test-lib
sonar.projectName=test-lib
sonar.projectVersion=1.32.0-SNAPSHOT
sonar.pullrequest.base=development
sonar.pullrequest.branch=app-no-test
sonar.pullrequest.key=7
sonar.scanner.app=ScannerMaven
sonar.scanner.appVersion=3.7.0.1746/3.6.3

Maven command

mvn clean install sonar:sonar -B -DskipTests -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_BUILD_TOKEN -Dsonar.pullrequest.branch=$BITBUCKET_BRANCH -Dsonar.pullrequest.key=$BITBUCKET_PR_ID -Dsonar.pullrequest.base=$BITBUCKET_PR_DESTINATION_BRANCH

I also tried to remove the sonar.pullrequest.branch but it results to a background task failure.

Is there a way to specify that it's a Bitbucket Cloud? I also checked Sonarqube documentation but it only has the information for Bitbucket server. There's an open ticket in #209 that uses Bitbucket Cloud.

Thank you.

@lazam lazam added the bug Something isn't working label Aug 10, 2020
@rhaex
Copy link

rhaex commented Aug 13, 2020

I am having the same issue as well.
The official documentation only talks about BitBucket server, and the wiki page for this plugin in this repo also is not very clear on what to enter, it only points to the official documentation.

I have PR analyze correctly working, but when it tries to decorate I get the same error as reported in this ticket.

I configured in the SonarQube project to use the correct 'project key' and 'repository slug'. I know these are correct because manual calls to the BitBucket API using these work.

I configured in the SonarQube server settings a 'Pull Request Decoration configurator' for BitBucket Server (as there is no cloud available). Personal Access token is correct (also verified manually).

For BitBucket Server URL I am not sure what to enter, currently I have 'https://bitbucket.org/my-team/'.
Is this correct or should it be 'https://bitbucket.org/'?

@rhaex
Copy link

rhaex commented Aug 13, 2020

After checking the code, I came across the original pull-request that added this feature.
In there is a comment by the author that specifies what values we should use: #185 (comment).

Is it possible that this information is added to the readme file? As the official documentation for Sonarqube does not contain it, as they don't support cloud.

@josefschabasser
Copy link

josefschabasser commented Aug 13, 2020

First run echo -n USERNAME:APP_PASSWORD | base64.

Go to Administration/General Settings/ALM Integrations and select Bitbucket.
Enter https://api.bitbucket.org as Bitbucket Server URL and the output of aforementioned command as PAT.

Now go to Projects/YOUR_EXISTING_PROJECT/Project Settings/General Settings/Pull Request Decoration.
Enter your team name as project key and the repo slug.

EDIT: Import of bitbucket repos does not work with SQ 8.2 and plugin 1.4.1 (built today). A red error message appears on the top stating unknown url /api/alm_integrations/check_pa.

@lazam
Copy link
Author

lazam commented Aug 18, 2020

Thanks for the comment, @josefschabasser . The details you provided worked with Bitbucket Cloud.

I'm closing this ticket since it's already been resolved, and I'm not sure where to put his comment in the documentation but his comment will surely help a lot.

@lazam lazam closed this as completed Aug 18, 2020
@ivayloc
Copy link

ivayloc commented Jan 16, 2021

what do you mean by team name, I am using BitBucket cloud?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants