Fork me on GitHub
#babashka
<
2021-09-12
>
nyor.tr13:09:29

In tasks, is there a way to pass environment variables to the shell function as with clojure.java.shell/sh? With clojure.java.shell/sh you can do:

(require '[clojure.java.shell :refer [sh]])
(sh "printenv" :env {:hello "world"})
which returns:
hello=world
How can I set an environment variable within a task so that it's available during that task. I could use sh for this, but sh will not show anything while the task is running. shell does "stream" the output as it runs.

borkdude13:09:58

@nyor.tr yes, you can pass a map as the first arg with :extra-env

borkdude13:09:21

Same options as babashka.process/process

nyor.tr16:09:32

@borkdude Thanks! yes that works, I learned something new today!

🎉 4
borkdude21:09:51

Made a hello world Docker Action using babashka: https://github.com/borkdude/babashka-docker-action-example

docker 2