aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-02-10 00:00:37 +0530
committerArun Isaac2022-02-10 00:00:37 +0530
commit53a114dd456211364f729f74918775c9133cc67b (patch)
tree87e6c73c62ff6ff7e0bc9fde200a73395a6e5bb2
parent8bc27ffef8f6636aeb2ef9f58b2fe205d812ce7a (diff)
downloadguix-forge-53a114dd456211364f729f74918775c9133cc67b.tar.gz
guix-forge-53a114dd456211364f729f74918775c9133cc67b.tar.lz
guix-forge-53a114dd456211364f729f74918775c9133cc67b.zip
forge: Print current commit before running CI job.
This aids debugging especially when a job fails. * forge/build/git.scm (hline): New function. (download-git-to-store): Add #:show-commit? keyword argument. When show-commit? is #t, print current commit. * forge/forge.scm (gexp-producer->job-script): Pass #t as #:show-commit? to latest-git-checkout.
-rw-r--r--forge/build/git.scm12
-rw-r--r--forge/forge.scm3
2 files changed, 13 insertions, 2 deletions
diff --git a/forge/build/git.scm b/forge/build/git.scm
index 2e3dc41..444e3d6 100644
--- a/forge/build/git.scm
+++ b/forge/build/git.scm
@@ -34,7 +34,13 @@
;;; Code:
-(define (download-git-to-store store name url branch)
+(define (hline)
+ "Print a horizontal line 50 '=' characters long."
+ (display (make-string 50 #\=))
+ (newline)
+ (force-output))
+
+(define* (download-git-to-store store name url branch #:key show-commit?)
"Download BRANCH of git repository from URL to STORE under NAME and
return store path. git and certificates should be in the environment."
(call-with-temporary-directory
@@ -48,6 +54,10 @@ return store path. git and certificates should be in the environment."
(invoke-error-exit-status condition))
(exit #f)))
(invoke "git" "clone" "--quiet" "--depth" "1" "--branch" branch url "."))
+ (when show-commit?
+ (hline)
+ (invoke "git" "--no-pager" "log")
+ (hline))
(delete-file-recursively ".git"))
(add-to-store store name #t "sha256" directory))))
diff --git a/forge/forge.scm b/forge/forge.scm
index d3bb879..199c4c3 100644
--- a/forge/forge.scm
+++ b/forge/forge.scm
@@ -217,7 +217,8 @@ derivation to run."
(run-with-store store
(mlet* %store-monad ((git-checkout (latest-git-checkout #$git-checkout-name
#$git-repository
- #$git-branch))
+ #$git-branch
+ #:show-commit? #t))
(tests-drv (gexp->derivation #$derivation-name
(#$gexp-producer git-checkout)
#:guile-for-build (read-derivation-from-file