tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
Eamonn Sullivan 2021-01-22T06:43:30.022900Z

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. 🤞

Eamonn Sullivan 2021-01-22T06:44:11.023800Z

Thank you! That put me on the right track, I think. Will give it a go.

Jakub Holý 2021-01-22T12:52:47.024800Z

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?

borkdude 2021-01-22T12:54:01.025300Z

@holyjak rm -rf ~/.gitlibs

1❤️
alexmiller 2021-01-22T13:34:27.025700Z

well you don't have to rm the whole thing :)

alexmiller 2021-01-22T13:34:47.026100Z

but yes, that usually means there is a partial download in the ~/.gitlibs dir

alexmiller 2021-01-22T13:35:07.026500Z

if you're running into this often, consider using -Sthreads 1 on clj

1👍
borkdude 2021-01-22T13:44:47.027300Z

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 ;)

Eamonn Sullivan 2021-01-22T13:54:08.030300Z

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.

alexmiller 2021-01-22T13:55:26.030500Z

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

Eamonn Sullivan 2021-01-22T13:56:30.030800Z

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...

nnichols 2021-01-22T14:05:40.031Z

@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 &amp;&amp; ssh-keyscan <http://github.com|github.com> &gt;&gt; ~/.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 &amp;&amp; \
    clojure -Sdeps '{:deps {seancorfield/depstar {:mvn/version "0.5.2"}}}' \
    -m hf.depstar.uberjar my-app.jar -C -m my-app.main

Eamonn Sullivan 2021-01-22T14:44:02.031200Z

Thank you very much, @nichols1991! You probably saved me hours...

nnichols 2021-01-22T14:46:05.031400Z

Anytime! It wasn’t a fun discovery process lol

alexmiller 2021-01-22T14:57:32.031600Z

you should write that down somewhere :)

alexmiller 2021-01-22T14:58:03.031800Z

feel free to make a wiki page at https://github.com/clojure/tools.deps.alpha/wiki if you need a place

2021-01-22T15:12:17.033200Z

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.

alexmiller 2021-01-22T15:21:35.033600Z

https://clojure.org/reference/deps_and_cli#_maven_proxies is supported but I'm not familiar with any user/pw thing for that

alexmiller 2021-01-22T15:22:18.034100Z

let me glance at the code

alexmiller 2021-01-22T15:23:40.034400Z

there is code there with that intent (can't say I've tested that personally)

borkdude 2021-01-22T15:35:25.035300Z

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

2021-01-22T15:43:43.036200Z

thanks @alexmiller i'll play with it and see if I come up with something more concrete

alexmiller 2021-01-22T15:44:32.036800Z

happy to look at fixes if something isn't working there (but I'm somewhat limited in ability to test)

nnichols 2021-01-22T16:02:10.036900Z

@alexmiller I added a more in-depth explanation + sample here: https://github.com/clojure/tools.deps.alpha/wiki/SSH-Authentication-in-Docker

alexmiller 2021-01-22T16:02:26.037100Z

cool