This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-06
Channels
- # adventofcode (106)
- # aleph (1)
- # announcements (1)
- # asami (14)
- # babashka (120)
- # beginners (54)
- # calva (106)
- # chlorine-clover (33)
- # clj-kondo (5)
- # cljdoc (3)
- # cljs-dev (3)
- # clojure (92)
- # clojure-android (1)
- # clojure-australia (2)
- # clojure-europe (24)
- # clojure-italy (3)
- # clojure-nl (5)
- # clojure-uk (16)
- # clojuredesign-podcast (1)
- # clojurescript (29)
- # code-reviews (58)
- # conjure (16)
- # core-logic (4)
- # cursive (9)
- # datalevin (2)
- # graphql (20)
- # gratitude (7)
- # jackdaw (11)
- # java (9)
- # jobs (2)
- # lsp (23)
- # minecraft (1)
- # missionary (28)
- # off-topic (5)
- # polylith (5)
- # react (1)
- # reagent (12)
- # releases (1)
- # remote-jobs (4)
- # reveal (7)
- # shadow-cljs (8)
- # slack-help (1)
- # tools-deps (11)
- # vim (6)
How can I get the out value as a string from babashka.tasks/shell ? I get this: {:proc #object[java.lang.ProcessImpl 0x6942dbc4 Process[pid=27469, exitValue=0]], :exit 0, :in #object[java.lang.ProcessBuilder$NullOutputStream 0x628b0922 java.lang.ProcessBuilder$NullOutputStream@628b0922], :out #object[java.lang.ProcessBuilder$NullInputStream 0x2aa44cab java.lang.ProcessBuilder$NullInputStream@2aa44cab], :err #object[java.lang.ProcessBuilder$NullInputStream 0x2aa44cab java.lang.ProcessBuilder$NullInputStream@2aa44cab], :prev nil, :cmd [guix describe]}
https://book.babashka.org/#tasks does not tell me...
However, I would like to see the shell output of the app I am running in the mean time.
I have a shell task that runs for a few days (it is cross compiling a guix operating system),
and I want to take only the last output of the script (which is the iso image file location), but show all the other output in the mean time.
Perhaps it's best to use tee
and write to a file and to stdout. And then you can read from the file at the end
I think thi sis a quite common useage pattern. Many apps log debug/info/warning messages during runtime that wa.
you can capture stdout with :out
and stderr with :err
, by default they are both inherited (you see them as they come out)
you can also make your own output handler: a loop that reads the output line by line, and prints it and scans it for certain interesting information. This is described in the README of babashka.process.
> I dont see any output during runtime now anymore.
You can try :err :inherit
to make sure stderr is still visible
and for many tasks, it would be good to have a little menu, that lets one select say a profile out of a list of profiles.
You can probably do this in your shell, using some shell specific code. Or some other program you can shell out to. https://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script
Has anyone run into a ClassNotFoundException in data.xml's usage of codec.base64 when building babashka in a Docker container?
yeah it seems to be; looks like it fails w/ similar errors elsewhere in the code if I disable the xml feature
builds fine outside docker
even a lean build fails
I was trying to build a linux/arm64 binary
which worked in a fedora vm, but I wanted to get it working in docker since (IIRC) GitHub Actions don't have arm runners yet
not sure yet; I need to investigate a little more. all I changed was to make it download the aarch64 graalvm tarball
I can open a ticket w/ just that if you want
just running your docker build, so yeah
but we are also running that Docker image in CI, so there must be something different?
different arch and thus different graalvm distribution are the only differences I'm aware of
trying it in docker in fedora now
The build failure looks similar to what I'm sometimes seeing if I have already AOT-compiled and then run using a different Clojure version.
it seems to be working in Docker on Fedora
might have to restart or reset my docker desktop on mac and see if that helps
well, it's almost entirely your Dockerfile still (except for the patch in the issue I just opened). so it's still doing the COPY . .
. but I'm using o/w clean master HEAD & v0.6.8 tag.
ok it worked in fedora docker so I'm betting this is a weird environment thing in my mac docker desktop. I'll keep playing around w/ it.
hoping to end up w/ a PR that can build a linux arm64 release in docker in your CI (I have a multi-platform docker-based GitHub Action I've been using already that uses qemu to build the arm64 binary on the x86_64 standard action runners)
and then we can build an arm64 docker image around that
ah ha!
adding .cpcache/
and target/
to .dockerignore
fixed it
you were right that it was bringing in things from the host build that it shouldn't
want me to put up a PR just for that change first?
or is it easier for you to just do it?
adding those dirs to .dockerignore
target
and .cpcache
:thumbsup:
oh you're already building linux arm64 binaries, just not a docker image?
I think @U7ERLH6JX suggested we make the images multi-architecture
ok, I'll put up a PR w/ just the Dockerfile changes to allow multi-platform builds
since that seems to work now
do you want me to make an issue first?
PR is up, but I'm happy to open an issue for it too if you'd like
Issue first is good with some background. Then @U7ERLH6JX can hopefully also comment on this. He knows all about this Docker stuff,
E.g. I don't know if this TARGETARCH is standard practice etc. Hopefully you can explain it to me and I will learn something.
yeah, documented here: https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
and actually, the PR probably needs a bit more tweaking to continue working in non-buildx docker setups, which you probably want
I'll do that now
ok that falls back on an amd64 build now if you run it w/o BuildKit
should be good to go
Now, that's just one I made up. I need it to be separate from TARGETARCH
b/c of how that behaves in all the different scenarios.
BABASHKA_ARCH
would probably work fine there if you prefer
Yeah there's a little more to do around making this resilient with static builds (i.e. fail with a useful error message because that's only supported on amd64 so far). I'll push another commit or two tomorrow.
Does anyone have a quick tip on zipping up files from a Babashka script? I was hoping for something in babashka.fs
but it only has unzip
You can look at the source in tools build and copy that. It works in bb as well. I’ll add a similar function to fs soon
https://github.com/clojure/tools.build/blob/master/src/main/clojure/clojure/tools/build/util/zip.clj
I assembled something here: https://gist.github.com/borkdude/b880118c78ac2dc0a95fd287fd638841