Sonar analysis gives error randomly and its resolved with new branch creation

  • Developer Edition
  • Version 9.3
    The break build on quality gate failure task of Azure devOps fails randomly . And its fixed after creating new branch.
    Please comment out the possible solution other than new branch creation, or RCA of the same would help.

Error:
##[error]The analysis did not pass the quality gate because at least one analysis has the status ‘ERROR’. Attempting to fail the build!

Thanks

Hi,

Welcome to the community!

You’re saying that it breaks the build when the branch is passing the Quality Gate?

 
Ann

Hi
Nope, the quality gate passed for the same changeset of code… earlier, all of a sudden it fails (the quality gate is not passed).
After creating new branch, for the same code changeset, the quality gate passed.

Thanks

Hi,

Can you take a look at the job/logs and verify that the part of the job that retrieves the Quality Gate status is actually receiving a failed state rather than just timing out & defaulting to failed?

 
Ann

Hi,
It does not seem like a time-out, Coz, the time ellapsed in the task is just 8s.It rather seems like a false Failure.
Number of analyses in this build: 1

Summary of statusses: “ERROR”

##[debug]task result: Failed

##[error]The analysis did not pass the quality gate because at least one analysis has the status ‘ERROR’. Attempting to fail the build!

Gowthami M

Hi Gowthami,

Can you share your job configuration?

 
Thx,
Ann

I will try increasing the time out of the task “Publish Quality Gate Result”
Will update the chain on the result.
Current timeout : 300s
Now I have updated it to : 400 s

Hello,
Increasing the polling timeout did not help.

Gowthami M

Run Code Analysis
steps:

  • task: SonarSource.sonarqube.6D01813A-9589-4B15-8491-8164AEB38055.SonarQubeAnalyze@4
    displayName: ‘Run Code Analysis’

Publish Quality Gate Result
steps:

  • task: SonarSource.sonarqube.291ed61f-1ee4-45d3-b1b0-bf822d9095ef.SonarQubePublish@4
    displayName: ‘Publish Quality Gate Result’
    inputs:
    pollingTimeoutSec: 600

SonarQube build breaker
steps:

  • task: SimondeLang.sonar-buildbreaker.sonar-buildbreaker.sonar-buildbreaker@8
    displayName: ‘Break build on quality gate failure’
    inputs:
    SonarQube: SonarQube

Hi,

You don’t need the BuildBreaker step; what it’s supposed to do is already accomplished by the “Publish Quality Gate Result” step. Please remove it and see if the problem gets better.

 
Ann

hi,
Even in the publish quality gate its giving error. Which is not supposed to be given.
##[debug][{“op”:0,“path”:“/sonarglobalqualitygate”,“value”:“failed”}]
Fundamental doubt is, the error’s not shown when a new sonar branch is created, for the same changeset of code.

Gowthami M

Hi,

Can you share your pipeline and your job log?

 
Ann

Hi Gothami,

Is it possible for you to share the logs Ann requested? You can send me a private message or if this is an issue we can arrange another way for you to share.

To unstick your pipeline, you can temporarily remove the buildbreaker and Publish Quality Gate steps.

Brian

1 Like