travis-ci / gimme

Install go, yay!
MIT License
707 stars 74 forks source link

Multiple source-level builds, reusable caching #147

Open philpennock opened 6 years ago

philpennock commented 6 years ago

Is there enough interest/use-case for being able to specify gimme abcdef1234 to get a specific git sha and be able to do so repeatably, using cached builds rather than rebuilding each time?

If so, then this is a sketch of how we might do it:

  1. Require a git new enough to support --reference
  2. Maintain a bare repo at ~/.gimme/versions/go.git, use git fetch to update it
  3. Whenever we build tip, or a specific SHA, resolve it first, then effectively do git clone --reference ~/.gimme/versions/go.git https://github.com/golang/go ~/.gimme/versions/ref.abcdef1234
  4. Cache based on existence of that specific directory; resolve tip each time. This gives us working tip which updates but caches correctly
  5. Have gimme update a log-file on each invocation, recording (timestamp, version)
  6. Have gimme clean use the log-file to figure out any local version not used in the past two weeks (default) and nuke them.

There are problems with --reference but they relate to having one repo mapped into Docker but not the other repo. That should not be an issue with the internals of the gimme directory (and --dissociate is available if we really must bloat with redundant copies).

I'm tentatively willing to do this work, once 1.5.0 is out, as work for 1.6.0.

anitgandhi commented 6 years ago

That would definitely be useful in my opinion, and the re-usable caching sounds like it would solve #146 as well. gimme clean would be very useful!