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

Could not decorate Pull Request on Github #90

Closed
ndeitch opened this issue Feb 17, 2020 · 4 comments
Closed

Could not decorate Pull Request on Github #90

ndeitch opened this issue Feb 17, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@ndeitch
Copy link
Contributor

ndeitch commented Feb 17, 2020

Describe the bug
Github decorator not working

To Reproduce
Steps to reproduce the behavior:

  1. Run scanner:
sonar-scanner \
-Dsonar.projectKey=sample-ms \
-Dsonar.host.url=http... \
-Dsonar.login=... \
-Dsonar.pullrequest.key=3 \
-Dsonar.pullrequest.branch=feature/new_endpoint \
-Dsonar.pullrequest.base=master
  1. Check sonarqube ce.log file:
2020.02.17 09:14:04 INFO  ce[AXBSbQ3vn21drEDcQ0_h][c.g.m.s.p.c.p.PullRequestPostAnalysisTask] using pull request decoratorGithub
2020.02.17 09:14:05 ERROR ce[AXBSbQ3vn21drEDcQ0_h][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 org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.executeTask(PostProjectAnalysisTasksExecutor.java:118)
	at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.finished(PostProjectAnalysisTasksExecutor.java:109)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeListener(ComputationStepExecutor.java:91)
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:63)
	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:81)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:209)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:191)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:158)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:133)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:85)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException: null
	at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.github.v3.RestApplicationAuthenticationProvider.getInstallationToken(RestApplicationAuthenticationProvider.java:114)
	at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.github.v4.GraphqlCheckRunProvider.createCheckRun(GraphqlCheckRunProvider.java:96)
	at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.github.GithubPullRequestDecorator.decorateQualityGateStatus(GithubPullRequestDecorator.java:39)
	... 21 common frames omitted
2020.02.17 09:14:05 INFO  ce[AXBSbQ3vn21drEDcQ0_h][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request Decoration | status=FAILED | time=1326ms
2020.02.17 09:14:05 INFO  ce[AXBSbQ3vn21drEDcQ0_h][o.s.c.t.CeWorkerImpl] Executed task | project=sample-ms | type=REPORT | pullRequest=3 | id=AXBSbQ3vn21drEDcQ0_h | submitter=admin | status=SUCCESS | time=1856ms

Expected behavior
Pull request decorator on github pull request.

Software Versions

  • SonarQube Version: Version 8.1 (build 31237)
  • Plugin Version: custom build from master at commit fdb382a

Additional context

projectPath is null, I tried to debug why with no success.

I guess there is some configuration missing, but I don't know which one.

@ndeitch ndeitch added the bug Something isn't working label Feb 17, 2020
@mc1arke
Copy link
Owner

mc1arke commented Feb 17, 2020

I think this may be an error in the code:

reads the ALM Slug as the project path, which is set in the Github Binding WS:
I think that that first block should be String projectPath = projectAlmSettings.getAlmRepo(), although I can't remember if that path is project/repo or just repo.

@ndeitch
Copy link
Contributor Author

ndeitch commented Feb 17, 2020

@mc1arke I made the change you said and it's working. Should I open a PR?

@mc1arke
Copy link
Owner

mc1arke commented Feb 17, 2020

Yes please.

mc1arke pushed a commit that referenced this issue Feb 20, 2020
The Github ALM Binding Web Service uses the `AlmRepo` field to store the repository name, but the Github decorator was using `AlmSlug` to try and retrieve the repository name, so was getting a `null` value back and failing to find a matching repository. Switching to using `AlmRepo` in the decorator overcomes this issues.
@mc1arke
Copy link
Owner

mc1arke commented Feb 20, 2020

Fixed in #92

@mc1arke mc1arke closed this as completed Feb 20, 2020
mc1arke pushed a commit that referenced this issue Apr 19, 2020
The Github ALM Binding Web Service uses the `AlmRepo` field to store the repository name, but the Github decorator was using `AlmSlug` to try and retrieve the repository name, so was getting a `null` value back and failing to find a matching repository. Switching to using `AlmRepo` in the decorator overcomes this issues.
mc1arke pushed a commit that referenced this issue Apr 20, 2020
The Github ALM Binding Web Service uses the `AlmRepo` field to store the repository name, but the Github decorator was using `AlmSlug` to try and retrieve the repository name, so was getting a `null` value back and failing to find a matching repository. Switching to using `AlmRepo` in the decorator overcomes this issues.
mc1arke pushed a commit that referenced this issue May 17, 2020
The Github ALM Binding Web Service uses the `AlmRepo` field to store the repository name, but the Github decorator was using `AlmSlug` to try and retrieve the repository name, so was getting a `null` value back and failing to find a matching repository. Switching to using `AlmRepo` in the decorator overcomes this issues.
mc1arke pushed a commit that referenced this issue May 17, 2020
The Github ALM Binding Web Service uses the `AlmRepo` field to store the repository name, but the Github decorator was using `AlmSlug` to try and retrieve the repository name, so was getting a `null` value back and failing to find a matching repository. Switching to using `AlmRepo` in the decorator overcomes this issues.
mc1arke pushed a commit that referenced this issue Jun 7, 2020
The Github ALM Binding Web Service uses the `AlmRepo` field to store the repository name, but the Github decorator was using `AlmSlug` to try and retrieve the repository name, so was getting a `null` value back and failing to find a matching repository. Switching to using `AlmRepo` in the decorator overcomes this issues.
mc1arke pushed a commit that referenced this issue Jun 7, 2020
The Github ALM Binding Web Service uses the `AlmRepo` field to store the repository name, but the Github decorator was using `AlmSlug` to try and retrieve the repository name, so was getting a `null` value back and failing to find a matching repository. Switching to using `AlmRepo` in the decorator overcomes this issues.
mc1arke pushed a commit that referenced this issue Jun 7, 2020
The Github ALM Binding Web Service uses the `AlmRepo` field to store the repository name, but the Github decorator was using `AlmSlug` to try and retrieve the repository name, so was getting a `null` value back and failing to find a matching repository. Switching to using `AlmRepo` in the decorator overcomes this issues.
mc1arke pushed a commit that referenced this issue Jun 7, 2020
The Github ALM Binding Web Service uses the `AlmRepo` field to store the repository name, but the Github decorator was using `AlmSlug` to try and retrieve the repository name, so was getting a `null` value back and failing to find a matching repository. Switching to using `AlmRepo` in the decorator overcomes this issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants