This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-06
Channels
- # babashka (60)
- # beginners (36)
- # clj-kondo (29)
- # clojure (91)
- # clojure-dev (18)
- # clojure-europe (12)
- # clojure-nl (1)
- # clojure-norway (11)
- # clojure-uk (5)
- # clojuredesign-podcast (8)
- # clojurescript (40)
- # core-typed (74)
- # data-science (8)
- # datomic (9)
- # emacs (22)
- # events (5)
- # fulcro (56)
- # gratitude (3)
- # hyperfiddle (11)
- # lsp (6)
- # malli (36)
- # meander (23)
- # off-topic (50)
- # polylith (4)
- # portal (10)
- # reitit (4)
- # schema (1)
- # shadow-cljs (66)
- # squint (3)
- # tools-deps (16)
Do someone know an existing specialized devops build (drives tools like docker, kubectl, c4k-*, helm, aws-cli, terraform, gopass, provs) on top of babashka? If no I am thinking about doing a rewrite from python-pyb to bb: https://repo.prod.meissa.de/meissa/dda-devops-build/src/branch/clj-bb-rewrite
Okay, first POC is up and running & feels good 🙂
But test make some problems: If I use normal deps-test the bb-specific namespaces can not be resolved
(ns dda.devops-build.image
(:require ...
[babashka.tasks :as t])
(see https://repo.prod.meissa.de/meissa/dda-devops-build/src/branch/clj-bb-rewrite/src/main/clj/dda/devops_build/image.clj#L3)
Is there a bb-way run tests?just in time 🙂
I didn't notice your (separate) question since I didn't look past your first question to which I didn't have an answer
https://repo.prod.meissa.de/meissa/dda-devops-build/src/branch/clj-bb-rewrite/bb.edn Works like a charm 🙂 In this case it will make sense to keep only the main paths & deps in deps.edn and the testing-stuff in bb.edn I assume?
Does bb do anything special for its native-image build to get (System/getenv)
to see the whole calling environment?
From a native-image I get only:
$ ys -Ye 'ENV.keys()'
- HOME
- USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM
- PATH
- PWD
- LANG
but with jvm I get my entire environment.
$ bb -e '(System/getenv)'
gets everything.I set ENV with:
(sci/intern @ys/sci-ctx 'clojure.core 'ENV (into {} (System/getenv)))
unless I really don't understand something.
It looks like a purposefully minimal env
but I just noticed USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM
that's probably a key worth googling
If I run the jar in the JVM it works fine
but I think I need to enable something in the native-image build setup
Having trouble finding what
Can you show us where/how you are calling (System/getenv)
? Just to rule out build time vs runtime.
sure sec
https://github.com/yaml/yamlscript/blob/main/core/src/yamlscript/runtime.clj#L90
You can repro this with:
git clone [email protected]:yaml/yamlscript
cd yamlscript/
. .profile
YS -pe ENV
make -C ys build
ys/bin/ys -pe ENV
$ type YS
YS is a function
YS ()
{
( set -e;
base=$YAMLSCRIPT_ROOT/ys;
libyamlscript_version=0.1.39;
jar=yamlscript.cli-$libyamlscript_version-SNAPSHOT-standalone.jar;
make --no-print-directory -C "$base" jar;
java -jar "$base/target/uberjar/$jar" "$@" )
}
You can run those 6 commands verbatim
cd you not cd into the clone?
oh. source .profile
😕
what shell?
ok cool
it downloads graal and lein into /tmp/yamlscript/
and ignores anything else you use
I appreciate you digging. Was hoping this was something @U04V15CAJ knew off the top of his head. I'm writing my YS talk for tomorrow night and no tuits to dig on this 😞
Well, they have suggested the usual cause of confusion above.... build time vs runtime. Oh. Right. You are calling (reset!...
) when the namespace loads. So that will happen a build time,ya?
that's it
Ok, Loaded in emacs, so I can better see indentation! Ya, System/getenv is called when ns loads.
Right:
$ (cd /tmp; ys -pe CWD)
"/home/ingy/src/yaml/yamlscript/ys"
that was supposed to be /tmp
thanks!!!
I really appreciate you doing this @UE21H2HHD I owe you one!
And thanks too @U013JFLRFS8 I really didn't understand something 🙂
I think I actually had this right before but refactored without the right tests
$ (cd /tmp && FOO=123 ys -e 'say: "FOO=$(ENV.FOO) cwd=$CWD"')
FOO=123 cwd=/tmp
To see that as Clojure:
$ ys -ce 'say: "FOO=$(ENV.FOO) cwd=$CWD"'
(+++ (say (str "FOO=" (__ ENV 'FOO) " cwd=" CWD)))