aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/cuirass.texi18
-rw-r--r--src/cuirass/database.scm20
-rw-r--r--src/cuirass/http.scm4
-rw-r--r--tests/database.scm6
-rw-r--r--tests/http.scm12
5 files changed, 24 insertions, 36 deletions
diff --git a/doc/cuirass.texi b/doc/cuirass.texi
index b5b27e8..4dbb723 100644
--- a/doc/cuirass.texi
+++ b/doc/cuirass.texi
@@ -12,7 +12,8 @@ server.
Copyright @copyright{} 2016, 2017 Mathieu Lirzin@*
Copyright @copyright{} 2017 Mathieu Othacehe@*
-Copyright @copyright{} 2018 Ludovic Courtès
+Copyright @copyright{} 2018 Ludovic Courtès@*
+Copyright @copyright{} 2018 Clément Lassieur
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -438,8 +439,7 @@ $ curl -s "http://localhost:8080/build/2" | jq
@{
"id": 2,
- "project": "guix",
- "jobset": "master",
+ "jobset": "guix",
"job": "acpica-20150410-job",
"timestamp": 1501347493,
"starttime": 1501347493,
@@ -477,11 +477,8 @@ hereafter.
@item id
The unique build id.
-@item project
-The associated specification name, as a string.
-
@item jobset
-The associated specification branch, as a string.
+The associated specification name, as a string.
@item job
The associated job-name, as a string.
@@ -576,9 +573,6 @@ This request accepts a mandatory parameter and multiple optional ones.
@item nr
Limit query result to nr elements. This parameter is @emph{mandatory}.
-@item project
-Filter query result to builds with the given @code{project}.
-
@item jobset
Filter query result to builds with the given @code{jobset}.
@@ -596,10 +590,10 @@ For example, to ask for the ten last builds:
$ curl "http://localhost:8080/api/latestbuilds?nr=10"
@end example
-or the five last builds where project is ``guix'' and jobset ``master'':
+or the five last builds where jobset ``guix'':
@example
-$ curl "http://localhost:8080/api/latestbuilds?nr=5&project=guix&jobset=master"
+$ curl "http://localhost:8080/api/latestbuilds?nr=5&jobset=guix"
@end example
If no builds matching given parameters are found, an empty JSON array is
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index 0dcae30..3627d2e 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -404,7 +404,7 @@ log file for DRV."
(define (db-format-build db build)
(match build
(#(id timestamp starttime stoptime log status derivation job-name system
- nix-name repo-name branch)
+ nix-name repo-name)
`((#:id . ,id)
(#:timestamp . ,timestamp)
(#:starttime . ,starttime)
@@ -416,13 +416,12 @@ log file for DRV."
(#:system . ,system)
(#:nix-name . ,nix-name)
(#:repo-name . ,repo-name)
- (#:outputs . ,(db-get-outputs db id))
- (#:branch . ,branch)))))
+ (#:outputs . ,(db-get-outputs db id))))))
(define (db-get-builds db filters)
"Retrieve all builds in database DB which are matched by given FILTERS.
-FILTERS is an assoc list which possible keys are 'project | 'jobset | 'job |
-'system | 'nr | 'order | 'status."
+FILTERS is an assoc list which possible keys are 'jobset | 'job | 'system |
+'nr | 'order | 'status."
;; XXX Change caller and remove
(define (assqx-ref filters key)
@@ -466,7 +465,7 @@ Assumes that if group id stays the same the group headers stay the same."
(define (finish-group)
(match repeated-row
(#(timestamp starttime stoptime log status derivation job-name system
- nix-name repo-name branch)
+ nix-name repo-name)
`((#:id . ,repeated-builds-id)
(#:timestamp . ,timestamp)
(#:starttime . ,starttime)
@@ -478,8 +477,7 @@ Assumes that if group id stays the same the group headers stay the same."
(#:system . ,system)
(#:nix-name . ,nix-name)
(#:repo-name . ,repo-name)
- (#:outputs . ,outputs)
- (#:branch . ,branch)))))
+ (#:outputs . ,outputs)))))
(define (same-group? builds-id)
(= builds-id repeated-builds-id))
@@ -519,22 +517,20 @@ Assumes that if group id stays the same the group headers stay the same."
(stmt-text (format #f "\
SELECT Builds.id, Outputs.name, Outputs.path, Builds.timestamp, Builds.starttime, Builds.stoptime, Builds.log, Builds.status, Builds.derivation,\
Derivations.job_name, Derivations.system, Derivations.nix_name,\
-Specifications.repo_name, Specifications.branch \
+Specifications.repo_name \
FROM Builds \
INNER JOIN Derivations ON Builds.derivation = Derivations.derivation AND Builds.evaluation = Derivations.evaluation \
INNER JOIN Evaluations ON Derivations.evaluation = Evaluations.id \
INNER JOIN Specifications ON Evaluations.specification = Specifications.repo_name \
LEFT JOIN Outputs ON Outputs.build = Builds.id \
WHERE (:id IS NULL OR (:id = Builds.id)) \
-AND (:project IS NULL OR (:project = Specifications.repo_name)) \
-AND (:jobset IS NULL OR (:jobset = Specifications.branch)) \
+AND (:jobset IS NULL OR (:jobset = Specifications.repo_name)) \
AND (:job IS NULL OR (:job = Derivations.job_name)) \
AND (:system IS NULL OR (:system = Derivations.system)) \
AND (:status IS NULL OR (:status = 'done' AND Builds.status >= 0) OR (:status = 'pending' AND Builds.status < 0)) \
ORDER BY ~a, Builds.id ASC LIMIT :nr;" order))
(stmt (sqlite-prepare db stmt-text #:cache? #t)))
(sqlite-bind-arguments stmt #:id (assqx-ref filters 'id)
- #:project (assqx-ref filters 'project)
#:jobset (assqx-ref filters 'jobset)
#:job (assqx-ref filters 'job)
#:system (assqx-ref filters 'system)
diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index e911b9b..a45e6b1 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
;;;
;;; This file is part of Cuirass.
;;;
@@ -45,8 +46,7 @@
(build-status started)))))
`((#:id . ,(assq-ref build #:id))
- (#:project . ,(assq-ref build #:repo-name))
- (#:jobset . ,(assq-ref build #:branch))
+ (#:jobset . ,(assq-ref build #:repo-name))
(#:job . ,(assq-ref build #:job-name))
;; Hydra's API uses "timestamp" as the time of the last useful event for
diff --git a/tests/database.scm b/tests/database.scm
index 847c8a6..e71c7f7 100644
--- a/tests/database.scm
+++ b/tests/database.scm
@@ -2,6 +2,7 @@
;;;
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
;;;
;;; This file is part of Cuirass.
;;;
@@ -156,7 +157,6 @@ INSERT INTO Evaluations (specification, revision) VALUES (3, 3);")
#(((1 "/foo.drv") (2 "/bar.drv") (3 "/baz.drv")) ;ascending order
((3 "/baz.drv") (2 "/bar.drv") (1 "/foo.drv")) ;descending order
((3 "/baz.drv") (2 "/bar.drv") (1 "/foo.drv")) ;ditto
- ((3 "/baz.drv") (2 "/bar.drv") (1 "/foo.drv")) ;ditto
((3 "/baz.drv")) ;nr = 1
((2 "/bar.drv") (1 "/foo.drv") (3 "/baz.drv"))) ;status+submission-time
(with-temporary-database db
@@ -185,9 +185,7 @@ INSERT INTO Evaluations (specification, revision) VALUES (3, 3);")
(assq-ref alist #:derivation)))))
(vector (map summarize (db-get-builds db '((nr 3) (order build-id))))
(map summarize (db-get-builds db '()))
- (map summarize (db-get-builds db '((project "guix"))))
- (map summarize (db-get-builds db '((project "guix")
- (jobset "master"))))
+ (map summarize (db-get-builds db '((jobset "guix"))))
(map summarize (db-get-builds db '((nr 1))))
(map summarize
(db-get-builds db '((order status+submission-time))))))))
diff --git a/tests/http.scm b/tests/http.scm
index 9d460b2..ba53887 100644
--- a/tests/http.scm
+++ b/tests/http.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
;;;
;;; This file is part of Cuirass.
;;;
@@ -76,8 +77,7 @@
(define build-query-result
'((#:id . 1)
- (#:project . "guix")
- (#:jobset . "master")
+ (#:jobset . "guix")
(#:job . "fake-job")
(#:timestamp . 1501347493)
(#:starttime . 1501347493)
@@ -226,13 +226,13 @@
500
(response-code (http-get (test-cuirass-uri "/api/latestbuilds"))))
- (test-assert "/api/latestbuilds?nr=1&project=guix&jobset=master"
+ (test-assert "/api/latestbuilds?nr=1&jobset=guix"
(let ((hash-list
(call-with-input-string
(utf8->string
(http-get-body
(test-cuirass-uri
- "/api/latestbuilds?nr=1&project=guix&jobset=master")))
+ "/api/latestbuilds?nr=1&jobset=guix")))
json->scm)))
(and (= (length hash-list) 1)
(hash-table=?
@@ -241,14 +241,14 @@
(object->json-string build-query-result)
json->scm)))))
- (test-assert "/api/latestbuilds?nr=1&project=gnu"
+ (test-assert "/api/latestbuilds?nr=1&jobset=gnu"
;; The result should be an empty JSON array.
(let ((hash-list
(call-with-input-string
(utf8->string
(http-get-body
(test-cuirass-uri
- "/api/latestbuilds?nr=1&project=gnu")))
+ "/api/latestbuilds?nr=1&jobset=gnu")))
json->scm)))
(= (length hash-list) 0)))