Skip to content

updateCheckRun call fails since 1.128 #1157

Closed

Description

@hcoles

As originally raised in #1156, calls to update check runs that worked in 1.122 now fail once the enum mapping issue is worked around.

The following code

   GitHub github = new GitHubBuilder()
       .withOAuthToken("value supplied by github actions")
       .withEndpoint("value supplied by github actions")
       .build();

   GHCheckRun checkRun = repo.createCheckRun("whatever", "value supplied by github actions").withStatus(GHCheckRun.Status.IN_PROGRESS).create();

   repo.updateCheckRun(checkRun.getId())
      .add(output)
      .withConclusion(GHCheckRun.Conclusion.SUCCESS)
      .withStatus(GHCheckRun.Status.COMPLETED)
      .create();

Runs without issue in 1.122 to 1.127, but fails during the updateCheckRun call from 1.128 onwards with

Caused by: org.kohsuke.github.GHFileNotFoundException: https://api.github.com/repos/XXX/XXX/check-runs/2676567691 {"message":"Not Found","documentation_url":"https://docs.github.com/rest"}
    at org.kohsuke.github.GitHubClient.interpretApiError (GitHubClient.java:482)
    at org.kohsuke.github.GitHubClient.sendRequest (GitHubClient.java:409)
    at org.kohsuke.github.GitHubClient.sendRequest (GitHubClient.java:357)
    at org.kohsuke.github.Requester.fetch (Requester.java:76)
    at org.kohsuke.github.GHCheckRunBuilder.create (GHCheckRunBuilder.java:153)

@gsmet has indicated that this represents an authentication failure, however it seems strange that the call to create the checkrun succeeds, while the call to update it fails using the same credentials.

Activity

  1. gsmet commented on May 26, 2021

    @gsmet
    Contributor

    Ah yeah, if the check creation succeeds, then there might be something else going on.

  2. changed the title [-]Authentication regression introduced in 1.128[/-] [+]updateCheckRun call fails since 1.128[/+] on May 27, 2021
  3. hcoles commented on May 27, 2021

    @hcoles
    Author

    Just had a little dig through the git history, and the change that seems to break things is this

    8e20f4d

    change for #754

    It seems that github does not support X-HTTP-Method-Override for this call.

  4. gsmet commented on May 27, 2021

    @gsmet
    Contributor

    Interesting. That explains why I didn't see it in my GitHub App as I'm using the OkHttp connector.

  5. hcoles commented on May 27, 2021

    @hcoles
    Author

    Yes, looks like I can workaround this with OkHttp.

  6. bitwiseman commented on May 27, 2021

    @bitwiseman
    Member

    @hcoles

    It seems that github does not support X-HTTP-Method-Override for this call.

    😭🤦

    Hm, so if I rerecorded the tests from #754 they would probably now fail. The question is do we revert #754?

  7. gsmet commented on May 27, 2021

    @gsmet
    Contributor

    I really am baffled that we are still struggling with this in 2021...

    You can report this to GitHub but they are relatively slow to fix things in the APIs so I don't think we have much choice unfortunately.

    But that means we need to use the new JDK Http Client introduced in Java 11 for JDK 11+ if we don't want to have recent JDK complaining about this reflection. I think it fixes this, right?

    So if I had to go with a plan, that would be:

  8. hcoles commented on May 27, 2021

    @hcoles
    Author

    @gsmet You could perhaps provide both versions as Java11AndBelowGithubClient and Java12PlusGithubClient or something similar, but less clunky, so it becomes the caller's problem to choose?

    I will be switching to OkHttp. I'd rather not have the dependency, but I'll need to support all of 8, 11, and 16.

  9. hcoles commented on May 27, 2021

    @hcoles
    Author

    Not directly relevant to this issue, but previously I tried calls out from Junit using a personal access token. This now fails when calling the checks api with a message saying I must authenticate as a github app.

    Can anyone confirm that this is a behaviour change, or is my memory flakey? Also, is there an easy workaround?

  10. gsmet commented on May 27, 2021

    @gsmet
    Contributor

    I think we need to make the correct client the automatic default. It can be done using a MR jar (but it's some infrastructure).

    As for your issue with a PAT, you are providing it directly or using ~/.github? If you provide it to the API, maybe GH has changed something on their side. I must admit that I develop GitHub Apps so I don't really know.

  11. gsmet commented on May 27, 2021

    @gsmet
    Contributor

    BTW, if you end up having to develop a GitHub App, my pet project might be of interest to you: https://github.com/quarkiverse/quarkus-github-app .

  12. hcoles commented on May 27, 2021

    @hcoles
    Author

    I provide the token directly.

    Thanks for the link, I've been wanting an excuse to play with quarkus.

  13. bitwiseman commented on May 27, 2021

    @bitwiseman
    Member

    @hcoles
    Okhttp also support caching which is generally huge improvement for rate limit usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions