cnumr / ecoCode

Reduce the environmental footprint of your software applications with this cutting-edge sonarQube plugin
GNU General Public License v3.0
62 stars 48 forks source link

[Sonarqube Server] Integration incompatible between v9.4-community and php-plugin #71

Open Silicoman opened 2 years ago

Silicoman commented 2 years ago

Hi,

Having next week bad experience with a plugin, i'm verifying viability for the next sonarqube LTS v9 of this plugin.

What is the error? Can't integrate the php-plugin with my docker image sonarqube v9 (latest, 9.4-community). Hard stopping process.

Complete log after Sonarqube DBmigration :

2022.05.17 12:59:41 INFO  web[][o.s.s.p.Platform] Database has been automatically updated
2022.05.17 12:59:41 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.platform.web.WebServiceFilter@3b95bf70 [pattern=UrlPattern{inclusions=[/api/system/migrate_db.*, ...], exclusions=[/api/components/update_key, ...]}]
2022.05.17 12:59:41 INFO  web[][o.s.s.p.DetectPluginChange] Detect plugin changes
2022.05.17 12:59:41 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2022.05.17 12:59:45 INFO  web[][o.s.s.e.IndexCreator] Create index [metadatas]
2022.05.17 12:59:45 INFO  es[][o.e.c.m.MetadataCreateIndexService] [metadatas] creating index, cause [api], templates [], shards [1]/[0]
2022.05.17 12:59:46 INFO  es[][o.e.c.r.a.AllocationService] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[metadatas][0]]]).
2022.05.17 12:59:46 INFO  web[][o.s.s.e.IndexCreator] Create type metadatas/metadata
2022.05.17 12:59:46 INFO  es[][o.e.c.m.MetadataMappingService] [metadatas/9rEnPWfERAKrvD7dw-VZWg] create_mapping [metadata]
2022.05.17 12:59:46 INFO  web[][o.s.s.e.IndexCreator] Create index [components]
2022.05.17 12:59:47 INFO  es[][o.e.c.m.MetadataCreateIndexService] [components] creating index, cause [api], templates [], shards [5]/[0]
2022.05.17 12:59:47 INFO  es[][o.e.c.r.a.AllocationService] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[components][4]]]).
2022.05.17 12:59:47 INFO  web[][o.s.s.e.IndexCreator] Create type components/auth
2022.05.17 12:59:47 INFO  es[][o.e.c.m.MetadataMappingService] [components/2678K1ioQFi8HB-hNuzAKA] create_mapping [auth]
2022.05.17 12:59:47 INFO  web[][o.s.s.e.IndexCreator] Create index [projectmeasures]
2022.05.17 12:59:47 INFO  es[][o.e.c.m.MetadataCreateIndexService] [projectmeasures] creating index, cause [api], templates [], shards [5]/[0]
2022.05.17 12:59:48 INFO  es[][o.e.c.r.a.AllocationService] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[projectmeasures][4]]]).
2022.05.17 12:59:48 INFO  web[][o.s.s.e.IndexCreator] Create type projectmeasures/auth
2022.05.17 12:59:48 INFO  es[][o.e.c.m.MetadataMappingService] [projectmeasures/Mw5_fEmERl2uObkR1YMk-A] create_mapping [auth]
2022.05.17 12:59:48 INFO  web[][o.s.s.e.IndexCreator] Create index [rules]
2022.05.17 12:59:48 INFO  es[][o.e.c.m.MetadataCreateIndexService] [rules] creating index, cause [api], templates [], shards [2]/[0]
2022.05.17 12:59:48 INFO  es[][o.e.c.r.a.AllocationService] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[rules][0]]]).
2022.05.17 12:59:48 INFO  web[][o.s.s.e.IndexCreator] Create type rules/rule
2022.05.17 12:59:48 INFO  es[][o.e.c.m.MetadataMappingService] [rules/5qry3c5gSyqgOBS54vrFAw] create_mapping [rule]
2022.05.17 12:59:48 INFO  web[][o.s.s.e.IndexCreator] Create index [issues]
2022.05.17 12:59:49 INFO  es[][o.e.c.m.MetadataCreateIndexService] [issues] creating index, cause [api], templates [], shards [5]/[0]
2022.05.17 12:59:49 INFO  es[][o.e.c.r.a.AllocationService] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[issues][4]]]).
2022.05.17 12:59:49 INFO  web[][o.s.s.e.IndexCreator] Create type issues/auth
2022.05.17 12:59:49 INFO  es[][o.e.c.m.MetadataMappingService] [issues/1lsGB86nQZC9QkqvwfwqJA] create_mapping [auth]
2022.05.17 12:59:49 INFO  web[][o.s.s.e.IndexCreator] Create index [users]
2022.05.17 12:59:49 INFO  es[][o.e.c.m.MetadataCreateIndexService] [users] creating index, cause [api], templates [], shards [1]/[0]
2022.05.17 12:59:49 INFO  es[][o.e.c.r.a.AllocationService] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[users][0]]]).
2022.05.17 12:59:49 INFO  web[][o.s.s.e.IndexCreator] Create type users/user
2022.05.17 12:59:49 INFO  es[][o.e.c.m.MetadataMappingService] [users/o8ZhF-9ZS1G4nR-jgU8IOg] create_mapping [user]
2022.05.17 12:59:50 INFO  web[][o.s.s.e.IndexCreator] Create index [views]
2022.05.17 12:59:50 INFO  es[][o.e.c.m.MetadataCreateIndexService] [views] creating index, cause [api], templates [], shards [5]/[0]
2022.05.17 12:59:50 INFO  es[][o.e.c.r.a.AllocationService] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[views][4]]]).
2022.05.17 12:59:50 INFO  web[][o.s.s.e.IndexCreator] Create type views/view
2022.05.17 12:59:50 INFO  es[][o.e.c.m.MetadataMappingService] [views/aIWnkO9gTeizMYWVVIkrng] create_mapping [view]
2022.05.17 12:59:50 INFO  web[][o.s.s.s.LogServerId] Server ID: 147B411E-AYDSGlCzN2IJeyhYUNKM
2022.05.17 12:59:50 WARN  web[][o.s.s.a.LogOAuthWarning] For security reasons, OAuth authentication should use HTTPS. You should set the property 'Administration > Configuration > Server base URL' to a HTTPS URL.
2022.05.17 12:59:50 INFO  web[][o.s.s.p.UpdateCenterClient] Update center: https://update.sonarsource.org/update-center.properties (no proxy)
2022.05.17 12:59:53 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/system/liveness
2022.05.17 12:59:53 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/plugins/download
2022.05.17 12:59:53 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/analysis_cache/get
2022.05.17 12:59:53 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/alm_integrations/list_bitbucketserver_projects
2022.05.17 12:59:53 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/alm_integrations/search_bitbucketcloud_repos
2022.05.17 12:59:53 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/alm_integrations/check_pat
2022.05.17 12:59:53 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/alm_integrations/list_azure_projects
2022.05.17 12:59:53 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/alm_integrations/search_bitbucketserver_repos
2022.05.17 12:59:53 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/alm_integrations/search_azure_repos
2022.05.17 12:59:53 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/project_dump/status
2022.05.17 12:59:53 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/push/sonarlint_events
2022.05.17 12:59:53 INFO  web[][o.s.s.a.p.ExpiredSessionsCleaner] Purge of expired session tokens has removed 0 elements
2022.05.17 12:59:53 INFO  web[][o.s.s.a.p.ExpiredSessionsCleaner] Purge of expired SAML message ids has removed 0 elements
2022.05.17 12:59:53 INFO  web[][o.s.s.n.NotificationDaemon] Notification service started (delay 60 sec.)
2022.05.17 12:59:53 INFO  web[][o.s.s.t.TelemetryDaemon] Sharing of SonarQube statistics is enabled.
2022.05.17 12:59:54 INFO  web[][o.s.s.s.GeneratePluginIndex] Generate scanner plugin index
2022.05.17 12:59:54 INFO  web[][o.s.s.s.RegisterMetrics] Register metrics
2022.05.17 12:59:54 INFO  web[][o.s.s.q.RegisterQualityGates] Built-in quality gate's conditions of [Sonar way] has been updated
2022.05.17 12:59:54 INFO  web[][o.s.s.r.RegisterRules] Register rules
2022.05.17 12:59:55 WARN  web[][o.s.c.a.AnnotationConfigApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@277050dc-org.sonar.server.rule.RegisterRules': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: 'void org.sonarsource.analyzer.commons.RuleMetadataLoader.<init>(java.lang.String)'
2022.05.17 12:59:55 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@277050dc-org.sonar.server.rule.RegisterRules': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: 'void org.sonarsource.analyzer.commons.RuleMetadataLoader.<init>(java.lang.String)'
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:187)
        at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:80)
        at org.sonar.server.platform.platformlevel.PlatformLevelStartup.access$001(PlatformLevelStartup.java:51)
        at org.sonar.server.platform.platformlevel.PlatformLevelStartup$1.doPrivileged(PlatformLevelStartup.java:119)
        at org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:45)
        at org.sonar.server.platform.platformlevel.PlatformLevelStartup.start(PlatformLevelStartup.java:116)
        at org.sonar.server.platform.PlatformImpl.executeStartupTasks(PlatformImpl.java:183)
        at org.sonar.server.platform.PlatformImpl$1.lambda$doRun$1(PlatformImpl.java:107)
        at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.runIfNotAborted(PlatformImpl.java:344)
        at org.sonar.server.platform.PlatformImpl$1.doRun(PlatformImpl.java:107)
        at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.run(PlatformImpl.java:328)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NoSuchMethodError: 'void org.sonarsource.analyzer.commons.RuleMetadataLoader.<init>(java.lang.String)'
        at fr.cnumr.php.MyPhpRules.define(MyPhpRules.java:64)
        at org.sonar.server.rule.RuleDefinitionsLoader.load(RuleDefinitionsLoader.java:56)
        at org.sonar.server.rule.RegisterRules.start(RegisterRules.java:119)
        at org.sonar.core.platform.StartableBeanPostProcessor.postProcessBeforeInitialization(StartableBeanPostProcessor.java:33)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
        ... 20 common frames omitted
