Sonarqube analysis PR ok but main branch fails

Hello,

I have been using sonarqube for some time now with gitlab and gradle and everything was working fine. I upgraded to 9.x and re imported my project from my hosted gitlab instance using the new wizard. Everything went well, except one : main branch analysis fails. I though at first it was just a slow CI problem, but I realized today that no analysis from develop went through.

Merge request analysis are ok and working, but my main branch (develop) is not working. I get the following error:

Task :sonarqube
Unresolved imports/types have been detected during analysis. Enable DEBUG mode to see them.
Unresolved imports/types have been detected during analysis. Enable DEBUG mode to see them.
[okhttp3.internal.http2.StreamResetException: stream was reset: NO_ERROR, okhttp3.internal.http2.StreamResetException: stream was reset: NO_ERROR, okhttp3.internal.http2.StreamResetException: stream was reset: NO_ERROR]
> Task :sonarqube FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sonarqube'.
> Failed to upload report: Fail to request url: https://xxx/api/ce/submit?projectKey=<censored_project_key>projectName=<censored>&characteristic=branch%3Ddevelop&characteristic=branchType%3DBRANCH

Here is my CI code:

sonarqube-check:
  stage: test
  variables:
    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
    GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - .sonar/cache
  script: gradle sonarqube
  allow_failure: true
  only:
    - merge_requests
    - develop

Versions:

  • Sonarqube version 9.2.4.50792 developer
  • org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3

I tried running the analysis locally, and I get the same error.

If you have any clues what I could try that would be appreciated !

Hi,

Welcome to the community!

Could you turn on debug-level logging in your analysis? I’d like to see if there’s any more detail on why your analysis report upload failed.

Two other things I would check: are there any errors in your server logs? Is there something on your network that could be selectively interfering?

Also, I’m not recognizing the characteristic query string parameters. Any idea where they’re coming from?

 
Ann

Hi,

Thank you for your time.

adding --stacktrace at gradle execution, I have the following message in the stack:

Suppressed: okhttp3.internal.http2.StreamResetException: stream was reset: NO_ERROR

I checked the web access logs, I was able to see the incoming calls from the PR branches, but none for the develop branch. I did not found any relevant logs in the other logs.

Gitlab CI runner is running on aws + k8s cluster so I do not think that there would be a network problem as the PR calls are working fine.

I have no idea what the characteristic is and where it comes from, I will investigate.

Hi,

Very typically when the analysis report upload fails, it’s something on the network like a proxy interfering with the POST. Without further details, I can only suggest you look there.

 
HTH,
Ann

Solution found, you were right Ann, it was as you said the nginx proxy from the k8s that was not accepting big files.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.