I need to be able to trigger a build/rebuild of a SNAPSHOT release, in my CI script (by calling a function in build.clj). It's documented https://github.com/cljdoc/cljdoc/blob/master/doc/docsets.md#trigger-a-build-for-a-project but is there some Clojure code somewhere that already does this that I can steal?
Hi Joakim! Not snapshot specific, but here's https://github.com/clj-commons/pomegranate/blob/559202f08d91dffa0c6483633c5b73e3659f3ec2/script/ci_publish.clj#L60-L67. I did a https://grep.app/ and found this more more https://github.com/lambdaisland/open-source/blob/2dc2a8ef9978a3fc45e8f524b0e46253caa40fe2/src/lioss/release.clj#L50-L54.
Thanks, will check later when I’m back home. I guess curl is always installed, so this will therefore work, otherwise we need to use some libraries.
I use bb which includes everything I need
Oh wait, I see your point, my example spawned to curl... right. Don't have to do that anymore, can use https://github.com/babashka/http-client.
Okay, cool.
So, taking an arbitrary project I found that has a SNAPSHOT build... something like this:
(require '[babashka.http-client :as http])
(let [{:keys [status]} (http/post ""
{:throw false
:form-params {"project" "clj-pail/clj-pail"
"version" "0.1.6-SNAPSHOT"}})]
(println "Status of build request" status)) (tried it, it works)
Thanks!!
That snippet could be nice to add to the documentation.