Home
Support Forums

Confused about issue with indirect Clojure use in CI build

Hello, Forum Friends! I realize in advance that this situation may be too esoteric for anyone to be able to answer, but I will share as many details as I can in the hopes that it will help someone who understands the build process have an “a-ha!” moment they can share with me.

My site name is bytefield-svg, which is hosted at the domain https://bytefield-svg.deepsymmetry.org/. It is a static documentation site for an npm module I created (repo link) to help people generate SVG diagrams of byte fields. When I commit changes, Netlify runs my build script, which uses npm to build the latest version of the module (so it can generate the sample diagrams that make up part of the documentation), and then runs Antora to generate the actual static documentation site, using that built module.

The problem is happening inside the npm run release step which builds the module. It in turn uses shadow-cljs, to build the Javascript source from Clojurescript, which in turn uses clojure. This all used to work fine, but when I tried building an update last night, it failed, complaining about command-line arguments to the clojure executable issued by shadow-cljs.

As part of my debugging efforts, I wondered if it might be a Clojure version problem, so I added a line to my script to output the clojure version, clojure --version. What is particularly weird is that with that in place, my attempt to find the clojure version failed (again, with a complaint about the command-line argument to clojure: --version (No such file or directory)), but the second attempt to invoke clojure by shadow-cljs suddenly worked, so the build itself succeeded!

So I am wondering if something weird is happening at the first attempt to invoke clojure, perhaps because the Netlify build environment doesn’t realize this is a project that involves clojure until that point (there is no project.clj file, which is how one used to identify Clojure projects, and how Netlify initially announced they would, but there is a deps.edn file, which is how more modern clojure projects, which use the built-in CLI to build, rather than the third-party Leiningen approach, work). So maybe clojure starts out being a script that tries do download and install Clojure, and then invoke it with the original arguments, which doesn’t quite work right, but the second attempt finds an actually-installed Clojure environment, and so succeeds?

Or maybe something completely different is going on. I have a workaround now, my script tries to invoke Clojure initially explicitly, and it fails but this does not kill the build, and allows the second, critical invocation to succeed. But I am not entirely comfortable with leaving things in this state, and so I hope someone can provide a more definitive explanation of what is happening, and how to get the first clojure invocation to work properly.

If the links to my deploy logs don’t work (I am not sure they are public), let me know and I can paste more lengthy things in here, but I am hoping that is not necessary.

Hiya! First up… don’t worry, it doesn’t sound like you’re on your own :slight_smile:

There’s a good little discussion in our public build-image repo (in a PR, in fact) which you can find here: https://github.com/netlify/build-image/pull/484

It would be worth chiming in!

1 Like

Oh, thanks very much for pointing me at that, it does seem like the underlying issue, so I hope the build tooling can be upgraded soon. I did add a comment to that effect on the PR. :smiley:

1 Like