Upgrade Sonar 9.7 to 9.9 fail if current Quality Gate's setting contain condition prefix "new_"

Make sure to tell us:

  • What version are you upgrading from?
    No matter upgrade from 8.9 to 9.9, 9.7 to 9.9 or fresh new from 9.9. It’s appear same issue.

  • System information (Operating system, Java version, Database provider/version)
    base image: alpine:3.16.2
    openjdk version “17.0.6” 2023-01-17
    OpenJDK Runtime Environment (build 17.0.6+10-alpine-r0)
    OpenJDK 64-Bit Server VM (build 17.0.6+10-alpine-r0, mixed mode, sharing)

  • What’s the issue you’re facing?
    It’s failed to start application when upgrade from (both 8.9, 9.7) to 9.9.
    After investigation, I found that It’s cause of quality gate which prefix “new_”. If I disable those quality gates. Application can start normally.

For more information, Even I setup new instance using Sonar 9.9. I still facing same issue.

This is an error message
400 Client Error: for url: http://localhost:9000/api/qualitygates/create_condition

This is body request which I got it after debugging
{‘error’: 80, ‘op’: ‘LT’, ‘metric’: ‘new_coverage’, ‘gateId’: ‘AYcw7sY8kVoygxuhntIl’}

This is the same body request and success normally
{‘error’: 3, ‘op’: ‘GT’, ‘metric’: ‘security_rating’, ‘gateId’: ‘AYcw7sY8kVoygxuhntIl’}

1 Like

Hey, thanks for bringing this to our attention.

I tried to reproduce:

  • start a 8.9-community on a fresh database
  • copy the default Sonar way Quality Gate to new_Sonar way
  • create a new Quality Gate new_test
  • upgrade to SonarQube 9.9-community

But no luck so far, it’s working ok. Could you please describe the steps that would help me reproduce the problem? Thanks!

Hi Pierre,

Thank you very much for response.

I forgot to mention that It’s setup from CaC through Jenkins which we define step below:
Step 1: Clean all Quality Gate and Conditions, after initial setup or upgrade
Step 2: Read configuration as code from repo, For example

- kind: quality_gate
  name: 'Test way'
      error: 3
      op: GT
      error: 80
      op: LT
  default: true

Step 3: Jenkins job will create Quality gate and condition follow above config

After check Jenkins job’s log, I found that

  • Create quality gate → successfully
  • Create condition “security_rating” → successfully
  • Create condition “new_coverage” → failed which error 400 client Error

Best regards,
Chawengwut P.

Thanks for providing the steps. When creating a quality gate, it comes with default conditions we recommend to be Clean As you Code compliant:

Coverage on new code (new_coverage) is one of the default values, so you cannot add it a second time. You can update the value with api/qualitygates/update_condition to customize the condition if needed.

Hi Pierre,

Thank you very much for information. :slight_smile:

I’ve went through release note and “Clean as You Code”.

Is there any documents mention about “Default ‘new code’ conditions for new gate”? because I didn’t see this default conditions in previous version before.

Best regards,
Chawengwut P.

It has been done with this ticket, which can be found with the “full upgrade note” link in the 9.9 upgrade note.