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

PR decoration fails to post to github enterprise 3.0.0.rc1 #297

Closed
foragerr opened this issue Jan 27, 2021 · 3 comments
Closed

PR decoration fails to post to github enterprise 3.0.0.rc1 #297

foragerr opened this issue Jan 27, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@foragerr
Copy link

Describe the bug

After a sonarscan in the CI system, sonarqube server-side processing shows success; branches and PRs show up in the project, but PR decoration both on the Checks tab and the Conversation tab do not show up on Github Enterprise.

To Reproduce
Steps to reproduce the behavior:

  1. bring up new instance of sonarqube,
  2. configure ALM integration at both server and project level
  3. Perform project scan for branch
  4. Perform project scan for PR

Expected behavior
PR decoration gets posted to the Github UI, both on the Checks tab and a summary on the Conversation tab

Screenshots

Software Versions

  • SonarQube Version: 8.5.1.38104
  • Plugin Version: 1.6.0
  • Github Enterprise 3.0.0.rc1

Additional context
My prime suspect is Github Enterprise because it is the newest component in the mix, and it is an rc1 release. Generally GHE lags behind github.com slightly so code, apis etc are already well tested - but there are no guarantees - it's possible something in GH API changed in v3.0

I turned on debug logging on sonarqube ce and the logs seem to show successful posting of PR decoration as far as I can tell - all HTTP 2XX responses. I am now trying to figure out how I can debug on the GHE end.

debug logs:

2021.01.27 17:41:59 INFO  ce[AXdE8A1DffVAMtHs0CYh][c.g.m.s.p.c.p.PullRequestPostAnalysisTask] using pull request decorator github

2021.01.27 17:41:59 DEBUG ce[AXdE8A1DffVAMtHs0CYh][s.n.w.p.h.HttpURLConnection] sun.net.www.MessageHeader@3660ebed6 pairs: {GET /api/v3/app/installations HTTP/1.1: null}{Accept: application/vnd.github.machine-man-preview+json}{Authorization: *** }{User-Agent: Java/11.0.8}{Host: github-staging.***.com}{Connection: keep-alive}

2021.01.27 17:42:00 DEBUG ce[AXdE8A1DffVAMtHs0CYh][s.n.w.p.h.HttpURLConnection] sun.net.www.MessageHeader@6fdcbadf21 pairs: {null: HTTP/1.1 200 OK}{Server: GitHub.com}{Date: Wed, 27 Jan 2021 17:42:00 GMT}{Content-Type: application/json; charset=utf-8}{Content-Length: 2029}{Status: 200 OK}{Cache-Control: public, max-age=60, s-maxage=60}{Vary: Accept}{ETag: "0b7fedb28f969b709af4a73c3a313ca0916623ead9682575908cb389a432a20e"}{X-GitHub-Enterprise-Version: 3.0.0}{X-GitHub-Media-Type: github.v3; param=machine-man-preview; format=json}{Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset}{Access-Control-Allow-Origin: *}{X-GitHub-Request-Id: b59e82ee-b8b6-45bd-9ad9-c11688ef638a}{Strict-Transport-Security: max-age=31536000; includeSubdomains}{X-Frame-Options: deny}{X-Content-Type-Options: nosniff}{X-XSS-Protection: 1; mode=block}{Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin}{Content-Security-Policy: default-src 'none'}{X-Runtime-Rack: 0.794905}

--
2021.01.27 17:42:00 DEBUG ce[AXdE8A1DffVAMtHs0CYh][s.n.w.p.h.HttpURLConnection] sun.net.www.MessageHeader@42b28a276 pairs: {POST /api/v3/app/installations/3/access_tokens HTTP/1.1: null}{Accept: application/vnd.github.machine-man-preview+json}{Authorization: *** }{User-Agent: Java/11.0.8}{Host: github-staging.***.com}{Connection: keep-alive}

2021.01.27 17:42:00 DEBUG ce[AXdE8A1DffVAMtHs0CYh][s.n.w.p.h.HttpURLConnection] sun.net.www.MessageHeader@380184ec21 pairs: {null: HTTP/1.1 201 Created}{Server: GitHub.com}{Date: Wed, 27 Jan 2021 17:42:00 GMT}{Content-Type: application/json; charset=utf-8}{Content-Length: 213}{Status: 201 Created}{Cache-Control: public, max-age=60, s-maxage=60}{Vary: Accept}{ETag: "0ff449a7e2d6640c56127c3f748e181e05290af99f58caabfa8c84d925e7e59f"}{X-GitHub-Enterprise-Version: 3.0.0}{X-GitHub-Media-Type: github.v3; param=machine-man-preview; format=json}{Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset}{Access-Control-Allow-Origin: *}{X-GitHub-Request-Id: f058dcdf-4aa0-4471-96cf-7a4a9666f68d}{Strict-Transport-Security: max-age=31536000; includeSubdomains}{X-Frame-Options: deny}{X-Content-Type-Options: nosniff}{X-XSS-Protection: 1; mode=block}{Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin}{Content-Security-Policy: default-src 'none'}{X-Runtime-Rack: 0.020357}

