No, but I think I figured out what I need to do. It works locally because of the ssh config set up. I will need to set up a docker container configured the same way, save that to an ECR and then specify that docker in the build. 🤞
Thank you! That put me on the right track, I think. Will give it a go.
Hi! How to solve
> Cloning: https://github.com/borkdude/clj-http-lite
> Error building classpath. Destination path "clj-http-lite" already exists and is not an empty directory
> org.eclipse.jgit.api.errors.JGitInternalException: Destination path "clj-http-lite" already exists and is not an empty directory
> at org.eclipse.jgit.api.CloneCommand.verifyDirectories(CloneCommand.java:257)
caused by a borkdude/clj-http-lite {:git/url "<https://github.com/borkdude/clj-http-lite>" ...}
dependency? 🙏
i.e. where does it exist, so that I can delete it?
@holyjak rm -rf ~/.gitlibs
well you don't have to rm the whole thing :)
but yes, that usually means there is a partial download in the ~/.gitlibs dir
if you're running into this often, consider using -Sthreads 1
on clj
I usually do remove the whole thing because there are two things inside .gitlibs, repositories and some other things, so just to make sure, I bluntly get rid of it all ;)
I didn't know it was supposed to work without that error message. :thinking_face: Happens to me 100% of the time, so I do the same: just blow it all away. I didn't think to try single-threading.
Also, I just recently discovered why I was getting cryptic error messages about an invalid privatekey, unless I removed my .ssh/config
every time. My key format was too old. A regen (`ssh-keygen -p -m pem -f ...`) finally got rid of that for me, making this feature much more useful.
if that doesn't help, I'd be curious to hear about it. my belief right now is that this is a concurrency issue where parallel downloads happen and one is stomping on the other in the same dir
I will definitely try this next time. I'm currently trying to get this all to happen in a docker container, so I'll probably have lots of opportunities...
@eamonn.sullivan Forwarding the SSH agent for a dockerized build took me a while to grok. It requires the buildkit tools,
DOCKER_BUILDKIT=1 docker build --ssh default --tag ....
and some of the experimental options:
# syntax=docker/dockerfile:1.0.0-experimental
### -----------------------------------------------------------------------------
### PHASE 1:
### Build the application within a Docker image
FROM clojure:openjdk-8-tools-deps as builder
WORKDIR /home/app
COPY . .
### Install git so we can pull dependencies from GitHub repositories
RUN apt-get update -y
RUN apt-get install git
### Download public RSA keys for <http://github.com|github.com>
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan <http://github.com|github.com> >> ~/.ssh/known_hosts
### Use seancorfield/depstar to create a POM and build the app into an uberjar
### This fetches dependencies AOT, so we don't need to fetch anything when the app starts
### Make sure your app specifies a (:gen-class) directive in the main namespace
### This will AOT compile the main namespace, and anything required in that namespace
RUN --mount=type=ssh clojure -Spom && \
clojure -Sdeps '{:deps {seancorfield/depstar {:mvn/version "0.5.2"}}}' \
-m hf.depstar.uberjar my-app.jar -C -m my-app.main
Thank you very much, @nichols1991! You probably saved me hours...
Anytime! It wasn’t a fun discovery process lol
you should write that down somewhere :)
feel free to make a wiki page at https://github.com/clojure/tools.deps.alpha/wiki if you need a place
does anyone know if proxy username/password
in ~/.m2/settings.xml
are respected when fetching dependencies? From what I can tell the answer is no.
https://clojure.org/reference/deps_and_cli#_maven_proxies is supported but I'm not familiar with any user/pw thing for that
let me glance at the code
there is code there with that intent (can't say I've tested that personally)
I'm not sure if this is relevant here, but deps.clj forwards proxy environment variables to the tools.deps JVM's java properties: https://github.com/borkdude/deps.clj#proxy-environment-variables
thanks @alexmiller i'll play with it and see if I come up with something more concrete
happy to look at fixes if something isn't working there (but I'm somewhat limited in ability to test)
@alexmiller I added a more in-depth explanation + sample here: https://github.com/clojure/tools.deps.alpha/wiki/SSH-Authentication-in-Docker
cool