Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.3.0 plugin works with sonar 8.2 ? #112

Closed
ktibi opened this issue Feb 27, 2020 · 46 comments
Closed

1.3.0 plugin works with sonar 8.2 ? #112

ktibi opened this issue Feb 27, 2020 · 46 comments
Labels
awaiting release Merged but not currently in release version bug Something isn't working

Comments

@ktibi
Copy link

ktibi commented Feb 27, 2020

Hello,

We try to deploy the plugin on sonarqube 8.2 but we have a trace :

......
INFO: Load project branches
INFO: Load project branches (done) | time=23ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=20ms
INFO: Load branch configuration
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2.268s
INFO: Final Memory: 9M/40M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.InputComponentStore
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:65)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
	at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
	at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
	at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
	at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
	at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
	at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
	at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
	at org.picocontainer.DefaultPicoContainer.instantiateComponentAsIsStartable(DefaultPicoContainer.java:1034)
	at org.picocontainer.DefaultPicoContainer.addAdapterIfStartable(DefaultPicoContainer.java:1026)
	at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1003)
	at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Unable to load component interface org.sonar.scanner.scan.branch.BranchConfiguration
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:65)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
	at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
	at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
	at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
	at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
	at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
	at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
	at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
	at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:63)
	... 34 more
Caused by: java.lang.NoSuchFieldError: LONG
	at com.github.mc1arke.sonarqube.plugin.scanner.CommunityBranchConfigurationLoader.createBranchConfiguration(CommunityBranchConfigurationLoader.java:132)
	at com.github.mc1arke.sonarqube.plugin.scanner.CommunityBranchConfigurationLoader.load(CommunityBranchConfigurationLoader.java:96)
	at org.sonar.scanner.scan.branch.BranchConfigurationProvider.provide(BranchConfigurationProvider.java:43)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.picocontainer.injectors.MethodInjector.invokeMethod(MethodInjector.java:129)
	at org.picocontainer.injectors.MethodInjector.access$000(MethodInjector.java:39)
	at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:113)
	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120)
	at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58)
	at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142)
	at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96)
	at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:63)
	... 48 more

Our configuration

