Coverage report: /home/ellis/comp/core/lib/pod/buildah.lisp
Kind | Covered | All | % |
expression | 0 | 70 | 0.0 |
branch | 0 | 2 | 0.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; buildah.lisp --- Buildah Lisp Utils
8
(defvar *buildah-container*)
9
(defun buildah-from (img)
11
(with-output-to-string (s)
12
(run-buildah (list "from" img) :output s))))
14
(defun buildah-add (src dst)
16
(list "add" *buildah-container* (namestring src) (namestring dst))
19
(defun buildah-run (args &key dir env)
21
`("run" ,@(when dir `("--workingdir" ,(namestring dir)))
24
(if-let ((val (cdr e)))
25
`("--env" ,(format nil "~A=~A" (car e) val))
26
`("--unsetenv" ,(car e))))
28
,*buildah-container* ,@(if (stringp args)
30
(mapcar 'string args)))
33
(defun buildah-copy (&rest args)
34
(run-buildah `("copy" ,*buildah-container* ,@args) :output t))
36
(defun buildah-config (&rest args)
37
(run-buildah `("config" ,@args ,*buildah-container*) :output t))
39
(defmacro with-buildah ((sym from &key commit (rm t)) &body body)
40
`(let ((,sym (buildah-from ,from)))
41
(setf *buildah-container* ,sym)
43
,@(when commit `((run-buildah (list "commit" ,sym ,commit))))
44
,@(when rm `((run-buildah (list "rm" ,sym))))))
46
;; (with-buildah (c "o0") (buildah-run '("ls" "-la") :dir "/root/"))