Build cache - environment variables
The build chace is really useful for storing installed tools. However, it doesn't interact well with tools that set environment variables. Tool files are restored from cache, but the environment isn't.
My suggestion would be to somehow save environment variables in the build cache.
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Feodor Fitsner on 23 Oct, 2014 07:15 PM
So, the primary use case for that is Chocolatey?
-Feodor
2 Posted by gep13 on 23 Oct, 2014 08:14 PM
That is one yes, but can things like ruby gems, node packages, also add environment variables?
Gary
Support Staff 3 Posted by Feodor Fitsner on 23 Oct, 2014 10:52 PM
I don't know why :) but pushing all environment variables into cache doesn't sound like good to me.
I think for such cases you would better not use cache or maintain needed variables in your build script.
4 Posted by gep13 on 24 Oct, 2014 06:31 AM
I think I have to agree.
What might be "nice" but also impractical would be to allow a "snapshot" of the build worker image. That way, your snapshot could be re-hydrated when your next build starts.
Gary
5 Posted by Lars Brinkhoff on 24 Oct, 2014 06:03 PM
The use case would be all build tools that install new environment variables, in particular PATH. I don't claim to be an expert in the field, but it was my impression that this is rather common. I'm surprised no one brought it up yet, but then the build cache is a new feature, right?
Actually, I was forced to use the build cache, because installing Cygwin sometimes made my build time out. (But now I may be able to use the image with Cygwin preinstalled -- thanks!) Anyway, I'm ok with my workaround: setting PATH manually.
Support Staff 6 Posted by Feodor Fitsner on 24 Oct, 2014 06:18 PM
Yes, it's quite new and kinda experimental. Works well for some cases (NuGet packages, ruby gems), but not a panacea.
7 Posted by gep13 on 24 Oct, 2014 06:33 PM
One thing that you could do would be to cache the download that Chocolatey does, so that you don't have that time added to the overall build. I don't know how big the downloads for these packages are (I have never used them) but if there are quite sizeable, you can cache the downloaded installers, and then simply do the install from there.
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:49 AM.