Hi! I bet this is described somewhere, but i canno...
# general
f
Hi! I bet this is described somewhere, but i cannot find it. For a
scala_artifact
how would I in a pants-friendly way provide auth credentials to coursier for private repositories?
For generate-lockfiles for example, neither
COURSIER_CREDENTIALS
nor
.netrc
seem to be honored. Am I missing something?
c
Pants will generally remove all environment variables before running subprocesses. Some goals have ways of passing extra env vars, but I don't think that generate-lockfiles does. If you can embed credentials into the url for coursier, you might be able to pass that in by setting the PANTS_COURSIER_REPOS envvar? Honestly, I'm not sure
f
Thanks, yes but even then that would not be a very good option as now you would provide the entire set of repos from some ENV, just to append basic auth on a subset of those repos?
c
oh I completely forgot about envvar interpolation
f
That looks exactly like what I want to do, thank you!. However, I can't get it to actually interpolate, am I missing something?
Copy code
[coursier]
repos = [
    "<https://pants>:%(env.MY_TOKEN)@maven.pkg.github.com/..."
]
MY_TOKEN=abc pants generate-lockfiles
the url is not interpolated when requested by coursier:
Copy code
__coursier/./cs-aarch64-apple-darwin fetch '-r=<https://pants>:%(env.MY_TOKEN)@maven.pkg.github.com/...
c
you need an
s
after the close paren, so it's of the form
"%(my_var)s"
, like
Copy code
"<https://pants>:%(env.MY_TOKEN)s@maven.pkg.github.com/..."
f
Ah, did not see that, thank you