leiningen

N.B. The maintainers are on #leiningen on Libera chat IRC. Go there for direct support/bug reports.
2019-02-01T09:38:21.063100Z

I noticed something quite strange

2019-02-01T09:39:18.064300Z

I've added another profile :circleci [:test {:env {:environment "circleci"}}] to simply override on env varialble in the profile circleci, and this never picks it up: lein with-profile circleci test and keeps on thinking that you passed the test profile

2019-02-01T09:39:40.065Z

however lein with-profile circleci db migrate for example works perfectly fine and picks up my change

2019-02-01T09:39:55.065500Z

is there something special about the test command?

2019-02-01T14:38:52.067100Z

@andrea.crotti not 100% I follow what you’re trying but perhaps try doing lein with-profile +circleci test

2019-02-01T14:39:24.068100Z

Although I don’t have a strong reason to suspect that’s the problem if you are just thinking the :test profile isn’t loading or something.

2019-02-01T14:40:00.069200Z

You can play around with lein with-profile circleci pprint as well I believe to see things perhaps clearer

2019-02-01T14:50:17.069400Z

I tried +circleci and it's the same

2019-02-01T14:50:36.070Z

@mikerod lein with-profile works with any command, but not with test

2019-02-01T14:50:46.070700Z

which seems to force loading just the test profile

2019-02-01T14:58:09.071300Z

That shouldn’t be the case.

2019-02-01T14:59:48.073Z

Seems strange to me. Unless it is loading test profile over your composite profile.

2019-02-01T15:00:10.073600Z

So undoing the override you are attempting

2019-02-01T15:01:37.075600Z

You can try pulling whatever environment stuff you want to alter out to a separate profile. And refer to that in circleci and if you want a default test to include it, just add it with a with-profile (can alias to make it less typing)

2019-02-01T15:04:17.076100Z

ok it is loading the circleci profile as well

2019-02-01T15:04:26.076400Z

but it's not overriding an :env variable

2019-02-01T15:04:35.077Z

so if I create .new env variable that's picked up

2019-02-01T15:06:23.077900Z

and with +circleci it's the same, so I guess overriding env variables just doesn't work

2019-02-01T15:06:37.078500Z

which probably makes sense I just have to find another way

2019-02-01T15:19:37.079500Z

So my thought is that you have a composite profile test+circleci and it may work fine on its own

2019-02-01T15:19:57.080200Z

But during the test tasks, lein is adding test profile to whatever else you specify

2019-02-01T15:20:18.080900Z

So you get test+circleci, test

2019-02-01T15:20:42.081300Z

yes but the content of :env is not merged the way I thought it would

2019-02-01T15:20:55.082Z

So the merge is being merged over.

2019-02-01T15:20:57.082200Z

new config goes there but existing config doensn't get overridden

2019-02-01T15:21:08.083Z

But if you have bigger problems with merging. That’s a separate issue. Hah

2019-02-01T15:21:08.083100Z

I already found another way though

2019-02-01T15:21:10.083500Z

so not a big deal

2019-02-01T15:21:15.083700Z

Ok cool.

2019-02-01T15:23:09.086700Z

Just FYI most profile data in lein is merged just via a generic merging fn it has. Maps merge mostly the same as clj merge, but certain collection types have special merge-with semantics. Like vectors (sequentials ? I think) are concatenated and maps are “deep” merged I think. I can’t remember exactly without looking though.

2019-02-01T15:23:52.087600Z

You can use metadata like ^:replace on certain structures to influence this merging behavior too.