tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
steveb8n 2020-08-21T01:59:26.039500Z

Q: Is this a silly idea? I want a combination of git deps and “-LATEST” behviour for my CI/test builds. For prod builds I want static git shas but for automated/test builds, it would be great to automatically use the most recent git sha. Is this even possible?

steveb8n 2020-08-21T07:25:13.047700Z

thanks. I’ll look into that as well. I’ve never used them before but, if they add no complexity, I’ll give them a try

borkdude 2020-08-21T07:26:03.047900Z

@steveb8n I'm using them in babashka, I have 4 of them now.

steveb8n 2020-08-21T07:27:03.048100Z

cool. I’ll look at your repos when I dig deeper

borkdude 2020-08-21T07:27:06.048300Z

Not everyone likes them, I'm not entirely sure why, they work well for me.

practicalli-john 2020-08-21T11:29:46.050900Z

I would certainly keep specific library dependency versions the same for any CI pipeline that had any chance of pushing things into production. Are you able to set up separate CI pipeline that uses a different alias to pull 'latest' versions of libraries? I prefer using :local/root rather than mono-repo or sub-modules as they feel simpler for the way I work. Nothing wrong with those approaches though...

borkdude 2020-08-21T11:31:53.051200Z

local/root works, but not if the repo you're including is not part of the codebase proper, unless you're writing a script to set up the filesystem in CI the exact same way as on your machine

practicalli-john 2020-08-21T11:34:05.051400Z

Is that the case when using jars built from other projects, I thought that worked. Maybe I am mis-remembering.

borkdude 2020-08-21T11:35:05.051600Z

I mean, with local/root to some other project, you'll also have to git clone that other project in CI right

practicalli-john 2020-08-21T11:36:54.051800Z

Ah, yes.

steveb8n 2020-08-21T23:22:37.055400Z

I feel the same @jr0cket in that I like them all separate. it has the added benefit of allowing me to outsource work on projects without needing to grant access to all

steveb8n 2020-08-21T23:23:36.055600Z

so for me it’s.. local deps using local/root, CI using git/sha and prod using the same git/sha

steveb8n 2020-08-21T23:24:35.055800Z

and the maintenance annoyance is updating the git shas for the CI builds anytime upstream projects change.

steveb8n 2020-08-21T23:25:32.056Z

from this thread, I’ve realised that this is also a good thing because it means that my CI builds always match prod builds. thus it’s probably the lesser of all evils, despite the chattiness of commits

2020-08-24T08:15:33.057300Z

@borkdude: I’ve done the git submodule thing many times in the past. I’ve found it works quite well if you’re careful and have infrequently changing dependencies, but it can become pretty painful if you change branches a lot and have fast moving dependencies. The detached heads in the submodules can also lead to people unwittingly making many kinds of mistakes.

borkdude 2020-08-24T08:20:49.058Z

git pull --recurse-submodules

borkdude 2020-08-24T08:21:08.058200Z

I almost never have such mistakes, but maybe for contributors it's different?

souenzzo 2020-08-21T02:35:07.041800Z

Temporal-basead versions are always bad IMHO If your CI fail and you run it again, it may take a new commit and success again. So success and fail says nothing. Pass the commit ID to your CI or fetch and use a sed / template. Then in case of success/fail, you will know which code succeed/failed

souenzzo 2020-08-21T02:35:28.042Z

And you will be able to run again the same CI in a older commit/retry

steveb8n 2020-08-21T02:42:56.042200Z

thx. fetch and sed is an interesting idea. I could even use bb for this script.

steveb8n 2020-08-21T02:43:36.042400Z

how would the script apply the latest sha? by writing it into the deps.edn? or is there some other trick?

steveb8n 2020-08-21T02:45:41.042600Z

fyi: the reason I want this is to avoid the endless commits I currently do for all my git deps during dev/test. but I really like using git deps in CI

seancorfield 2020-08-21T02:55:23.042800Z

Running CI and production against different versions seems like a recipe for hard-to-debug disaster...

seancorfield 2020-08-21T02:56:35.043Z

I can understand wanting your local dev-only tooling to always pick up the RELEASE (or perhaps occasionally the LATEST) release but I really don't want any variance in versions between dev, CI, production for anything I depend on.

seancorfield 2020-08-21T02:57:01.043200Z

(so I guess my answer to your actual Q would be "yes, it's a silly idea" IMO)

steveb8n 2020-08-21T03:19:50.043400Z

that is useful perspective. I’ll apply a hammock to this a little more. thanks

steveb8n 2020-08-21T03:24:27.043600Z

I should have mentioned that these deps are all projects that I control but have split apart for re-use and/or separation of concerns. so I can be sure I know when changes are being introduced. I would never do this for an external dependency

seancorfield 2020-08-21T03:34:05.043800Z

Consider using :local/root maybe, if you have them all checked out locally?

seancorfield 2020-08-21T03:34:54.044Z

You can always use a :dev alias to use :override-deps to replace the regular deps with your local ones.

steveb8n 2020-08-21T03:43:43.044200Z

agreed. I am using :local/root for these deps for localhost. the annoying commits are required when I push a lib which I depend on in N other projects and then have to update shas in all of them

steveb8n 2020-08-21T03:44:42.044400Z

ideally CI/test would use latest for all these deps. then when I cut a prod release, I would update the shas (once) for all the deps

steveb8n 2020-08-21T03:45:13.044600Z

but I can see that I could introduce human error later i.e. forget 1 sha update in the prod build. that would be bad

steveb8n 2020-08-21T03:45:32.044800Z

that would qualify as “silly”

steveb8n 2020-08-21T03:46:42.045Z

this maintenance problem seems to be pushing me towards a mono-repo but I like keeping these things separate

seancorfield 2020-08-21T04:07:10.045200Z

Our 100K+ line codebase at work is in a monorepo, with 30+ subprojects, and we build about a dozen deployment artifacts from that...

steveb8n 2020-08-21T04:14:44.045400Z

it’s something I will think about. thanks

borkdude 2020-08-21T06:39:45.047500Z

@steveb8n I’m using git submodules to prevent endless commits updating git deps. Easy to update them all to latest using one git command. Works with all build tools.

borkdude 2020-08-21T08:37:49.048900Z

Wondering, is tools.build also going to have a test runner like https://github.com/cognitect-labs/test-runner or is this a separate concern?

2020-08-21T10:34:15.049600Z

Hi, I'm trying to reference the head of the manual-connector-anchors branch on dali here: https://github.com/stathissideris/dali/tree/manual-connector-anchors

2020-08-21T10:34:45.050300Z

and I'm struggling a bit with the deps.edn. Does anyone have a good example of how to reference a branch on github at a :git/url ?

2020-08-21T10:41:36.050500Z

I have it working locally in the mean time

2020-08-21T11:20:24.050700Z

fixed: https://github.com/stathissideris/dali/pull/20

alexmiller 2020-08-21T12:29:36.053Z

Not building any new test runner but you can make tasks that do whatever

alexmiller 2020-08-21T12:32:13.054300Z

Git deps always use shas so you don’t need to specify the branch

alexmiller 2020-08-21T12:32:27.054800Z

Sha is sufficient

2020-08-21T15:03:36.055Z

thx! I've got it working now. It was a problem with the deps.edn in the repo I was referencing.

alexmiller 2020-08-21T15:03:57.055200Z

ah