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

Possibility to cloning the full repository #221

Closed
3 of 4 tasks
frami opened this issue Aug 26, 2019 · 8 comments
Closed
3 of 4 tasks

Possibility to cloning the full repository #221

frami opened this issue Aug 26, 2019 · 8 comments

Comments

@frami
Copy link

frami commented Aug 26, 2019

  • Jenkins version: 2.164.2

  • Plugin version: 2.44

  • Bitbucket cloud

  • Bitbucket server and version: 6.2.0

Description

When I use the bitbucket-branch-source plugin with the sonarqube branch analysis, the information about the changed lines is missing. Sonarqube shows the following warning: " [WARNING] Could not find ref: master in refs/heads or refs/remotes/origin"

In this comment (https://community.sonarsource.com/t/code-coverage-on-branches-does-not-break-quality-gate/9042/30), a member of sonarqube guess, that not the whole repository is cloned, only a single branch. This would explain, why the information of the changed lines is missing.

Is this true? If yes, would it possible to add a option to clone the whole repository?

Tanks in advance!

@jetersen
Copy link
Member

jetersen commented Aug 26, 2019

You can modify the git clone via adding a trait / behavior

@frami
Copy link
Author

frami commented Aug 26, 2019

Thank you for the answer. I already verified at all behaviors. Non of them solved the problem.

@reitzmichnicht
Copy link

We see the same problem with SonarQube and Bitbucket Jenkins Plugin. No trait or behavior I tried solved it.

@jetersen
Copy link
Member

If you add the advanced git clone?

@reitzmichnicht
Copy link

Advanced checkout behaviours provides only a timeout setting
Advanced clone behaviours provides shallow clone, fetch tags and timeout.

Which setting do you refer to?

@jetersen
Copy link
Member

This is not really something we can solve here, it should be solved in the git-plugin

@frami
Copy link
Author

frami commented Aug 26, 2019

I'm not sure, if it is a git-plugin issue. When I use the normal "Multibranch Pipeline" plugin, everything works. I can see now a difference between the git fetch used by the "Bitbucket Team/Project" and the "Multibranch** Pipeline" plugin.

Output from "Multibranch Pipeline"

git fetch --no-tags --force --progress https://git.ims.ch:8443/scm/bh/bh-product.git +refs/heads/:refs/remotes/origin/
git config core.sparsecheckout # timeout=10
git checkout -f 3f89bd9b101cdc2dd46525c17deaf6cbb40aaf03

Output from "Bitbucket Team/Project"

git fetch --tags --force --progress https://git.ims.ch:8443/scm/BH/bh-product.git +refs/heads/feature/Sonar_Test-MFr:refs/remotes/origin/feature/Sonar_Test-MFr
git config core.sparsecheckout # timeout=10
git checkout -f 3f89bd9b101cdc2dd46525c17deaf6cbb40aaf03

In the git fetch of the "Bitbucket Team/Project" plugin, the "+refs/heads/:refs/remotes/origin/" is too specific. Because of that, I added the behavior "Specify ref specs" with the value "+refs/heads/:refs/remotes/@{remote}/".
Now the sonarqube branch analysis works correct.

@jetersen
Copy link
Member

jetersen commented Aug 26, 2019

So there is a behavior to add ref specs 😓
So problem solved.
The reason bitbucket does a specific ref head is to avoid downloading unnecessary bits.
This is by design.

@frami frami closed this as completed Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants