Error 'WARN: Could not find ref: Develop in refs/heads or refs/remotes/origin' after updating to 7.6

After upgrading to SonarQube Develop 7.6 our SonarScanner runs in Jenkins no longer calculate code coverage. When looking at the Jenkins build logs I see the following new warning message, which I assume is related:

WARN: Could not find ref: Develop in refs/heads or refs/remotes/origin

These are the current versions of tools we are using.

  • SonarQube Developer Edition 7.6
  • SonarQube Scanner for Jenkins 2.8.1
  • SonarQube Scanner 3.3.0.1492
3 Likes

Hi,

I think the log line you’re reporting is unrelated to the (apparent) main complaint about code coverage. To be clear, SonarQube hasn’t calculated coverage for a very long time, and then only for Java. The log warning you cite sounds like it’s SCM-related.

 
Ann

As Ann said, the missing coverage and the warning looks unrelated.

This warning can happen during the analysis of a pull request. The consequence is that new code in the pull request may not be computed correctly. The resolution is to fetch the target branch before running analysis, for example git fetch origin Develop.

Thanks for the response and apologies for the confusion on the code coverage calculation. I will try the ‘fetch’ resolution and update if it works. I assumed it was related to SonarQube upgrade to 7.6 since the PR analysis worked before and that was our only environmental change.

I am facing same warning for of PR builds ( Bitbutket/Jenkins multibranch source) after upgrade from LTS 6, to LTS7. Please share the resolution if anyon able to clear it

Thanks

Have you tried my suggestion above?

i saw the suggestion, but still struggling on how to update our Jenkins Bitbucket branch source plugin to get rid of the warning

I’m not familiar with the Jenkins Bitbucket branch source plugin so I’m not sure what more we can do there. The goal is simple though: the base Git branch of the analysis must be fetched in the worktree.

If the branch is not accessible, you get that warning, and this has important consequences for the analysis. Without the base branch, the analysis cannot compute accurate the files that changed and the lines that changed. The analysis results will probably look incorrect, strange.

@drod1 are you able configure your Jenkins pipeline to get rid of this warning?

I managed to run the below command at my Jenkins pipeline job before starting Maven build for PR branch

git fetch origin master

And it is not helping…

Any advice is greatly appreciated

looks like I found my own answer :slight_smile: . At Jenkins BB multi-branch source plugin configuration, add ’ Specify ref specs’ with value ‘+refs/heads/:refs/remotes/@{remote}/’ under Behaviors - repositories

12 Likes