Skip to content
Snippets Groups Projects

feat: notifying users with a message when PR validation fails

Open Jordi Gómez requested to merge gnugomez/main/174 into main
  • feat: notify users with a message when PR validation fails

Resolves #174

Edited by Jordi Gómez

Merge request reports

Pipeline #73412 failed

Pipeline failed for f9a74562 on gnugomez/main/174

Approval is optional
Merge blocked: 1 check failed

Merge details

  • 14 commits and 1 merge commit will be added to main.
  • Source branch will be deleted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
241 GithubCommitStatusRequest
242 .builder()
243 .setDescription("Commits in merge group should be previously validated, auto-passing HEAD commit")
246 GithubCommitStatusRequest.builder()
247 .setDescription(
248 "Commits in merge group should be previously validated, auto-passing HEAD commit")
244 249 .setState(GithubCommitStatuses.SUCCESS.toString())
245 .setContext(webhooksConfig.github().context())
250 .setContext(webhooksConfig.github().context()).build());
251 }
252
253 private void commentOnFailure(GithubWebhookRequest request, Set<String> errors) {
254 if (errors.isEmpty()) {
255 return;
256 }
257 StringBuilder sb = new StringBuilder();
  • Martin Lowe
  • 30
    31 @QuarkusTest
    32 class GithubHelperTest {
    33
    34 @Inject
    35 GithubHelper helper;
    36
    37 @RestClient
    38 @InjectSpy
    39 GithubAPI ghApi;
    40
    41 @InjectMock
    42 ValidationService validationService;
    43
    44 @Test
    45 void testHandleGithubWebhookValidation_WithErrors() {
    • I see what you mean about it not really aligning with testing strategy. We do end to end (e2e) testing typically as it gives us full coverage along with the built in filters and interceptros, but if you want to add additional tests outside of the e2e HTTP testing, that's fine as long as it isn't a direct output of the resource. In this case it is a side effect of a certain use case, and while adding it to our e2e testing would be good for completeness, I don't think it's a deal breaker in this case.

    • Author Developer

      I couldn't find a suitable test to serve as a reference. The webhook resource's tests appear straightforward to me.

      Where do you usually store these end-to-end/full-flow tests?

    • TLDR: There is 1 e2e test for the webhook, as it uses the same logic as the normal validation, with majority of the code working to convert the GH webhook request to the standard model. Having more e2e tests would be good, as this API has recently been designated as a tier1 service.

    • Jordi Gómez changed this line in version 19 of the diff

      changed this line in version 19 of the diff

    • Please register or sign in to reply
  • 238 .updateStatus(jwtHelper.getGhBearerString(request.getInstallation().getId()), apiVersion,
    243 ghApi.updateStatus(jwtHelper.getGhBearerString(request.getInstallation().getId()), apiVersion,
    239 244 request.getRepository().getOwner().getLogin(), request.getRepository().getName(),
    240 245 request.getMergeGroup().getHeadSha(),
    241 GithubCommitStatusRequest
    242 .builder()
    243 .setDescription("Commits in merge group should be previously validated, auto-passing HEAD commit")
    246 GithubCommitStatusRequest.builder()
    247 .setDescription(
    248 "Commits in merge group should be previously validated, auto-passing HEAD commit")
    244 249 .setState(GithubCommitStatuses.SUCCESS.toString())
    245 .setContext(webhooksConfig.github().context())
    250 .setContext(webhooksConfig.github().context()).build());
    251 }
    252
    253 private void commentOnFailure(GithubWebhookRequest request, Set<String> errors) {
  • Martin Lowe
  • Jordi Gómez added 1 commit

    added 1 commit

    Compare with previous version

  • Jordi Gómez added 1 commit

    added 1 commit

    Compare with previous version

  • Jordi Gómez added 1 commit

    added 1 commit

    • 7cfa5005 - chore: adding missing license header

    Compare with previous version

  • Jordi Gómez changed the description

    changed the description

  • Jordi Gómez added 2 commits

    added 2 commits

    • 930fc063 - chore: adding missing JavaDoc
    • 2d7883cc - feat: using Qute to create a more flexible message template

    Compare with previous version

  • Jordi Gómez added 1 commit

    added 1 commit

    • a1019488 - feat: using Qute to create a more flexible message template

    Compare with previous version

  • Jordi Gómez added 1 commit

    added 1 commit

    Compare with previous version

  • Jordi Gómez added 1 commit

    added 1 commit

    Compare with previous version

  • Jordi Gómez added 1 commit

    added 1 commit

    Compare with previous version

  • Jordi Gómez changed the description

    changed the description

  • Jordi Gómez changed title from Draft: feat: adding base support for sending messages when a PR validation fails to Draft: feat: notify users with a message when PR validation fails

    changed title from Draft: feat: adding base support for sending messages when a PR validation fails to Draft: feat: notify users with a message when PR validation fails

  • Jordi Gómez added 1 commit

    added 1 commit

    • 883e4abb - feat: checking for existing comments before commenting one more time

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading