I noticed something quite strange
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
however lein with-profile circleci db migrate
for example works perfectly fine and picks up my change
is there something special about the test command?
@andrea.crotti not 100% I follow what you’re trying but perhaps try doing lein with-profile +circleci test
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.
You can play around with lein with-profile circleci pprint
as well I believe to see things perhaps clearer
I tried +circleci and it's the same
@mikerod lein with-profile
works with any command, but not with test
which seems to force loading just the test profile
That shouldn’t be the case.
Seems strange to me. Unless it is loading test profile over your composite profile.
So undoing the override you are attempting
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)
ok it is loading the circleci
profile as well
but
it's not overriding an :env
variable
so if I create .new env variable that's picked up
and with +circleci it's the same, so I guess overriding env variables just doesn't work
which probably makes sense I just have to find another way
So my thought is that you have a composite profile test+circleci and it may work fine on its own
But during the test tasks, lein is adding test profile to whatever else you specify
So you get test+circleci, test
yes but the content of :env
is not merged the way I thought it would
So the merge is being merged over.
new config goes there but existing config doensn't get overridden
But if you have bigger problems with merging. That’s a separate issue. Hah
I already found another way though
so not a big deal
Ok cool.
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.
You can use metadata like ^:replace on certain structures to influence this merging behavior too.