Notifications: summarize Docker Images rebuilds
Summary:
If a new base Docker image is pushed several times in a row,
that will trigger a new build for every dependant image.
We then have a flood of notifications on the channel.
This change bypasses the instant notifications, and instead,
publishes a summary every 30 minutes.
Fixes T790.
Test Plan:
The code is currently live on Wearg.
Proc tests
- notifications::docker_format_builds "a 4 b 5 c 6 d 7" gives a (4x), b (5x), c (6x), d (7x)
- The projects we currently have have been added to the registry registry set notifications.projects [list Wolfplex Keruald Nasqueron] Then, notifications::get_projects gives correctly this list.
Integration test
- put a notification payload to $rawContent
- notifications::docker_build_summary DockerHub Nasqueron docker $rawContent push "image pushed" "somelink" 3x
- notifications::channel_notify_periodics 0 0 0 0 0 prints on the channel New images pushed to Docker Hub: svendowideit/testhook (3x)
- registry get notifications.periodics.docker.Nasqueron returns correctly an empty string at this stage
To test the bind time
The eggdrop binds TCL procedure stores the amount of time a proc
has been triggered. At 15:30 UTC, the counter increased correctly.
15:25:33 <Dereckson> .tcl binds time 15:25:33 <Wearg> Tcl: {time -|- {30 *} 1 ::notifications::channel_notify_periodics} 15:32:49 <Dereckson> .tcl binds time 15:32:49 <Wearg> Tcl: {time -|- {30 *} 2 ::notifications::channel_notify_periodics}
Reviewers: dereckson
Subscribers: Sandlayth
Tags: IRC, Notifications center
Maniphest Tasks: T790
Differential Revision: https://devcentral.nasqueron.org/D347