--
2021.01.27 17:42:00 DEBUG ce[AXdE8A1DffVAMtHs0CYh][s.n.w.p.h.HttpURLConnection] sun.net.www.MessageHeader@90f2f826 pairs: {GET /api/v3/installation/repositories HTTP/1.1: null}{Accept: application/vnd.github.machine-man-preview+json}{Authorization: *** }{User-Agent: Java/11.0.8}{Host: github-staging.***.com}{Connection: keep-alive}

2021.01.27 17:42:00 DEBUG ce[AXdE8A1DffVAMtHs0CYh][s.n.w.p.h.HttpURLConnection] sun.net.www.MessageHeader@30f763e21 pairs: {null: HTTP/1.1 200 OK}{Server: GitHub.com}{Date: Wed, 27 Jan 2021 17:42:00 GMT}{Content-Type: application/json; charset=utf-8}{Content-Length: 21331}{Status: 200 OK}{Cache-Control: private, max-age=60, s-maxage=60}{Vary: Accept, Authorization, Cookie, X-GitHub-OTP}{ETag: "bd0be6469c48d9821e6e5e23d6fd5555fd067c3c5d51a575dc1b95feff0155e0"}{X-GitHub-Enterprise-Version: 3.0.0}{X-GitHub-Media-Type: github.v3; param=machine-man-preview; format=json}{Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset}{Access-Control-Allow-Origin: *}{X-GitHub-Request-Id: 18f6c497-2d65-4734-a36b-0e63b6b5c3eb}{Strict-Transport-Security: max-age=31536000; includeSubdomains}{X-Frame-Options: deny}{X-Content-Type-Options: nosniff}{X-XSS-Protection: 1; mode=block}{Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin}{Content-Security-Policy: default-src 'none'}{X-Runtime-Rack: 0.044274}

--
021.01.27 17:42:00 DEBUG ce[AXdE8A1DffVAMtHs0CYh][c.g.m.s.p.c.p.g.v.GraphqlCheckRunProvider] Using request: mutation { createCheckRun (input:{conclusion:SUCCESS,output:{summary:"![Passed](https://sonarqube.***.com/static/communityBranchPlugin/checks/QualityGateBadge/passed.svg?sanitize=true)\n\n# Analysis Details\n## 0 Issues\n- ![Bug](https://sonarqube.***.com/static/communityBranchPlugin/common/bug.svg?sanitize=true)0 Bugs\n- ![Vulnerability](https://sonarqube.***.com/static/communityBranchPlugin/common/vulnerability.svg?sanitize=true)0 Vulnerabilities\n- ![Code Smell](https://sonarqube.***.com/static/communityBranchPlugin/common/code_smell.svg?sanitize=true)0 Code Smells\n\n## Coverage and Duplications\n- ![No coverage information](https://sonarqube.***.com/static/communityBranchPlugin/checks/CoverageChart/NoCoverageInfo.svg?sanitize=true)No coverage information (0.00% Estimated after merge)\n- ![No duplication information](https://sonarqube.***.com/static/communityBranchPlugin/checks/Duplications/NoDuplicationInfo.svg?sanitize=true)No duplication information (2.40% Estimated after merge)\n\n[View in SonarQube](https://sonarqube.***.com/dashboard?id=library-***.Core&pullRequest=2)",annotations:[],title:"Quality Gate success"},completedAt:"2021-01-27T17:42:00Z",detailsUrl:"https://sonarqube.***.com/dashboard?id=library-***.Core&pullRequest=2",repositoryId:"MDEwOlJlcG9zaXRvcnkyMA==",name:"library-***.Core Sonarqube Results",startedAt:"2021-01-27T17:41:53Z",externalId:"AXdE8A3HfmuNuGX8Iu6q",headSha:"16565eae53e8cdc39084ce3f5cdc42c5cd968b98",status:COMPLETED}) { clientMutationId checkRun { id } } } 

