diff options
-rw-r--r-- | vps.scm | 99 |
1 files changed, 0 insertions, 99 deletions
@@ -168,90 +168,6 @@ (define ci-domain (string-append ci-domain-prefix "." tld)) -;; CI HTML generation from Git notes - -(define ci-html-beginning #" -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="UTF-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> - - <style> - pre { - display: inline; - } - </style> - </head> - <body> - <h1> - Build logs - </h1>"#) - -(define ci-html-ending - "</body> -</html>") - -(define git-data-path "/srv/git") -(define ci-data-path "/srv/ci") - -(define (ci-data-in-repo-notes name path) - (utils:with-directory-excursion path - (let* ((out-list (-> #´git notes list´ - (string-fun:string-replace-substring "\n" " ") - (string-split #\space))) - (relevant-commits (->> (srfi-1:zip out-list (iota (length out-list))) - (filter (compose odd? srfi-1:second)) - (map srfi-1:first)))) - (map (lambda (commit) - (let ((data (-> #´git notes --ref=refs/notes/ci-data show $commit´ - (string-split #\space))) - (logs #´git notes --ref=refs/notes/ci-logs show $commit´) - (href (format #f - "https://~a/~a/blob?id=~a" - git-domain - name - #´git notes --ref=refs/notes/ci-logs list $commit´))) - (list (cons #:status (srfi-1:first data)) - (cons #:filename (srfi-1:second data)) - (cons #:logs logs) - (cons #:href href)))) - relevant-commits)))) - -(define (generate-html-for-project name) - (string-append - "<h2 id=\"" name "\"> - <a href=\"#" name "\"> - " name " - </a> - </h2> - <ul>" - (apply - string-append - (map (lambda (data) - (let ((status (if (equal? "0" (assoc-ref data #:status)) "✅" "❌")) - (file (string-append name "-" (assoc-ref data #:filename))) - (href (assoc-ref data #:href))) - (string-append - "<li> - <a href=\"" href "\" download=" file "> - " status " - <pre>" file "</pre> - </a> - </li>"))) - (ci-data-in-repo-notes name (string-append git-data-path "/" name)))) - "</ul>")) - -(define (generate-ci-html) - (call-with-output-file (string-append ci-data-path "/index.html") - (partial display - (string-append ci-html-beginning - (apply string-append - (map generate-html-for-project - (list-directory git-data-path))) - ci-html-ending)))) - - ;; OS configuration (define sudoers "\ @@ -298,17 +214,6 @@ pki " mail-domain " key \"" (tls-priv-for mail-domain) "\""))) tls-prefixes) (map (cut string-append <> "." tld) static-projects)))) -(define generate-ci-html-job - #~(job "*/5 * * * *" - #$(program-file - "generate-ci-html.scm" - (with-imported-modules (modules:source-module-closure - '((guix build utils))) - #~(begin - (use-modules (guix build utils)) - (display 'generate-ci-html)))))) - - (define (static-nginx-config domains root) (nginx-server-configuration (server-name domains) @@ -358,10 +263,6 @@ pki " mail-domain " key \"" (tls-priv-for mail-domain) "\""))) (password-authentication? #false) (authorized-keys `((,user ,(local-file "id_rsa.pub")))))) - #; - (service mcron-service-type - (mcron-configuration - (jobs (list generate-ci-html-job)))) (simple-service 'automatic-services-restart activation-service-type (with-imported-modules '((gnu services herd)) |