Say-cheez - capture build environment information to display at runtime


#1

I actually got started with this a long time ago and asked for some advice here: How to include build number?

Now I have a small library that gathers together:

  • Date and time of the build
  • Git information (commit, committer, date and time)
  • Name and version from project.clj
  • Environment variables for the build (e.g. Jenkins build number)

and puts it in a defonce, from where you can find it.

It’s called Say-cheez and it’s here: https://github.com/l3nz/say-cheez

I find it pretty useful, so I thought maybe somebody else could be interested as well. Not rocket science, but just works and is out of the way. Also, though I don’t use ClojureScript myself, I think that it should just work in ClojureScript by replacing the platform namespace.


#2

Nice! Capturing build information is something that is very important, and yet so often under-appreciated. I needed something like this a long time ago, so I wrote some hacks, then commissioned lein-git-version, which then evolved and got forked and now I think the latest version is at https://github.com/arrdem/lein-git-version — it’s something you might want to take a look at.

In my case, the data gets captured into a version.edn file in resources, which is then processed using macros:

;; Note these are all processed at compile-time, there is no quoting!

(defmacro data []
  (edn/read-string (slurp (io/resource "version.edn"))))

(defmacro tag []
  (:ref-short (data)))