Skip to content
Snippets Groups Projects

Iss #98 - Initial commit of Github webhooks code

Iss #98 - Initial commit of Github webhooks code
5 unresolved threads
Merged Martin Lowe requested to merge (removed):malowe/master/98 into main
5 unresolved threads

Additionally contains code to move API client models to a separate package to allow for application specific models to live separately from consumed upstream models.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
36 36 quarkus.cache.caffeine."record".initial-capacity=${quarkus.cache.caffeine."default".initial-capacity}
37 37 quarkus.cache.caffeine."record".expire-after-write=${quarkus.cache.caffeine."default".expire-after-write}
38 38
39 ## JWT cache, 115 second cache time to make sure there is no accidental sending of an expired token
40 quarkus.cache.caffeine."accesstoken".initial-capacity=1000
41 quarkus.cache.caffeine."accesstoken".expire-after-write=119M
42 ## JWT Placeholders/defaults
43 smallrye.jwt.encrypt.relax-key-validation=true
44 smallrye.jwt.new-token.lifespan=120
45 smallrye.jwt.new-token.issuer=262450
  • 36 36 quarkus.cache.caffeine."record".initial-capacity=${quarkus.cache.caffeine."default".initial-capacity}
    37 37 quarkus.cache.caffeine."record".expire-after-write=${quarkus.cache.caffeine."default".expire-after-write}
    38 38
    39 ## JWT cache, 115 second cache time to make sure there is no accidental sending of an expired token
    40 quarkus.cache.caffeine."accesstoken".initial-capacity=1000
    41 quarkus.cache.caffeine."accesstoken".expire-after-write=119M
    42 ## JWT Placeholders/defaults
    43 smallrye.jwt.encrypt.relax-key-validation=true
    44 smallrye.jwt.new-token.lifespan=120
  • 36 36 quarkus.cache.caffeine."record".initial-capacity=${quarkus.cache.caffeine."default".initial-capacity}
    37 37 quarkus.cache.caffeine."record".expire-after-write=${quarkus.cache.caffeine."default".expire-after-write}
    38 38
    39 ## JWT cache, 115 second cache time to make sure there is no accidental sending of an expired token
    40 quarkus.cache.caffeine."accesstoken".initial-capacity=1000
    41 quarkus.cache.caffeine."accesstoken".expire-after-write=119M
    42 ## JWT Placeholders/defaults
    43 smallrye.jwt.encrypt.relax-key-validation=true
  • 115 * @param request the current webhook update request
    116 * @param state the state to set the status to
    117 * @param fingerprint the internal unique string for the set of commits being processed
    118 */
    119 private void updateCommitStatus(GithubWebhookRequest request, GithubCommitStatuses state, String fingerprint) {
    120 LOGGER
    121 .trace("Generated access token for installation {}: {}", request.getInstallation().getId(),
    122 getAccessToken(request.getInstallation().getId()).getToken());
    123 ghApi
    124 .updateStatus(getBearerString(request.getInstallation().getId()), request.getRepository().getFullName(),
    125 request.getPullRequest().getHead().getSha(),
    126 GithubCommitStatusRequest
    127 .builder()
    128 .setDescription(state.getMessage())
    129 .setState(state.toString())
    130 .setTargetUrl("https://api.eclipse.org/git/eca/status/" + fingerprint + "/ui")
    • I look at API versionning for github, and there is a specific header to add X-GitHub-Api-Version:2022-11-28. See Documentation: https://docs.github.com/en/rest/overview/api-versions?apiVersion=2022-11-28

      I think this header should be considered. WDYT?

    • Author Maintainer

      Requests without the X-GitHub-Api-Version header will default to use the 2022-11-28 version.

      It seems like they default to latest, which should be fine for us. I think adding a version would make it more likely to break as they deprecate old versions.

    • Sticking versions to latest IMO is a bad idea, especially when it can introduce breaking changes to production while relating on a roadmap, and/org a changelog provide the ability to plan, change code, refactor, test, push in production with less stress. But let see how it goes with github since their versionning is not really standard, the changelog is quiet new and I don't know how strict they are with breaking change.

    • Author Maintainer

      I somewhat agree, but I think this will lead to an unexpected break down the line as it's 100% going to be something that is forgotten after it's merged since we only have 2 APIs that use it. If it was graceful in any way I'd have no issue setting a version, but considering the default is to return a bad request for a deprecated version, it's a case of 2 kind of bad options IMO. I think the best way would be to include the recommended version in our base api-common lib, and use that. There's a burden to upgrade, but its less likely to randomly break, and easier to maintain

    • Please register or sign in to reply
  • Martin Lowe added 2 commits

    added 2 commits

    • a2a3db3e - Update GH webhook target to be configurable
    • 0fce3d07 - Update GH API binding to include a base version string

    Compare with previous version

  • Martin Lowe mentioned in commit ad363bea

    mentioned in commit ad363bea

  • merged

  • Please register or sign in to reply
    Loading