@mike1452 That's cool, but I don't understand why deps.exe
saved you, since it contains the same logic as bb for resolving deps.
> After I added them into cacerts file, deps.exe started to download any deps.
So I suspect bb
will do the same then?
And you didn't respond yet about the first step: getting the tools.jar on your system. How did you manage that.
@karol.wojcik Congrats on the new holy-lambda release. Note that this doesn't do anything anymore in 0.3.7: https://github.com/FieryCod/holy-lambda/blob/8747d72e4c1a8d7a842d4da392a8d95f9d15b453/examples/bb/babashka/component.example/bb.edn#L80
Thank you. I will adjust a template. Btw I didn't want to poke you around yesterday, so I kinda hacked babashka.deps/add-deps
https://github.com/FieryCod/holy-lambda/blob/master/modules/holy-lambda-babashka-layer/hacks.clj
I would love to have an option to pass :mvn/local-repo to babashka itself.
Nice hack :)
Yep 😄 That way if someone use add-deps
in lambda context deps are not downloaded 😄
Btw I'm closing the issue https://github.com/babashka/babashka/issues/801 Pods are distributed as a separate layer now. I will write a sum up in the issue.
ok
After I configured settings.xml
and added certificates deps.exe
downloaded all jars for me.
Before it my .m2 was empty.
I think so, but I did not check yet.
Yes, this is about dependencies. But before deps.exe
can download any dependency, it first must download the tools.jar!
and this is a different step than downloading dependencies
you mentioned that this step also went wrong
or did that step succeed?
anyway, perhaps that step succeeded and it were only the deps that failed?
you can check this if there is a %USERPROFILE%/.deps.clj
directory with the expected jar
I suppose that after I added corporate certs from CA to the cacerts file, deps.exe can access to Internet via proxy which has dynamic certs signed by root certificate from our CA. And error with PKI path verification disappeared.
where is this cacerts file located?
the downloading of the tools.jar isn't going through java
it is part of the binary
I've just removed :log-level :info from the template. Thanks!
I think we have had good testing of bb tasks. Maybe it's time to make a stable release announcement sometime soon. I would like to urge everyone who cares to give it another spin so any design mistakes can still be fixed
cacerts file is located C:\Program Files\AdoptOpenJDK\jdk15\lib\security\cacerts
as I remember, that deps.exe somehow used it. It is the only reason I can see
@mike1452 The only explanation that I have is that the download of the tools.jar succeeded already before. Only the maven and git dependencies are downloaded by java and this was probably fixed by your cacerts in java.
The same should work with bb, since it's also going through java for maven/git deps
Oh! I have Idea + Cursive. When I configured Idea for Clojure I pressed button to download jars from there.
this is the third step I made
yeah, but this is a different location than what deps.clj uses so this can't be related
(although I realize now that it could maybe use the same tools.jar if clojure is already installed, I'll make an issue for that)
Idea runs under JVM and this step downloaded jars
oh
anyway, there are too many steps going on at once for me too follow. I need precise details of what is going on next time, it's all intermingled now.
Added another bb.edn, this time for building the http://babashka.org website: https://github.com/babashka/babashka.github.io
How to troubleshoot this, please?
user=> (require '[babashka.deps :as deps])
nil
user=> (deps/add-deps '{:deps {djblue/portal {:mvn/version "0.11.1"}}})
java.lang.NullPointerException [at <repl>:2:1]
this is thrown at borkdude.deps$which invokeStatic "deps.clj" 171
. babashka v0.3.4
More info: When I am offline, I get a different (and kind of expected) error:
> Could not find /Users/me/.deps.clj/1.10.3.822/ClojureTools/clojure-tools-1.10.3.822.jar
> Attempting download from https://download.clojure.org/install/clojure-tools-1.10.3.822.zip
> java.net.SocketException: Connection reset [at <repl>:6:1]@holyjak Could it be that your PATH
environment variable isn't set?
https://github.com/borkdude/deps.clj/blob/9e0ca8002cca486223a962c06865dbbe3bc1917a/src/borkdude/deps.clj#L164
oh yeah, that is it! I am running env -i
to solve some other issue. Thanks a lot
Another library compatible with babashka! This time the config library from my colleague we're using at work :) https://github.com/dunaj-project/crispin
I also made an env
task in our app tasks:
$ DRE_SCHEDULER_ENABLE=true bb env :dre :scheduler :enable
"true"
✓ env
https://gist.github.com/borkdude/35bc0a20bd4c112dec2c5645f67250e3#file-2-bb-edn-L29-L35@borkdude have you any video, how do you debug babashka tasks from the bb.edn file?
IDEA + Cursive doesn't treat the bb.edn
file as Clojure code. May be in Emacs I can eval and debug bb.edn
scripts?
@mike1452 you can make a repl
task which starts (clojure.main/repl)
and then debug
The next version will support bb --debug <task>
which prints the task as it's executed before running it
you can try this from #babashka-circleci-builds
Any tips for persisting data between bb invocations (Namely oidc refresh tokens) in cross-os manner independent of the current working directory? On osx/Linux I'd just put a file in ~/.config/mybbstuff but that likely doesn't work so well for Windows..
you can get the home directory using (System/getProperty "user.home")
persisting in <home>/.config/.tool
also works in Windows
@holyjak you have two options which I would recommend ot you: use APPDATA environment variable for the roaming profile, for example $APPDATA\appname\tempfile or use LOCALAPPDATA environment variable if you want to avoid roaming profile
roaming profile in fact can be synced between machines, consider it the user directory that can move between the machines eventually.
I would personally pick LOCALAPPDATA
on linux/macos you could also respect XDG_DATA_HOME
or XDG_CACHE_HOME
Thank you!
Nice, will we have a new release (0.4 maybe?) soon? Just asking because I was going to update nixpkgs with 0.3.7 release, but if a new release is coming I think I will wait until it
I think 0.4 is appropriate indeed for the tasks feature
@borkdude found useful the following way to develop and debug bb.edn
tasks
1. Run babashka nREPL by: bb nrepl-server
in terminal in project root
2. Run Emacs and open bb.edn
3. call cider-connect-clj to repl localhost:1667
4. eval (in-ns 'babashka.tasks)
to make current repl ns
5. now I can call shell
or clojure
functions from babashka.tasks
ns or run particular task by (run 'my-task)
and see result in terminal
The only downside of it is when shell
results in error. This will exit the process of nrepl 😞
I have no such behavior. If the shell fails it will not exit now. Maybe this was before v0.3.7?
The shell function does exit in case of an error
You can avoid this by writing (shell {:continue true} "ls foo")
Right. I have forgotten that I have my own implementation of shell which does that 😄
Maybe we can make shell throw an exception instead, but I don't know if that would help
I think I'll change it to that, so you can just keep REPLing
now shell
has no exception if command fails ( {:continue true} is default, right?). this behavior is expected in my scripts.
shell
will exit the babashka process if there is a non-zero exit code
if that doesn't work for you it's a bug
$ bb -e '(babashka.tasks/shell "ls foo") (prn :bar)'
ls: foo: No such file or directory
[bb null] Terminating with non-zero exit code: 1
I just found how to use Idea + Cursive without problems. See https://github.com/cursive-ide/cursive/issues/2452, onetom gave working recipe using vlaad/remote-repl
ah, sorry. My mistake. It works as you described.
but I will change this into an exception, which has the same effect, but works better in a REPL
👍