Add a page for each signing key

This commit is contained in:
Christopher Baines 2019-12-02 13:28:39 +01:00
parent 8ff27eaa14
commit 2d87bd6340
5 changed files with 58 additions and 0 deletions

View file

@ -100,6 +100,7 @@ SOURCES = \
guix-data-service/web/build/controller.scm \
guix-data-service/web/build/html.scm \
guix-data-service/web/build-server/controller.scm \
guix-data-service/web/build-server/html.scm \
guix-data-service/web/jobs/controller.scm \
guix-data-service/web/jobs/html.scm \
guix-data-service/web/query-parameters.scm \

View file

@ -10,6 +10,7 @@
#:use-module (guix scripts substitute)
#:use-module (guix-data-service model utils)
#:export (select-outputs-for-successful-builds-without-known-nar-entries
select-signing-key
record-narinfo-details-and-return-ids))
@ -245,3 +246,14 @@ LIMIT 1500"))
(map car (exec-query conn query (list (number->string
build-server-id)))))
(define (select-signing-key conn id)
(define query
"
SELECT sexp_json
FROM narinfo_signature_public_keys
WHERE id = $1")
(match (exec-query conn query (list (number->string id)))
(((sexp_json))
(json-string->scm sexp_json))))

View file

@ -26,8 +26,10 @@
#:use-module (guix-data-service jobs load-new-guix-revision)
#:use-module (guix-data-service model build)
#:use-module (guix-data-service model build-status)
#:use-module (guix-data-service model nar)
#:use-module (guix-data-service model build-server-token-seed)
#:use-module (guix-data-service web jobs html)
#:use-module (guix-data-service web build-server html)
#:export (build-server-controller))
(define (handle-build-event-submission parsed-query-parameters
@ -125,6 +127,11 @@
'((error . "error"))
#:code 403)))))
(define (handle-signing-key-request conn id)
(render-html
#:sxml (view-signing-key
(select-signing-key conn id))))
(define (build-server-controller request
method-and-path-components
mime-types
@ -142,4 +149,7 @@
body
conn
secret-key-base)))
(('GET "build-server" "signing-key" id)
(handle-signing-key-request conn
(string->number id)))
(_ #f)))

View file

@ -0,0 +1,34 @@
;;; Guix Data Service -- Information about Guix over time
;;; Copyright © 2019 Christopher Baines <mail@cbaines.net>
;;;
;;; This program is free software: you can redistribute it and/or
;;; modify it under the terms of the GNU Affero General Public License
;;; as published by the Free Software Foundation, either version 3 of
;;; the License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; Affero General Public License for more details.
;;;
;;; You should have received a copy of the GNU Affero General Public
;;; License along with this program. If not, see
;;; <http://www.gnu.org/licenses/>.
(define-module (guix-data-service web build-server html)
#:use-module (guix-data-service web view html)
#:use-module (guix-data-service web html-utils)
#:export (view-signing-key))
(define (view-signing-key sexp)
(layout
#:body
`(,(header)
(div
(@ (class "container"))
(div
(@ (class "row"))
(div
(@ (class "col-sm-12"))
(h2 "Signing key")
,(sexp-div sexp)))))))

View file

@ -21,6 +21,7 @@
#:use-module (guix-data-service config)
#:use-module (guix-data-service web query-parameters)
#:use-module (guix-data-service web util)
#:use-module (guix-data-service web html-utils)
#:use-module (ice-9 vlist)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)