sonar.projectKey=projet_key
sonar.projectName="PROJET"
sonar.coverage.exclusions=**/**
sonar.branch.name=master
@ktibi ktibi added the bug Something isn't working label Feb 27, 2020
@dcherniv
Copy link

@ktibi Build from source from sonarqube8.1 branch and try that version. 8.2 is not supported in 1.3.0 for sure.

@mc1arke
Copy link
Owner

mc1arke commented Feb 27, 2020

Having had a quick look at the changes in SonarQube 8.2, I think the changes to work with Sonarqube 8.1 should work, with the only real difference being in additional properties being available for configuring the properties for Gitlab decoration which should be backwards compatible. The 1.3.0 release will not work for Sonarqube 8.1 or 8.2 due to the removal of various fields and methods that the currently release version of the plugin needed to use to work with Sonarqube 7.9. I plan on releasing support for SonarQube 8.1 this weekend and will try to get 8.2 sorted at the same time since it looks like less significant changes.

@ktibi
Copy link
Author

ktibi commented Feb 28, 2020

@mc1arke ok thx !

I can try to test your pre-release if you want on 8.2 !

@jdkcn
Copy link

jdkcn commented Mar 2, 2020

I'm install with no errors.But in got 404 error when config ALM Integrations Gitlab .

The 404 url is : /api/alm_settings/create_gitlab

@ramaprakashganesan
Copy link

ramaprakashganesan commented Mar 13, 2020

Eagerly waiting for the next release that will hopefully have PR Decoration fully functional for GitHub Enterprise with SonarQube 8.1+..
P.S. Hope everybody is doing fine, during this pandemic time.

@rverma-jm
Copy link

rverma-jm commented Mar 19, 2020

We tried to use the 8.1_sq_branch build against 8.2. The scan's were fine, it create a branch for pullrequest.branch, but it didn't create anything inside PR section in sonarqube as well as no PR decoration on github

@andrejpetras
Copy link

@rverma-jm I have the same issue with gitlab

@Insidexa
Copy link

Insidexa commented Mar 20, 2020

have same problem on sonarqube 8.2 ( build 32929 ) with github integration
In ALM Integrations -> Github I fill next fields: github url, app id and private key.

After save configuration, I got next error:

{"errors":[{"msg":"Unknown url : /api/alm_settings/create_github"}]}

And got error on page GET /projects/create
{"errors":[{"msg":"Unknown url : /api/alm_settings/list"}]}

on page GET admin/settings?category=almintegration
{"errors":[{"msg":"Unknown url : /api/alm_settings/list_definitions"}]}

@andrejpetras
Copy link

Hi,

I did few changes in the 81 branch and it is working with Sonar 8.2 and Gitlab

Result:

  • Branch - OK
  • PullRequest - OK

@andrejpetras
Copy link

I'm not sure, but it works for me;
I use this for the pull request

mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar 
-Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN 
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml 
-Dsonar.pullrequest.key=$DOCKER_ENV_CI_MERGE_REQUEST_IID 
-Dsonar.pullrequest.branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME 
-Dsonar.pullrequest.base=$CI_MERGE_REQUEST_TARGET_BRANCH_NAME 
-Dsonar.pullrequest.gitlab.instanceUrl=$CI_API_V4_URL 
-Dsonar.pullrequest.gitlab.projectId=$CI_PROJECT_PATH 
-Dsonar.pullrequest.gitlab.projectUrl=$CI_MERGE_REQUEST_PROJECT_URL 
-Dcom.github.mc1arke.sonarqube.plugin.branch.pullrequest.gitlab.pipelineId=$CI_PIPELINE_ID

and for the branch

mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar 
-Dsonar.branch.name=$CI_COMMIT_REF_NAME 
-Dsonar.host.url=$SONAR_URL 
-Dsonar.login=$SONAR_TOKEN 
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml

@andrejpetras
Copy link

@mc1arke Would it be possible to set up the binding for the pull request decoration when the project is created? At the moment I have to go to every project and set up the Gitlab

image

@svnsp
Copy link

svnsp commented Mar 25, 2020

@andrejpetras Thank you! Plugin build from your branch is working with Sonar 8.2

@bcouetil
Copy link

bcouetil commented Mar 25, 2020

Wonderful ! When can we expect a release ? 😄

@naofireblade
Copy link

naofireblade commented Mar 26, 2020

Hi,

I did few changes in the 81 branch and it is working with Sonar 8.2 and Gitlab

Result:

  • Branch - OK
  • PullRequest - OK

Awesome! Your branch works for me (incl. MR comments in GitLab). Some of your PR parameters are not required for me. But I had to add the parameter sonar.pullrequest.gitlab.instanceUrl because my public GitLab url differs from the one that can be reached by SonarQube.

-Dsonar.pullrequest.gitlab.instanceUrl=YOUR_GITLAB_URL
-Dsonar.pullrequest.key=$CI_MERGE_REQUEST_IID
-Dsonar.pullrequest.branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
-Dsonar.pullrequest.base=$CI_MERGE_REQUEST_TARGET_BRANCH_NAME

@bcouetil
Copy link

bcouetil commented Mar 26, 2020

I tried this branch and have still one problem I can't figure out. Everything seems fine, at least in SonarQube, but I don't have decoration in Gitlab MR.

I have printend this log thanks to analysis in another issue :
[c.g.m.s.p.c.p.PullRequestPostAnalysisTask] No ALM has been set on the current project

in Administration > Configuration > General Settings > ALM Integrations > Gitlab : token is saved and message says `This feature is enabled`

But in my-project > Project Settings > General Settings > Pull Request Decoration, it says `This feature must first be enabled in the global settings.`

What did I miss ?

EDIT : Sorry I did not see that the code for 8.2 was on the fork, it works fine 👍

@andrejpetras
Copy link

@bcouetil You need to add the personal key for Sonarqube. The Sonarqube client is using this key to create a comment in the MR

image

@bcouetil
Copy link

bcouetil commented Mar 26, 2020

Thank you, this works like a charm ❤️
...as I said, I was taking this branch instead of yours 😄

Screenshot from 2020-03-26 19-05-59

@johanneshiry
Copy link

johanneshiry commented Mar 27, 2020

Works like a charm @andrejpetras. Thank you very much! ❤️

If someone is interested in the compiled version feel free to take the one I just compiled for myself: sonarqube-community-branch-plugin-1.4.0-SNAPSHOT.jar.zip

@parksquare
Copy link

Works like a charm @andrejpetras. Thank you very much! ❤️

If someone is interested in the compiled version feel free to take the one I just compiled for myself: sonarqube-community-branch-plugin-1.4.0-SNAPSHOT.jar.zip

I've installed your binaries on my SQ v8.2 (build 32929) This causes an error on my Azure DevOps builds on the code analysis step:

##[error]ERROR: Error during SonarQube Scanner execution
ERROR: Error during SonarQube Scanner execution
##[error]ERROR: Failed to upload report - An error has occurred. Please contact your administrator
ERROR:

Any ideas?

@johanneshiry
Copy link

johanneshiry commented Mar 28, 2020

@parksquare can you provide a more extensive log?
In which of the sonarqube logs is this error logged?

Did you put the library in both (all three) places sonarqube/extensions/plugins/ and sonarqube/lib/common/ (and if you use docker pls also put it into sq/lib/common which is a non-documented path in sonarqube 8.2)

@parksquare
Copy link

It's running with Docker, extensions being a volume pointing to /opt/sonarqube/extensions/plugins in the container. I don't know why it would need to be in any other location? Everything certainly worked before upgrading to SQ 8.2.

The logs and UI suggest the plugin is loaded successfully. The problem occurs when the analysis results are POSTed to SQ, which results in a 500. The error is 'Current edition does not support branch feature'

I've attached the logs, happy to assist in any way I can
sq.zip

@bcouetil
Copy link

bcouetil commented Mar 29, 2020

Being in lib/common is crucial to override the default code saying "Current edition does not support branch feature". You'll see multiple closed issues here on this subject 😉

@parksquare
Copy link

is that a new requirement do you know?

@bcouetil
Copy link

Sonarqube includes MR analysis in paid version since 8.0, so yes, if you come from 7.X, it's new 😄

@parksquare
Copy link

It was working fine with the community branch plugin and 8.x

@johanneshiry
Copy link

johanneshiry commented Mar 29, 2020

you definitely need to put the new plugin in the 2 (3) locations I pointed out above. Otherwise it won't work. See also the readme installation section here.

If you don't have the paths attached you could use docker cp <file> <my-container>:<path-inside-the-container> to get it there

@parksquare
Copy link

Has this only become necessary since SQ 8.2? It's not ideal having to mess with files inside the container like that, which is a shame because pointing the plugins and logs locations to volumes was pretty elegant. It kind of defeats the object of running as a container, as it will no longer be possible to destroy it (e.g. on upgrade) without manual intervention again.

@bcouetil
Copy link

bcouetil commented Mar 29, 2020

It's now a core fonctionnality that is designed to not be free... I think this is a small price to pay 😅

I'm personnaly using kubernetes, and the official helm chart provides a nice lib.common option, allowing easy rescheduling and upgrades 😍

@timothydowney
Copy link

timothydowney commented Mar 29, 2020 via email

@mclayton7
Copy link

@mc1arke are you open to a pull request for 8.2 from @andrejpetras? His branch is working for me (using the binaries from @johanneshiry), but the PR decoration images are broken because of some changes here.

@KrapivinAndrey
Copy link

Hello.
Why does the address disappear after saving?

image

@r-oldenburg
Copy link

Hi everybody,

if anyone else is having issues with proxy when using this plugin: There seems to be a little "flaw" in the code. It uses HttpClients.createDefault() which ignores system proxy settings. I changed it to HttpClients.createSystem() and voila: Proxy works.

If anybody needs the patched version:
sonarqube-community-branch-plugin-1.4.0-SNAPSHOT.jar.zip

@ramaprakashganesan
Copy link

ramaprakashganesan commented Apr 17, 2020

Does not seem to work for below configuration.

Sonarqube server version: 8.2
ALM Integration: GitHub Enterprise
Plugin downloaded from johanneshiry's comment above - https://github.com/mc1arke/sonarqube-community-branch-plugin/files/4396080/sonarqube-community-branch-plugin-1.4.0-SNAPSHOT.jar.zip

Error in ce.log:
2020.04.17 03:15:23 INFO ce[AXGHomBleJEIl4eurE3Y][c.g.m.s.p.c.p.PullRequestPostAnalysisTask] using pull request decoratorGithub
2020.04.17 03:15:25 ERROR ce[AXGHomBleJEIl4eurE3Y][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Execution of task class com.github.mc1arke.sonarqube.plugin.ce.pullrequest.PullRequestPostAnalysisTask failed
java.lang.IllegalStateException: Could not decorate Pull Request on Github
at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.github.GithubPullRequestDecorator.decorateQualityGateStatus(GithubPullRequestDecorator.java:41)
at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.PullRequestPostAnalysisTask.finished(PullRequestPostAnalysisTask.java:161)
....
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: io.aexp.nodes.graphql.exceptions.GraphQLException: Not Found
at io.aexp.nodes.graphql.Fetch.send(Fetch.java:90)
....
... 21 common frames omitted
2020.04.17 03:15:25 INFO ce[AXGHomBleJEIl4eurE3Y][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request Decoration | status=FAILED | time=2226ms

Also tried removing '/v3' from GitHub URL in ALM Integration section of Sonarqube ( per #100), but that did not help either.

@ghost
Copy link

ghost commented Apr 17, 2020

Hello, im using your plugin @andrejpetras, its works perfect BUT in merge request the images are broken (GitLab):

image

Any ideas about what im doing wrong?

Thanks!

@andrejpetras
Copy link

andrejpetras commented Apr 18, 2020

@brianhsb1671

You can set up your own link for the images in general settings:
image

Add this link and try it again:
https://raw.githubusercontent.com/andrejpetras/sonarqube-community-branch-plugin/sonarqube82/src/main/resources/pr-decoration-images

The default configuration is using this link for the images. The master branch has different structure.
https://raw.githubusercontent.com/mc1arke/sonarqube-community-branch-plugin/master/src/main/resources/pr-decoration-images

@balajiv113
Copy link

Hi, is there a way to add only the summary comment and not the sonar issues in Gitlab MR discussion ?

@dungnt081191
Copy link

@mc1arke Would it be possible to set up the binding for the pull request decoration when the project is created? At the moment I have to go to every project and set up the Gitlab

image

Hi @andrejpetras
what's about your question?.
Do you have any solution, currently i have the same issue like you.
I have to manually select Configuration name for each project . :|

@Baiskey
Copy link

Baiskey commented May 12, 2020

When will the Pull Request be open? It's very nice to have this plugin for Sonar 8.2 officialy :)

@dungnt081191
Copy link

When will the Pull Request be open? It's very nice to have this plugin for Sonar 8.2 officialy :)

Hi , you can checkout branches support 8.2, build your own jar and place in dir like instruction. It's worked. I tested many time.

@andrejpetras
Copy link

@mc1arke Would it be possible to set up the binding for the pull request decoration when the project is created? At the moment I have to go to every project and set up the Gitlab

image

Hi @andrejpetras
what's about your question?.
Do you have any solution, currently i have the same issue like you.
I have to manually select Configuration name for each project . :|

@dungnt081191 I do not have solution for this issue :(

@dungnt081191
Copy link

I'm not sure, but it works for me;
I use this for the pull request

mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar 
-Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN 
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml 
-Dsonar.pullrequest.key=$DOCKER_ENV_CI_MERGE_REQUEST_IID 
-Dsonar.pullrequest.branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME 
-Dsonar.pullrequest.base=$CI_MERGE_REQUEST_TARGET_BRANCH_NAME 
-Dsonar.pullrequest.gitlab.instanceUrl=$CI_API_V4_URL 
-Dsonar.pullrequest.gitlab.projectId=$CI_PROJECT_PATH 
-Dsonar.pullrequest.gitlab.projectUrl=$CI_MERGE_REQUEST_PROJECT_URL 
-Dcom.github.mc1arke.sonarqube.plugin.branch.pullrequest.gitlab.pipelineId=$CI_PIPELINE_ID

and for the branch

mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar 
-Dsonar.branch.name=$CI_COMMIT_REF_NAME 
-Dsonar.host.url=$SONAR_URL 
-Dsonar.login=$SONAR_TOKEN 
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml

Hi bro, one more thing :
i follow your pipeline config with add this values :
-Dsonar.pullrequest.key=${CI_MERGE_REQUEST_ID}
-Dsonar.pullrequest.branch=${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}
-Dsonar.pullrequest.base=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
-Dsonar.pullrequest.gitlab.instanceUrl=$CI_API_V4_URL
-Dsonar.pullrequest.gitlab.projectId=$CI_PROJECT_PATH
-Dsonar.pullrequest.gitlab.projectUrl=$CI_MERGE_REQUEST_PROJECT_URL
-Dcom.github.mc1arke.sonarqube.plugin.branch.pullrequest.gitlab.pipelineId=$CI_PIPELINE_ID

It's worked with gitlab http server .
Did you tested with gitlab https server ?

@lonnix
Copy link

lonnix commented May 21, 2020

I am running 8.2 and I have tried both the 1.4.0-SNAPSHOT plugins above as well as building a new artifact (1.3.1-SNAPSHOT) from the sq-8_2-support branch. I can see the "Pull Request Decoration" tab under Project Settings but it just says "This feature must first be enabled in the global settings." I have the jar in both /opt/sonarqube/extensions/plugins and /opt/sonarqube/lib/common (the tab doesn't show up until the jar is in lib/common). There is no decoration tab under the general settings. Branch analysis working properly, just not the decoration.

I see references to a 3rd directory, sq/lib/common but I don't seem to have that directory. Am I missing something?

Also, like @bcouetil I have installed it through helm, although the plugins.lib section of the helm chart didn't work so I had to copy the jar in the container then restart the server

@bcouetil
Copy link

bcouetil commented May 23, 2020

The jar has to be generated from @andrejpetras 's fork : https://github.com/andrejpetras/sonarqube-community-branch-plugin/tree/sonarqube82

For the plugins.libpart, you have to indicate only the jar name, because it is simply copied from the plugins folder (previously downloaded) to the common folder. I figured it out by displaying the configmap. Check it out after install to verify that the command is right.

@lonnix
Copy link

lonnix commented May 26, 2020

@bcouetil thanks for the help, the jar is showing up in lib/common now.
However, the branch does not build. I am on the sonarqube82 branch and ran gradle build and got 7 failed tests:

/tmp/sonarqube-community-branch-plugin: gradle build

> Task :compileTestJava
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :test

com.github.mc1arke.sonarqube.plugin.classloader.ClassReferenceElevatedClassLoaderFactoryTest > testClassloaderReturnedOnHappyPath FAILED
    java.lang.NullPointerException at ClassReferenceElevatedClassLoaderFactoryTest.java:112

com.github.mc1arke.sonarqube.plugin.classloader.ClassReferenceElevatedClassLoaderFactoryTest > testLoadClass FAILED
    java.lang.NullPointerException at ClassReferenceElevatedClassLoaderFactoryTest.java:112

com.github.mc1arke.sonarqube.plugin.classloader.ReflectiveElevatedClassLoaderFactoryTest > testLoadClassInvalidApiClassloader FAILED
    java.lang.NullPointerException at ReflectiveElevatedClassLoaderFactoryTest.java:149

com.github.mc1arke.sonarqube.plugin.classloader.ReflectiveElevatedClassLoaderFactoryTest > testLoadClassInvalidClassRealmKey FAILED
    java.lang.NullPointerException at ReflectiveElevatedClassLoaderFactoryTest.java:93

com.github.mc1arke.sonarqube.plugin.classloader.ReflectiveElevatedClassLoaderFactoryTest > testLoadClassNoParentRef FAILED
    java.lang.NullPointerException at ReflectiveElevatedClassLoaderFactoryTest.java:121

com.github.mc1arke.sonarqube.plugin.classloader.ReflectiveElevatedClassLoaderFactoryTest > testLoadClassInvalidClassloader FAILED
    java.lang.NullPointerException at ReflectiveElevatedClassLoaderFactoryTest.java:174

com.github.mc1arke.sonarqube.plugin.classloader.ReflectiveElevatedClassLoaderFactoryTest > testLoadClass FAILED
    java.lang.NullPointerException at ReflectiveElevatedClassLoaderFactoryTest.java:62

170 tests completed, 7 failed

I am using sonarqube-8.2.0.32929 libraries
If I build and skip tests (gradle build -x test) I get a jar but when uploaded to sonar using the method in my previous post I get the same behavior previously mentioned.
Am I missing something @andrejpetras ?

@useful-devops-tools
Copy link
Contributor

Does not seem to work for below configuration.

Sonarqube server version: 8.2
ALM Integration: GitHub Enterprise
Plugin downloaded from johanneshiry's comment above - https://github.com/mc1arke/sonarqube-community-branch-plugin/files/4396080/sonarqube-community-branch-plugin-1.4.0-SNAPSHOT.jar.zip

Error in ce.log:
2020.04.17 03:15:23 INFO ce[AXGHomBleJEIl4eurE3Y][c.g.m.s.p.c.p.PullRequestPostAnalysisTask] using pull request decoratorGithub 2020.04.17 03:15:25 ERROR ce[AXGHomBleJEIl4eurE3Y][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Execution of task class com.github.mc1arke.sonarqube.plugin.ce.pullrequest.PullRequestPostAnalysisTask failed java.lang.IllegalStateException: Could not decorate Pull Request on Github at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.github.GithubPullRequestDecorator.decorateQualityGateStatus(GithubPullRequestDecorator.java:41) at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.PullRequestPostAnalysisTask.finished(PullRequestPostAnalysisTask.java:161) .... at java.base/java.lang.Thread.run(Thread.java:834) Caused by: io.aexp.nodes.graphql.exceptions.GraphQLException: Not Found at io.aexp.nodes.graphql.Fetch.send(Fetch.java:90) .... ... 21 common frames omitted 2020.04.17 03:15:25 INFO ce[AXGHomBleJEIl4eurE3Y][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request Decoration | status=FAILED | time=2226ms

Also tried removing '/v3' from GitHub URL in ALM Integration section of Sonarqube ( per #100), but that did not help either.

The version you downloaded from johanneshiry's comment is actually quite old and doesn't include the fix from issue #100

You should download and checkout the sq-8_2-support branch and compile your own version

@mc1arke
Copy link
Owner

mc1arke commented Oct 27, 2020

Support for SQ 8.2 - 8.4 released in 1.5.0 of the plugin

@mc1arke mc1arke closed this as completed Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting release Merged but not currently in release version bug Something isn't working
Projects
None yet
Development

No branches or pull requests