2021.01.27 17:42:00 DEBUG ce[AXdE8A1DffVAMtHs0CYh][s.n.w.p.h.HttpURLConnection] sun.net.www.MessageHeader@47da32ee11 pairs: {POST /api/graphql HTTP/1.1: null}{Content-Type: application/json}{Accept: application/vnd.github.antiope-preview+json}{charset: utf-8}{Authorization: *** }{Cache-Control: no-cache}{Pragma: no-cache}{User-Agent: Java/11.0.8}{Host: github-staging.***.com}{Connection: keep-alive}{Content-Length: 1789}

2021.01.27 17:42:00 DEBUG ce[AXdE8A1DffVAMtHs0CYh][s.n.w.p.h.HttpURLConnection] sun.net.www.MessageHeader@1393a8023 pairs: {null: HTTP/1.1 200 OK}{Server: GitHub.com}{Date: Wed, 27 Jan 2021 17:42:00 GMT}{Content-Type: application/json; charset=utf-8}{Content-Length: 94}{Status: 200 OK}{Cache-Control: no-cache}{X-GitHub-Enterprise-Version: 3.0.0}{X-GitHub-Media-Type: github.v4; param=antiope-preview; format=json}{X-RateLimit-Limit: 5000}{X-RateLimit-Remaining: 5000}{X-RateLimit-Reset: 1611772920}{x-ratelimit-used: 0}{Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset}{Access-Control-Allow-Origin: *}{X-GitHub-Request-Id: 23dee302-3157-4c6d-b928-e22e355851b9}{Strict-Transport-Security: max-age=31536000; includeSubdomains}{X-Frame-Options: deny}{X-Content-Type-Options: nosniff}{X-XSS-Protection: 1; mode=block}{Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin}{Content-Security-Policy: default-src 'none'}{X-Runtime-Rack: 0.098609}

2021.01.27 17:42:00 DEBUG ce[AXdE8A1DffVAMtHs0CYh][c.g.m.s.p.c.p.g.v.GraphqlCheckRunProvider] Received response: GraphQLResponseEntity{errors=null, headers=[Status:200 OK][null:HTTP/1.1 200 OK][Server:GitHub.com][Access-Control-Allow-Origin:*][X-Content-Type-Options:nosniff][X-RateLimit-Reset:1611772920][Date:Wed, 27 Jan 2021 17:42:00 GMT][Referrer-Policy:origin-when-cross-origin, strict-origin-when-cross-origin][X-Frame-Options:deny][Strict-Transport-Security:max-age=31536000; includeSubdomains][Access-Control-Expose-Headers:ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset][X-RateLimit-Remaining:5000][Cache-Control:no-cache][X-GitHub-Media-Type:github.v4; param=antiope-preview; format=json][Content-Security-Policy:default-src 'none'][x-ratelimit-used:0][X-GitHub-Enterprise-Version:3.0.0][X-RateLimit-Limit:5000][X-XSS-Protection:1; mode=block][Content-Length:94][X-Runtime-Rack:0.098609][X-GitHub-Request-Id:23dee302-3157-4c6d-b928-e22e355851b9][Content-Type:application/json; charset=utf-8], response=com.github.mc1arke.sonarqube.plugin.ce.pullrequest.github.v4.CreateCheckRun@e973f1a}

2021.01.27 17:42:00 INFO  ce[AXdE8A1DffVAMtHs0CYh][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request Decoration | status=SUCCESS | time=1047ms
@foragerr foragerr added the bug Something isn't working label Jan 27, 2021
@foragerr
Copy link
Author

foragerr commented Jan 28, 2021

Hmm, this comment is interesting: #27 (comment)

It seems that this don't work with GitHub Actions. When I run the sonar analyse from command line on my local machine, the decoration will be published to the Pull Request. With GitHub Actions pipeline, it doesn't.

I am using Actions. I should probably add that to the top post.

Actions adds some of its own checks to the PR - and performs the sonarscan action. Does the Check that this plugin creates on the PR somehow clash with the existing Actions generated Checks?

@foragerr
Copy link
Author

foragerr commented Jan 28, 2021

And there's a separate logged issue specifically for the Actions case, with a workaround listed. Trying that.
#104 (comment)

... and that works. Well I see the decoration on the Checks tab.

I was expecting to see a comment posted on the Conversation tab as well and I don't. I'm not certain this plugin supports that, looking around a bit more.

This issue is resolved, I'm closing it. I will try to PR this Github Actions workaround to docs.

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

1 participant