Hello community! Is there a way to ignore certain ...
# general
f
Hello community! Is there a way to ignore certain environment variables in cache keys computations? So that changing them doesn't invalidate cache. In my case this is needed to pass the information on current branch and commit for tests telemetry. But I can see this may be useful for passing integration credentials too.
f
There isn't currently. It is also not a new request; you'll find some Slack and GitHub discussions on the topic. I recall that passing credentials for private PyPI repositories was one use case.
In my view, the technical topic which is blocking progress on a solution is that Pants supports Remote Execution API (REAPI) which does not have a concept of uncached environment variables. Thus, there is a choice of how (or how not to) support REAPI with an uncached env vars feature.
So a solution in Pants to add uncached environment variables would necessarily either have to have substandard support for REAPI (by having the uncached vars become cached) or extend REAPI in some Pants-specific way.
f
Are there known workarounds for non remote execution cases?
h
There are open tickets for this, I've been looking into it a bit
And yeah, one of the main issues is REAPI, but even without that it's a little more complicated than I first thought
But not impossible
c
Are there known workarounds for non remote execution cases?
Hacks that break out of the sandbox to pass information around. For example to pass around some telemetry/creds for pytest I have some code that writes to /well/known/location and then a pytest fixture that reads from there. This require you to have a fair amount of control of the code in question and isn't a general solution.
h
This is a thing I would like to address, but it is delicate