This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-25
Channels
- # announcements (6)
- # babashka (53)
- # beginners (199)
- # calva (101)
- # cider (8)
- # clara (17)
- # cljs-dev (1)
- # clojure (86)
- # clojure-australia (1)
- # clojure-dev (33)
- # clojure-europe (29)
- # clojure-france (13)
- # clojure-nl (6)
- # clojure-norway (7)
- # clojure-poland (3)
- # clojure-spec (2)
- # clojure-uk (9)
- # clojurescript (18)
- # community-development (2)
- # cursive (2)
- # datomic (8)
- # duct (43)
- # emacs (9)
- # events (6)
- # figwheel-main (1)
- # fulcro (7)
- # integrant (1)
- # jobs (1)
- # jobs-rus (1)
- # lambdaisland (1)
- # malli (19)
- # nrepl (2)
- # off-topic (31)
- # pathom (35)
- # quil (1)
- # reagent (4)
- # remote-jobs (7)
- # schema (1)
- # shadow-cljs (58)
- # spacemacs (6)
- # startup-in-a-month (12)
- # tools-deps (10)
- # xtdb (40)
./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 workGot 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.
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"
https://github.com/cloverage/cloverage
(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.pasopas Btw, you can run a JVM with bb as well:
bb --clojure ...
this might help somewhatA small ring router using clojure.core.match: https://twitter.com/borkdude/status/1353674980425404417 Source: https://gist.github.com/borkdude/1627f39d072ea05557a324faf5054cf3
Is it so that https://book.babashka.org/#_uberscript 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 https://github.com/dainiusjocas/babashka-lambda/ uses uberscript but I need to include 1-2 pods (thi binaries are present))
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
I build the uberjar and include that + bb + the pods. That seems to work.
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"}})
:Credentials
(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: https://github.com/babashka/pod-babashka-aws#credentials
not for session token - see https://github.com/cognitect-labs/aws-api/issues/170
to mee it seems you just wrap the cognitect provider, which as per ☝️ does not support it https://github.com/babashka/pod-babashka-aws/blob/main/src/pod/babashka/aws/impl/aws/credentials.clj#L37
@holyjak right. @U01BDT7622X might be able to explain you what he did here: https://github.com/babashka/pod-babashka-aws/commit/58b0e80709eb00e715abf20174811c50cb4147d4
the profile and sys. props. providers support it but not the basic one
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
Yes, both the cred. process and the sys, props would work.
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"}})
:Credentials
((juxt :AccessKeyId :SecretAccessKey :SessionToken))
(->> (zipmap ["aws.accessKeyId" "aws.secretKey" "aws.sessionToken"])
(run! (fn [[k v]] (System/setProperty k v))))))
(set-s3-writer-credentials-sysprops)
(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)}))
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.
BTW thanks a lot for the aws pod
@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
Any tips how to troubleshoot https://github.com/babashka/pod-babashka-aws/issues/30 ? 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? ...
good idea, will try
@holyjak Ah, I think I've seen that before. https://github.com/cognitect-labs/aws-api/issues/15
> 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.
thanks a lot!!! That could be it
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 ?
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))
~@msgs))))
(ns bar (:require logger))
(logger/log "what goes on here")
bar:13:1 what goes on here