2022.05.17 12:59:55 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process
2022.05.17 12:59:55 INFO  web[][o.s.s.n.NotificationDaemon] Notification service stopped
2022.05.17 12:59:55 INFO  web[][o.s.s.p.d.EmbeddedDatabase] Embedded database stopped
2022.05.17 12:59:55 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2022.05.17 12:59:55 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2022.05.17 12:59:55 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 143
2022.05.17 12:59:55 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

How to reproduce ?

Dockerfile

FROM sonarqube:9.4-community
COPY --chown=sonarqube:sonarqube ecocode-php* ${SQ_EXTENSIONS_DIR}/plugins/
CMD ["/opt/sonarqube/bin/sonar.sh"]

docker image build -f Dockerfile -t sonarqube:9-4-ecocode . docker run -p 9000:9000 sonarqube:9-4-ecocode

More info No problem with python-plugin and java-plugin. But have to verify integration rules with sonarlint.

glalloue commented 2 years ago

Hi @Silicoman It seems that the php plugin has some problems to build in windows and mac M1 environment. @jhertout is working on this point to fix it. What kind of operating system are you currently using to confirm that the problem is the same ?

Silicoman commented 2 years ago

@glalloue , maven build on this module is working correctly. You have to bypass/comments module android and converter inside pom parent (green-it).

Specifications: openJdk 11.0.14.1 2022-02-08 Maven 3.8.4


> mvn install
[INFO] Reactor Summary:
[INFO]
[INFO] ecoCode Sonar Plugins Project 1.0.0-SNAPSHOT ....... SUCCESS [  0.109 s]
[INFO] ecoCode Java Sonar Plugin 1.0.0-SNAPSHOT ........... SUCCESS [ 16.477 s]
[INFO] ecoCode PHP Sonar Plugin 1.0.0-SNAPSHOT ............ SUCCESS [  3.680 s]
[INFO] ecoCode Python Sonar Plugin 1.0.0-SNAPSHOT ......... SUCCESS [ 11.931 s]
[INFO] ------------------------------------------------------------------------
gtoison commented 2 years ago

Hello, Bonjour, The constructor RuleMetadataLoader(String resourceFolder) was removed in https://github.com/SonarSource/sonar-analyzer-commons/commit/6bc3a722b65a577bc0c9b5a7f523d9a5c5c60a17 Now you need to initialize it with the set of rules activated by default and a SonarRuntime (you can probably inject it)