aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/model/build-status.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-03-06 22:54:07 +0000
committerChristopher Baines <mail@cbaines.net>2019-03-06 22:56:10 +0000
commit4d0d6f2e82cb997beff162237585a5b3def9c384 (patch)
treec135f5982013f3638e6a5b0e3caacd3aa924501a /guix-data-service/model/build-status.scm
parent8bef36a95ebe616a646a4616dda01ef83bd0a829 (diff)
downloaddata-service-4d0d6f2e82cb997beff162237585a5b3def9c384.tar
data-service-4d0d6f2e82cb997beff162237585a5b3def9c384.tar.gz
Add new models relating to builds and build servers
These will allow tracking what's going on with build servers.
Diffstat (limited to 'guix-data-service/model/build-status.scm')
-rw-r--r--guix-data-service/model/build-status.scm36
1 files changed, 36 insertions, 0 deletions
diff --git a/guix-data-service/model/build-status.scm b/guix-data-service/model/build-status.scm
new file mode 100644
index 0000000..d6fde3a
--- /dev/null
+++ b/guix-data-service/model/build-status.scm
@@ -0,0 +1,36 @@
+(define-module (guix-data-service model build-status)
+ #:use-module (squee)
+ #:export (build-statuses
+ insert-build-status))
+
+(define build-statuses
+ '((-2 . "scheduled")
+ (-1 . "started")
+ (0 . "succeeded")
+ (1 . "failed")
+ (2 . "failed-dependency")
+ (3 . "failed-other")
+ (4 . "canceled")))
+
+(define (insert-build-status conn internal-build-id
+ starttime stoptime status)
+ (exec-query conn
+ (string-append
+ "INSERT INTO build_status "
+ "(internal_build_id, starttime, stoptime, status) "
+ "VALUES "
+ "(" internal-build-id ", "
+ (if (eq? starttime 0)
+ "NULL"
+ (string-append "to_timestamp("
+ (number->string starttime)
+ ")"))
+ ", "
+ (if (eq? stoptime 0)
+ "NULL"
+ (string-append "to_timestamp("
+ (number->string stoptime)
+ ")"))
+ ", "
+ "'" status "'"
+ ")")))