8000 Ignore builds on other branches by rudymatela · Pull Request #148 · channable/hoff · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Ignore builds on other branches #148

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

Merged
merged 5 commits into from
Aug 4, 2022
Merged

Conversation

rudymatela
Copy link
@rudymatela rudymatela commented Aug 2, 2022

closes: #147

If there are two builds on different branches but with the same hash, GitHub reports these at least twice! (Once per branch.) This makes it so that we only consider build status changes on the actual relevant testing branch. There's a detailed explanation here.

  • parse the branches list sent by GitHub
  • update send-webhook to include the list of branches
  • ignore other branches on BuildStatusChanged
  • add specific test with repeated build status update for a sha but different branches. The status for the other branch should be ignore
  • mark for review
  • amend if needed
  • merge

@rudymatela rudymatela self-assigned this Aug 2, 2022
@rudymatela rudymatela added the bug Something isn't working label Aug 2, 2022
@rudymatela rudymatela marked this pull request as ready for review August 3, 2022 09:11
@rudymatela rudymatela requested a review from FPtje August 3, 2022 09:12
@rudymatela
Copy link
Author
rudymatela commented Aug 3, 2022

@FPtje This is a fix for the multiple-comment issue you and Bert reported yesterday. Can you please review when you have the time?

GitHub's documentation isn't super clear of what's the criteria for including the branch in the branches list: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#status. Here's what it says:

"An array of branch objects containing the status' SHA. Each branch contains the given SHA, but the SHA may or may not be the head of the branch. The array includes a maximum of 10 branches."

If that's true in the most straightforward interpretation, there is no way to actually identify the "canonical" build for a sha in a branch! In this PR I assume the list only includes the branches for which the build refers to (this would make more sense). In the case of Semaphore, there can be multiple builds for the same commit sha if they are on different branches.

My plan is to see in practice what happens after we deploy this change:

  1. if it only includes the relevant branch, the issue is fixed;
  2. if it includes all branches containing the sha (even those that do not refer to the build, the issue will still be present, but Hoff will continue working "as-is".

In case of "2.", I will have to prepare a second PR where different URLs for the same SHA are simply ignored. This will make Hoff "internally inconsistent" but at least we will not get duplicate comments. Either way, we will get a clarification of what exactly GitHub does because the webhook PR branches will be logged.

@FPtje
Copy link
FPtje commented Aug 3, 2022

I'm a little short on time. @frank-channable could you review? Thanks!

@FPtje FPtje requested review from frank-channable and removed request for FPtje August 3, 2022 10:02
@rudymatela
Copy link
Author

@frank-channable Thanks for the review.

@OpsBotPrime mergeee

@OpsBotPrime
Copy link

Pull request approved for merge by @rudymatela, rebasing now.

Approved-by: rudymatela
Auto-deploy: false
@OpsBotPrime
Copy link

Rebased as 88a0ec6, waiting for CI …

@OpsBotPrime
Copy link

CI job started.

@rudymatela
Copy link
Author

@OpsBotPrime mergeee

@OpsBotPrime You do accept trailing alphabetic characters... Interesting...

@OpsBotPrime
Copy link

CI job started.

@rudymatela
Copy link
Author

@OpsBotPrime test.

@OpsBotPrime
Copy link

That was not a valid command.

@rudymatela
Copy link
Author

@OpsBotPrime merge

@OpsBotPrime
Copy link

CI job started.

@rudymatela
Copy link
Author

CI job started.

This makes sense. The reply to the merge command when it is in progress is the current status: "CI job started". 👍

@OpsBotPrime OpsBotPrime merged commit 88a0ec6 into master Aug 4, 2022
@OpsBotPrime OpsBotPrime deleted the fix/ignore-other-branch-builds branch August 4, 2022 13:27
rudymatela added a commit that referenced this pull request Aug 5, 2022
This reverts commit 88a0ec6, reversing
changes made to 78cfbfb.

The changes in PR #148 did not fix what it was intended to fix (#147).
At the same time they introduced a bug in extreme cases: when more than 10
branches point to the same commit, we may loose a build status change
notification on the right branch.

We could maintain these changes partially to include logging what branches
githubs lists, but I don't think the maintaining costs justify this.
@rudymatela
Copy link
Author

Message from the future: this merge has been reverted in faf04c9.

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

Successfully merging this pull request may close these issues.

Duplicate "CI job" messages
4 participants
0