aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-03-01 15:50:40 +0100
committerLudovic Courtès <ludo@gnu.org>2018-03-01 15:50:40 +0100
commitf083282fd3bf813fda0b54ed33278d2d5325dfa1 (patch)
treeca91c8fbca22390f0c3c57cd355355e6b940aa88 /src
parentbe3650d96518f2f6903d21e7edf6d67ccb8847d4 (diff)
downloadcuirass-f083282fd3bf813fda0b54ed33278d2d5325dfa1.tar
cuirass-f083282fd3bf813fda0b54ed33278d2d5325dfa1.tar.gz
http: Return build completion time as #:timestamp when completed.
* src/cuirass/http.scm (build->hydra-build): Set #:timestamp to #:stoptime when BUILD is finished.
Diffstat (limited to 'src')
-rw-r--r--src/cuirass/http.scm19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index 0548184..9a379da 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -35,11 +35,23 @@
(define (bool->int bool)
(if bool 1 0))
+ (define finished?
+ (bool->int
+ (not (memv (assq-ref build #:status)
+ (list (build-status scheduled)
+ (build-status started))))))
+
`((#:id . ,(assq-ref build #:id))
(#:project . ,(assq-ref build #:repo-name))
(#:jobset . ,(assq-ref build #:branch))
(#:job . ,(assq-ref build #:job-name))
- (#:timestamp . ,(assq-ref build #:timestamp))
+
+ ;; Hydra's API uses "timestamp" as the time of the last useful event for
+ ;; that build: evaluation or completion.
+ (#:timestamp . ,(if finished?
+ (assq-ref build #:stoptime)
+ (assq-ref build #:timestamp)))
+
(#:starttime . ,(assq-ref build #:starttime))
(#:stoptime . ,(assq-ref build #:stoptime))
(#:derivation . ,(assq-ref build #:derivation))
@@ -50,10 +62,7 @@
(#:busy . ,(bool->int (eqv? (build-status started)
(assq-ref build #:status))))
(#:priority . 0)
- (#:finished . ,(bool->int
- (not (memv (assq-ref build #:status)
- (list (build-status scheduled)
- (build-status started))))))
+ (#:finished . ,finished?)
(#:buildproducts . #nil)
(#:releasename . #nil)
(#:buildinputs_builds . #nil)))