From 12def48b3bf665edcf227ab3afbcdeda87198b61 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 21 Oct 2019 22:43:16 +0100 Subject: Support publishing build events Add a table to store events, which have a type and a JSON blob. These can be used to record changes, this commit inserts events when new builds are created, and when the status of builds change. The EventsOutbox table is then used to track when events have been sent out. This is done through the new cuirass-send-events script. * Makefile.am (bin_SCRIPTS): Add bin/cuirass-send-events. .gitignore: Add bin/cuirass-send-events. (dist_pkgmodule_DATA): Add src/cuirass/send-events.scm. (dist_sql_DATA): Add src/sql/upgrade-5.sql. (EXTRA_DIST): bin/cuirass-send-events.in. (bin/cuirass-send-events): New rule. * bin/cuirass-send-events.in: New file. * src/cuirass/send-events.scm: New file. * src/sql/upgrade-5.sql: New file. * src/cuirass/database.scm (changes-count): New procedure. (db-update-build-status!): Call db-add-event after updating the build status. (db-add-event): New procedure. (db-add-build): Insert an event when a new build is inserted. (db-delete-events-with-ids-<=-to): New procedure. * src/schema.sql (Events): New table. --- Makefile.am | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Makefile.am') diff --git a/Makefile.am b/Makefile.am index 7cea2ff..5448420 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,7 +21,7 @@ # You should have received a copy of the GNU General Public License # along with Cuirass. If not, see . -bin_SCRIPTS = bin/cuirass bin/evaluate +bin_SCRIPTS = bin/cuirass bin/cuirass-send-events bin/evaluate noinst_SCRIPTS = pre-inst-env guilesitedir = $(datarootdir)/guile/site/@GUILE_EFFECTIVE_VERSION@ @@ -45,6 +45,7 @@ dist_pkgmodule_DATA = \ src/cuirass/database.scm \ src/cuirass/http.scm \ src/cuirass/logging.scm \ + src/cuirass/send-events.scm \ src/cuirass/ui.scm \ src/cuirass/utils.scm \ src/cuirass/templates.scm @@ -68,7 +69,8 @@ dist_sql_DATA = \ src/sql/upgrade-1.sql \ src/sql/upgrade-2.sql \ src/sql/upgrade-3.sql \ - src/sql/upgrade-4.sql + src/sql/upgrade-4.sql \ + src/sql/upgrade-5.sql dist_css_DATA = \ src/static/css/bootstrap.css \ @@ -143,6 +145,7 @@ sql-check: src/schema.sql EXTRA_DIST = \ .dir-locals.el \ bin/cuirass.in \ + bin/cuirass-send-events.in \ bin/evaluate.in \ bootstrap \ build-aux/guix.scm \ @@ -202,6 +205,7 @@ generate_file = \ # These files depend on Makefile so they are rebuilt if $(VERSION), # $(datadir) or other do_subst'ituted variables change. bin/cuirass: $(srcdir)/bin/cuirass.in +bin/cuirass-send-events: $(srcdir)/bin/cuirass-send-events.in bin/evaluate: $(srcdir)/bin/evaluate.in $(bin_SCRIPTS): Makefile $(generate_file); chmod +x $@ -- cgit v1.2.3