attempting to delete faulty added Rule Key Pattern
Situation:
We added a Rule Key Pattern to the ‘Ignore Issues on Multiple Criteria’ and now we receive errors during our scan.
We want to remove the Rule Key Pattern using the WEB UI, but the application won’t let us remove the Rule, giving a message ‘Validation failed. Provide a value’.
Steps to reproduce:
Add a Rule Key Pattern using the web interface.
Save it
Attempt to reset/remove it.
##[error]09:50:27.318 ERROR Issue exclusions are misconfigured. File pattern is mandatory for each entry of ‘sonar.issue.ignore.multicriteria’
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.ProjectFileIndexer
at org.sonar.core.platform.SpringComponentContainer.getComponentByType(SpringComponentContainer.java:174)
When we then attempt to ‘Reset’ the Rule Key Pattern:
When I then press ‘Reset’ the Rule Key Pattern as before is shown…
Desired situation:
To be able to remove this Rule Key Pattern using the UI so that our scan will succeed again.
Hope you can advise us how to resolve this issue, either in the database or with an update in the user-interface in an upcoming release. In the meantime our project cannot scan.
logged into the docker container and verified the logs after I today attempted to delete the Rule Key Pattern. I don’t see any error in the logfiles concerning this problem in the sonarqube front-end.
tail web.log
2024.11.20 08:23:50 INFO web[][o.s.s.a.p.ExpiredSessionsCleaner] Purge of expired session tokens has removed 0 elements
2024.11.20 08:23:50 INFO web[][o.s.s.a.p.ExpiredSessionsCleaner] Purge of expired SAML message ids has removed 0 elements
tail sonar.log
2024.10.07 08:25:19 INFO app[][o.s.a.SchedulerImpl] Process[ce] is up
2024.10.07 08:25:19 INFO app[][o.s.a.SchedulerImpl] SonarQube is operational
tail ce.log
2024.11.18 01:33:14 INFO ce[6b0a867b-fc70-4ecc-9271-20b7f820ccea][o.s.c.t.s.ComputationStepExecutor] Index analysis | status=SUCCESS | time=983ms
2024.11.18 01:33:15 INFO ce[6b0a867b-fc70-4ecc-9271-20b7f820ccea][o.s.c.t.s.ComputationStepExecutor] Update need issue sync for branch | status=SUCCESS | time=37ms
2024.11.18 01:33:15 INFO ce[6b0a867b-fc70-4ecc-9271-20b7f820ccea][o.s.c.t.s.ComputationStepExecutor] Compute total Project ncloc | status=SUCCESS | time=50ms
2024.11.18 01:33:15 INFO ce[6b0a867b-fc70-4ecc-9271-20b7f820ccea][o.s.c.t.s.ComputationStepExecutor] Publishing taint vulnerabilities and security hotspots events | status=SUCCESS | time=1ms
2024.11.18 01:33:15 INFO ce[6b0a867b-fc70-4ecc-9271-20b7f820ccea][o.s.c.t.s.ComputationStepExecutor] Send issue notifications | newIssuesNotifs=0 | newIssuesDeliveries=0 | myNewIssuesNotifs=0 | myNewIssuesDeliveries=0 | changesNotifs=0 | changesDeliveries=0 | status=SUCCESS | time=3ms
2024.11.18 01:33:15 INFO ce[6b0a867b-fc70-4ecc-9271-20b7f820ccea][o.s.c.t.s.ComputationStepExecutor] Actions to execute when the computation is about to be finished | status=SUCCESS | time=0ms
2024.11.18 01:33:15 INFO ce[6b0a867b-fc70-4ecc-9271-20b7f820ccea][o.s.c.t.s.ComputationStepExecutor] Publish task results | status=SUCCESS | time=0ms
2024.11.18 01:33:15 INFO ce[6b0a867b-fc70-4ecc-9271-20b7f820ccea][o.s.c.t.s.ComputationStepExecutor] Trigger refresh of Portfolios and Applications | status=SUCCESS | time=0ms
2024.11.18 01:33:15 INFO ce[6b0a867b-fc70-4ecc-9271-20b7f820ccea][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Webhooks | globalWebhooks=0 | projectWebhooks=0 | status=SUCCESS | time=4ms
2024.11.18 01:33:19 INFO ce[6b0a867b-fc70-4ecc-9271-20b7f820ccea][o.s.c.t.CeWorkerImpl] Executed task | project=Vertex | type=REPORT | id=6b0a867b-fc70-4ecc-9271-20b7f820ccea | submitter=azuredevops | status=SUCCESS | time=421950ms
tail es.log
2024.10.07 08:23:45 INFO es[][o.e.c.m.MetadataCreateIndexService] [issues] creating index, cause [api], templates [], shards [5]/[0]
2024.10.07 08:23:48 INFO es[][o.e.c.r.a.AllocationService] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[issues][4]]])." previous.health="YELLOW" reason="shards started [[issues][4]]"
2024.10.07 08:23:48 INFO es[][o.e.c.m.MetadataMappingService] [issues/JPvu3MKvTDKCQDrSToc8hg] create_mapping
Ann, the full error from our azure devops pipeline is attached underneath, brace yourself for the long error.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781)
... 68 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.issue.ignore.pattern.IssueExclusionPatternInitializer]: Constructor threw exception; nested exception is Issue exclusions are misconfigured. File pattern is mandatory for each entry of 'sonar.issue.ignore.multicriteria'
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:226)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:302)
... 82 more
Caused by: Issue exclusions are misconfigured. File pattern is mandatory for each entry of 'sonar.issue.ignore.multicriteria'
01:21:51.292 DEBUG: Cleanup org.eclipse.jgit.util.FS$FileStoreAttributes$$Lambda$379/0x000002001b336e68@53ed09e8 during JVM shutdown
Process returned exit code 1
##[error]The SonarScanner did not complete successfully
##[debug]Processed: ##vso[task.logissue type=error;]The SonarScanner did not complete successfully
The SonarScanner did not complete successfully
##[error]01:21:51.839 Post-processing failed. Exit code: 1
I was able to reproduce your issue, we found two input validation bugs that we will need to address.
The first one being that you were able to input a rule key pattern with an empty file path pattern, which is invalid and is the cause for your build failing. And secondly, when trying to remove said rule, the UI doesn’t allow you to set the sonar.issue.ignore.multicriteria setting to an empty state.
In order to work around the issue for now, you can update the rule to values that will never be matched (e.g. notvalidrule: not valid), save this and re-run the analysis and it should pass.
Edit: I want to clarify that indeed you can “Reset” a setting in order to clear it as well.
I attempted the workaround and have configured the Rule Key Pattern with the exact same ‘notvalidrule: not valid’ and ‘**/*.html’ as file pattern as you described, but I had to do this on every project in Sonarqube as all projects had that old Rule Key Pattern ‘Web:MouseEventWithoutKeyboardEquivalentCheck’… Weird…