Skip to content

Ignore build status changes on just the URL#180

Merged
OpsBotPrime merged 5 commits intomasterfrom
ignore-multiple-build-starts
Aug 31, 2022
Merged

Ignore build status changes on just the URL#180
OpsBotPrime merged 5 commits intomasterfrom
ignore-multiple-build-starts

Conversation

@rudymatela
Copy link

Fixes: #147

This PR makes Hoff ignore build status change where the only change is in the URL. This make it so that "CI job started" messages are not duplicated anymore (or triplicated (or quadruplicated (or quintuplicated (or ...)))).

this solves the problem of multiple CI job started messages.
@rudymatela rudymatela self-assigned this Aug 31, 2022
@rudymatela rudymatela added bug Something isn't working enhancement New feature or request labels Aug 31, 2022
@rudymatela rudymatela marked this pull request as ready for review August 31, 2022 09:24
src/Logic.hs Outdated
Comment on lines +604 to +605
newStatus `supersedes` oldStatus | newStatus == oldStatus = False
(BuildStarted _) `supersedes` (BuildStarted _) = False -- url change, ignore.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a more robust thing to do here is change the guard on the first case from newStatus == oldStatus to something like sameStatusType newStatus oldStatus where sameStatusType is URL-insensitive equality, i.e.

sameStatusType BuildStarted{} BuildStarted{} = True
sameStatusType BuildFailed{}  BuildFailed{}  = True
sameStatusType x              y              = x == y

Thoughts?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alex-mckenna nice trick! Pattern matching using an empty record notation has never occurred to me before.

@rudymatela
Copy link
Author

@alex-mckenna Thanks for the review.

I have amended the PR following your suggestion. Can you please take a look again?

@rudymatela
Copy link
Author

@alex-mckenna Thanks for the speedy re-review. 🎉

@OpsBotPrime merge!

@OpsBotPrime
Copy link

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

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

Rebased as 441d7c7, waiting for CI …

@OpsBotPrime
Copy link

CI job 🟡 started.

@OpsBotPrime OpsBotPrime merged commit 441d7c7 into master Aug 31, 2022
@OpsBotPrime OpsBotPrime deleted the ignore-multiple-build-starts branch August 31, 2022 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate "CI job" messages

3 participants