boot

:boot-clj: https://boot-clj.github.io/ β€” build tooling for Clojure. Dev chat in #boot-dev
borkdude 2018-10-05T08:43:53.000100Z

@donaldball if you can’t do that, you might be better off using https://github.com/clojure/tools.cli directly

martinklepsch 2018-10-05T09:35:51.000100Z

@donaldball you could have the tasks read defaults from an atom + one task to write to that atom

Chris 2018-10-05T12:49:20.000100Z

@seancorfield Thanks for your advice. It turned out to be that private repo authentication was added to tools.deps since boot-tools-deps was last updated. I've put together a PR here: https://github.com/seancorfield/boot-tools-deps/pull/23

2018-10-05T15:44:47.000100Z

Hi all: just following up if anyone has any feedback about when it's safe to set the boot environment. Setting the boot env at task construction time is a pretty standard pattern:

(deftask task
  []
  (set-env! ...)
  (comp (task-1) (task-2) ...))
But what about setting inline during task execution time:
(deftask task
  []
  (comp (load-env :env env) (task-1) (task-2) ...))
I can't seem to get load-env task to work properly. Have you seen this pattern? Would you expect it to work?

2018-10-05T16:07:24.000100Z

@zalky can you share the load-env task?

2018-10-05T16:10:07.000100Z

Yeah, thanks for the response! This is what I have right now, though I've tried variations on it:

(deftask load-env
  [e env ENV code "Environment map"]
  (with-pre-wrap fileset
    (->> env
         (apply concat)
         (apply set-env!))
    (commit! fileset)))

2018-10-06T13:24:20.000100Z

@alandipert, thanks again for the response! I was able to try your suggestion out this morning but it produced the same result as the first versions of the task. Interestingly, the environment appears to change, but the change is not producing intended effect in the system. What I'm actually doing is adding some source directories as :resource-paths to the environment, and then installing my project as a jar to the local maven repo. However the source never shows up in the resulting jar. When I load the :resource-paths at task construction time, everything works as intended, so I'm pretty sure the rest of the pipeline is correct.

2018-10-06T13:50:55.000100Z

Ah, I think I figured it out! So it was the environment map itself that was the problem. Instead of providing a fn to update :resource-paths, I was just passing in a value for :resource-paths. At execution time, this overwrote important changes that downstream tasks like pom had made at construction time.

2018-10-06T13:54:24.000100Z

Hmm, I'm now thinking this pattern is problematic because there's no guarantees about how downstream tasks are using the environment. They may do important things at construction time based on a partially configured environment.

2018-10-06T19:01:51.000100Z

After some more digging, I don't think it was the overwriting... I'm kind of stumped.

seancorfield 2018-10-05T16:29:27.000100Z

Thanks @cbowdon -- 0.4.6 released to Clojars with that PR merged in!

πŸ˜€ 1
Chris 2018-10-05T16:29:55.000100Z

Thanks!

2018-10-05T17:23:34.000100Z

hm, that looks like it should work, but it does some unnecessary things

2018-10-05T17:23:37.000100Z

(require '[boot.core :as core])

(core/deftask load-env
  [e env ENV code "Environment map"]
  :pre [(map? env)]
  (core/with-pass-thru _
    (doseq [[k v] env]
      (core/set-env! k v))))

(core/deftask show-env-key
  [k key KEY kw "Environment key"]
  (core/with-pass-thru _
    (println (str "key = " (core/get-env key)))))

(core/deftask foo []
  (comp (load-env :env {:foo 123})
        (show-env-key :key :foo)
        (load-env :env {:bar 321})
        (show-env-key :key :bar)))

2018-10-05T17:24:29.000100Z

that seems to update the env at the right time so that subsequent task handlers see the updated env, if i understand your intent correctly

seancorfield 2018-10-05T18:40:50.000100Z

Just FYI (mostly for @alandipert) this issue is happening more frequently now https://github.com/boot-clj/boot/issues/715 (specifically the dynapath syntax error) and it's making Boot virtually unusable for us now.

seancorfield 2018-10-05T18:42:49.000100Z

It's happening on maybe three out of four runs of our test suite, as the pods are being initialized (so, asynchronously and early in the process as our Boot pipeline spins up).