Build cache - environment variables

Lars Brinkhoff's Avatar

Lars Brinkhoff

23 Oct, 2014 08:17 AM

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.

  1. Support Staff 1 Posted by Feodor Fitsner on 23 Oct, 2014 07:15 PM

    Feodor Fitsner's Avatar

    So, the primary use case for that is Chocolatey?

    -Feodor

  2. 2 Posted by gep13 on 23 Oct, 2014 08:14 PM

    gep13's Avatar

    That is one yes, but can things like ruby gems, node packages, also add environment variables?

    Gary

  3. Support Staff 3 Posted by Feodor Fitsner on 23 Oct, 2014 10:52 PM

    Feodor Fitsner's Avatar

    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. 4 Posted by gep13 on 24 Oct, 2014 06:31 AM

    gep13's Avatar

    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. 5 Posted by Lars Brinkhoff on 24 Oct, 2014 06:03 PM

    Lars Brinkhoff's Avatar

    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.

  6. Support Staff 6 Posted by Feodor Fitsner on 24 Oct, 2014 06:18 PM

    Feodor Fitsner's Avatar

    Yes, it's quite new and kinda experimental. Works well for some cases (NuGet packages, ruby gems), but not a panacea.

  7. 7 Posted by gep13 on 24 Oct, 2014 06:33 PM

    gep13's Avatar

    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.

  8. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:49 AM.

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

 

20 Aug, 2024 09:07 PM
15 Aug, 2024 09:17 AM
10 Aug, 2024 02:42 PM
09 Aug, 2024 10:48 PM
06 Aug, 2024 08:03 PM
01 Aug, 2024 04:26 PM