Fork me on GitHub

./script/compile: line 49: ~/Downloads/graalvm-ce-java11-20.3.1/Contents/Home/bin/native-image: No such file or directory
I’ll try 20.3.0 just in case 20.3.1 doesn’t work


Got past that part by installing the native-image via gu install native-image but ran into another snag: I built it on OS X when it needs to be built on a similar OS. Setting up a docker container for it now.


@jayzawrotny FWIW, babashka itself also has a Dockerfile, maybe it helps

🎉 3
Marco Pas10:01:55

I am looking into how to get an overview of test coverage while running tests on some BB code. I can include cloverage as a dependency but unsure how to set the arguments that are required..

Clojure CLI Tool
To use cloverage in a Clojure CLI Project, clj -Sdeps '{:deps {cloverage {:mvn/version "RELEASE"}}}' -m cloverage.coverage *args-to-coverage*

Where args-to-coverage will usually be something like "-p src -s test" (deps/add-deps '{:deps {cloverage/cloverage {:mvn/version "1.2.2"}}}) Any pointers on how i could set the required parameters?


@marco.pasopas cloverage is a pretty low level tool which will instrument your clojure code in a JVM. I'm pretty sure it doesn't work with bb / sci. But what you can do is run your scripts with JVM clojure / leiningen in development and then run cloverage as usual. And then run your scripts with bb when done.

Marco Pas10:01:25

@borkdude Do you have an alternative that could be used with bb / sci?


Not that I know of


@marco.pasopas Btw, you can run a JVM with bb as well:

bb --clojure ...
this might help somewhat

Marco Pas10:01:43

Wil give it a try 🙂


but you will have to add deps that are built into bb explicitly in a deps.edn file


if you are using those

Jakub Holý (HolyJak)16:01:56

Is it so that does not work with scripts that require a pod? (I am trying to make something that will be simple to run in AWS Lambda. The original uses uberscript but I need to include 1-2 pods (thi binaries are present))


@holyjak pods aren't included in uberscripts, an uberscript is just one source file


you can also make an uberjar, but I don't think you can run binaries from a jar


so it's probably best to include them in the docker image by explicitly adding them


or you can let them download in the lambda but I don't know if that will persist somehow (probably not) and this will incur some startup time

Jakub Holý (HolyJak)16:01:34

I build the uberjar and include that + bb + the pods. That seems to work.

Jakub Holý (HolyJak)18:01:00

Question about the AWS pod - I have a fn like this that return the credentials to use for an S3 call:

(defn assume-s3-writer-role []
  (-> (aws/invoke sts-client
                  {:op      :AssumeRole
                   :request {:RoleArn         "arn:aws:iam::123:role/my-s3-role"
                             :RoleSessionName "xyz"}})
      (select-keys [:AccessKeyId :SecretAccessKey :SessionToken])))
how best to plug it into the s3-client? The basic provider does not support session token yet so I guess I need to set system properties and use the sys. property one...


@holyjak I think you can pass these tokens along with the basic credential provider:


I think the aws pod does support it

Jakub Holý (HolyJak)18:01:54

to mee it seems you just wrap the cognitect provider, which as per ☝️ does not support it

Jakub Holý (HolyJak)18:01:33

the profile and sys. props. providers support it but not the basic one


then use those?

Jakub Holý (HolyJak)18:01:45

Yes, that is what I was thinking. Sadly it seems I cannot use the with-system-properties macro so it is slightly more work but still possible.


@holyjak Maybe it works when you just set the right system property before the call?


@U0FT7SRLP might also have ideas. his credential-process logic might support it, but I'm not sure. this allows you to call out to a different program

Jakub Holý (HolyJak)18:01:17

Yes, both the cred. process and the sys, props would work.

Jakub Holý (HolyJak)18:01:24

I ended up with this:

(defn set-s3-writer-credentials-sysprops []
  (-> (aws/invoke sts-client
                  {:op      :AssumeRole
                   :request {:RoleArn         "arn:aws:iam::123:role/my-s3-role"
                             :RoleSessionName "xyz"}})
      ((juxt :AccessKeyId :SecretAccessKey :SessionToken))
      (->> (zipmap ["aws.accessKeyId" "aws.secretKey" "aws.sessionToken"])
           (run! (fn [[k v]] (System/setProperty k v))))))

(def s3-client (aws/client {:api                  :s3
                            :region               region
                            ;; the basic-provider does not support session token yet - see 
                            :credentials-provider (credentials/system-property-credentials-provider)}))


cool, hope it works!


sorry to be late to the party here. @holyjak you got! that is exactly what I do in my scripts. I have generic util package that runs aws-adfs and returns key, token, etc and I just set it to my system properties. It works and I can just :require the package in the same JVM which does not allow to set env vars.

👍 3
Jakub Holý (HolyJak)19:01:38

BTW thanks a lot for the aws pod


:thumbsup: good to see it being used


@holyjak @borkdude Yeah I think this looks good. I’m using a custom tool and credential_process to assume credentials. I could try converting that to Bashbashka at some point

Jakub Holý (HolyJak)18:01:12

Any tips how to troubleshoot ? I would like to find out where the exception is thrown and whether it contains any details about the problematic http response. I guess it was a redirect - from which url to which? ...


Is it possible for you to reproduce this using the "normal" aws-api lib?


> This indicates that you are trying to access an S3 resource (bucket or object) that resides in a different region from the client's region. Remedy: create a new s3 client in the same region you are trying to access.

Jakub Holý (HolyJak)18:01:11

thanks a lot!!! That could be it


I had the same problem, you can look at the tests, there as also set the region

Jakub Holý (HolyJak)18:01:09

I do set it. The problem is that the bucket is obviously elsewhere than I expected 🙂


Hello everyone, can someone tell me what they are using for logging given most of the libs require some reflection and won’t work without compiling ?


@gary001 you mean for a graalvm project, apart from bb?


no, for my bb script.


ah right. I'm not aware of any fancy logging library for bb, besides the usual prn, println and (binding [*out* *err*] ...)


Simple logger to stderr, including namespace, line and col:

(ns logger)

(defmacro log [& msgs]
  (let [m (meta &form)]
    `(binding [*out* *err*] ;; or bind to (io/writer log-file)
       (println (str (ns-name *ns*) ":"
                     ~(:line m) ":"
                     ~(:column m))

(ns bar (:require logger))

(logger/log "what goes on here")
bar:13:1 what goes on here