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

Github exception - UpdateCheckRunInput doesn't accept argument 'headSha' #969

Open
ramunasd opened this issue Sep 27, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@ramunasd
Copy link

Describe the bug
Sonarqube cannot decorate PR and throws exception

2024.09.26 16:10:30 ERROR ce[7b2f5da9-3e61-4ecd-822a-e30bebb182e0][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Execution of task class com.github.mc1arke.sonarqube.plugin.ce.pullrequest.PullRequestPos
tAnalysisTask failed
java.lang.IllegalStateException: Could not decorate Pull Request on Github
        at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.github.GithubPullRequestDecorator.decorateQualityGateStatus(GithubPullRequestDecorator.java:96)
        at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.PullRequestPostAnalysisTask.finished(PullRequestPostAnalysisTask.java:139)
        at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.executeTask(PostProjectAnalysisTasksExecutor.java:101)
        at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.finished(PostProjectAnalysisTasksExecutor.java:92)
        at org.sonar.ce.task.step.ComputationStepExecutor.executeListener(ComputationStepExecutor.java:89)
        at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:61)
        at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:75)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:212)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:194)
        at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:160)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:135)
        at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:87)
        at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
        at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
        at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:76)
        at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: An error was returned in the response from the Github API:
- Error{message='InputObject 'UpdateCheckRunInput' doesn't accept argument 'headSha'', locations=[Location{line='22', column='11376'}]}
        at com.github.mc1arke.sonarqube.plugin.almclient.github.v4.GraphqlGithubClient.executeRequest(GraphqlGithubClient.java:246)
        at com.github.mc1arke.sonarqube.plugin.almclient.github.v4.GraphqlGithubClient.reportRemainingAnnotations(GraphqlGithubClient.java:280)
        at com.github.mc1arke.sonarqube.plugin.almclient.github.v4.GraphqlGithubClient.createCheckRun(GraphqlGithubClient.java:112)
        at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.github.GithubPullRequestDecorator.decorateQualityGateStatus(GithubPullRequestDecorator.java:88)
        ... 21 common frames omitted

To Reproduce
Steps to reproduce the behavior:

  1. Add new project
  2. Setup github integration
  3. create a PR

Expected behavior
a PR is decorated with analysis results

Software Versions

  • SonarQube Version: v10.6 (92116) Community edition
  • Plugin Version: 1.22.0

Additional context
Most projects works fine, only some fails to decorate PR. Not sure what are differencies.

@ramunasd ramunasd added the bug Something isn't working label Sep 27, 2024
@mc1arke
Copy link
Owner

mc1arke commented Oct 5, 2024

I suspect this only happens when you have more than 50 findings in a Pull Request, as the additional findings are submitted through UpdateCheckRun, whereas the first 50 are submitted through CreateCheckRun. UpdateCheckRun doesn't take a headSha property, but CreateCheckRun does.

I think I unintentionally broke this during a clean-up in #959 as I couldn't remember why I was setting headSha in an odd way during request building, and none of the test failed when I made the change 🤦 .

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