I have a CI/CD for a java project where I call sonarqube and analysis goes through successfuly until this morning. I added a yaml file in the project, very simple yaml, for the creation of pod in K8S, as soon as I ran the cicd pipeline I got
ERROR: Error during SonarScanner execution
java.lang.UnsupportedOperationException: Can not add the same measure twice on blue-deployment.yml: DefaultMeasure[component=blue-deployment.yml,metric=Metric[uuid=<null>,key=ncloc_data,description=<null>,type=DATA,direction=0,domain=<null>,name=ncloc_data,qualitative=false,userManaged=false,enabled=true,worstValue=<null>,bestValue=<null>,optimizedBestValue=false,hidden=false,deleteHistoricalData=false,decimalScale=<null>],value=1=1;2=1;3=1;4=1;5=1;6=1;7=1;8=1;9=1;10=1;11=1;12=1;13=1;14=1;15=1;16=1;17=1;18=1;19=1;20=1;21=1;22=1,fromCore=false,storage=org.sonar.scanner.sensor.DefaultSensorStorage@300b839c,saved=false]
at org.sonar.scanner.sensor.DefaultSensorStorage.saveMeasure(DefaultSensorStorage.java:175)
at org.sonar.scanner.sensor.DefaultSensorStorage.store(DefaultSensorStorage.java:135)
at org.sonar.api.batch.sensor.measure.internal.DefaultMeasure.doSave(DefaultMeasure.java:96)
at org.sonar.api.batch.sensor.internal.DefaultStorable.save(DefaultStorable.java:45)
This error typically comes from an overlap in the definition of sonar.sources and sonar.tests. Can you check Project Settings → Background Tasks → [row cog menu] → Show Scanner Context and see if sonar.tests is defined (perhaps in a sonar-project.properties file)? A definition of sonar.sources=. is pretty broad and would automatically overlap anything defined for sonar.tests.
Thanks Ann, I uninstalled the yaml, renabled K8S and analysis went through but in spite of the fact that I have 3 yaml K8S files I dont see any activity of analysis on those files? Where can we see what happened during analysis, what I mean what SQ analyzed?
Thanks again for your help
Ah! Right. You’re on SonarQube 9.8. Upgrade to 9.9 (since you have to hit each intervening LTS version between your start point and your target version) and then to 10.0 and try again, please.
To follow up on your question during the webinar, if you are still running an old version of SonarQube, I invite you to upgrade to the most recent version and try again.
Thanks Christophe for the follow-up. I have already upgraded to 2025 1 week ago but did not have time to test. My question was is there still an overlap between yaml plugin and k8s?