codecov / engineering-team

This is a general repo to use with GH Projects
2 stars 1 forks source link

Add ability to pin a GH app to a given commit for notifications #1737

Closed trent-codecov closed 6 days ago

trent-codecov commented 3 weeks ago

When a comment/check is made by a specific GH app on a commit, cache which app was used. Use this app on subsequent requests if possible.

giovanni-guidini commented 2 weeks ago

The current idea is to cache the app in Redis. This has some benefits as it's fast to access and shared among the different worker nodes.

The thing is that we problem should treat Redis as a permanent store and give the keys some expiry date. This could be very long, but that might not be ideal. Maybe 15 days is enough time for most cases. This believes in a certain amount of "time locality" in commit notifications that is quite reasonable.

However there are many commits in a Codecov instance over 15 days. We need to make sure that we can hold this much extra data in the instance.

As a "permanent" solution to go with the Redis one we can possibly extend the CommitNotification object (see here) We can save the GitHub app used for the notification and pull that back up if the redis cache is empty.

There's yet another alternative that is to query github directly. Their API returns the app used to send a check (not status) OR comment.