-
I am confused about why I am unable to get something like the following task (in a bb.edn) to work: last-logs {:doc "Just the last log from each pod"
:task
(map
(fn [pool]
(shell (str "stern --no-follow --tail 1 --only-log-lines "
(<< "--context {{pool}} appprefix{{*command-line-args*|first}}") )))
["pool-a" "pool-b"])
} For clarity, the following explicit repetition does accomplish what I'm trying to do: last-logs {:doc "Just the last log from each pod"
:task
(let [cmd (str "stern --no-follow --tail 1 --only-log-lines "
"--context {{pool}} appprefix{{app}}")
app (first *command-line-args*)]
(shell (render cmd {:pool "pool-a" :app app}))
(shell (render cmd {:pool "pool-b" :app app})) )
} I'm providing a simple example, but as you could infer, there could be an arbitrary number of apps, pools, etc. that I might be inspecting at once. Note that {:requires ([clojure.string :as str]
[selmer.parser :refer [<< render]]) |
Beta Was this translation helpful? Give feedback.
Answered by
borkdude
Oct 26, 2023
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
davclark
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
map
is lazy, you need to realize the sequence with e.g.doall
, but if you're doing this for side effects only, you might as well userun!