<p>Screwdriver now has the ability to cache and restore files and directories from your builds for use in other builds! This feature gives you the option to cache artifacts in builds using Gradle, NPM, Maven etc. so subsequent builds can save time on commonly-run steps such as dependency installation and package build.</p>
<p>You can now specify a top-level setting in your screwdriver.yaml called <code>cache</code> that contains file paths from your build that you would like to cache. You can limit access to the cache at a pipeline, event, or job-level scope.</p><!-- more -->
<p><b>Scope guide</b></p>
<ul><li><i>pipeline-level</i>: all builds in the same pipeline (across different jobs and events)</li></ul><figure data-orig-width="1999" data-orig-height="845" class="tmblr-full"><img src="https://66.media.tumblr.com/330ef23ec9b4d5a1d38b7d6ca355965b/tumblr_inline_phufo6Fbx81uvhog4_540.png" alt="image" data-orig-width="1999" data-orig-height="845"/></figure><ul><li><i>event-level</i>: all builds in the same event (across different jobs)</li></ul><figure data-orig-width="1999" data-orig-height="173" class="tmblr-full"><img src="https://66.media.tumblr.com/51d1e56fe7dd5e08c3d1ccee4c664df6/tumblr_inline_phufojzwJa1uvhog4_540.png" alt="image" data-orig-width="1999" data-orig-height="173"/></figure><ul><li><i>job-level</i>: all builds for the same job (across different events in the same pipeline)</li>
</ul><figure data-orig-width="1999" data-orig-height="341" class="tmblr-full"><img src="https://66.media.tumblr.com/a6359b6445c5218bb50c1f8ff66ebbcb/tumblr_inline_phufovDGS91uvhog4_540.png" alt="image" data-orig-width="1999" data-orig-height="341"/></figure><p><b>Example</b></p>
<pre><code>cache:
event:
- $SD_SOURCE_DIR/node_modules
pipeline:
- ~/.gradle
job:
test-job: [/tmp/test]
</code></pre>
<p>In the above example, we cache the .gradle folder so that subsequent builds in the pipeline can save time on <code>gradle install</code>.</p>
<p><i>Without cache:</i></p>
<figure data-orig-width="706" data-orig-height="1052" class="tmblr-full"><img src="https://66.media.tumblr.com/735829a6df383034db2cd382826a9de9/tumblr_inline_phufq48fw81uvhog4_540.png" alt="image" data-orig-width="706" data-orig-height="1052"/></figure><p><i>With cache:</i></p>
<figure data-orig-width="722" data-orig-height="1056" class="tmblr-full"><img src="https://66.media.tumblr.com/6df7f3769cda0ae5997f764a8638f753/tumblr_inline_phufqcsrLt1uvhog4_540.png" alt="image" data-orig-width="722" data-orig-height="1056"/></figure><h2>Compatibility List</h2>
<p>In order to use the new build cache feature, you will need these minimum versions:</p>
<ul><li><a href="https://hub.docker.com/r/screwdrivercd/queue-worker">screwdrivercd/queue-worker</a>:v2.2.2</li>
<li><a href="https://hub.docker.com/r/screwdrivercd/screwdriver">screwdrivercd/screwdriver</a>:v0.5.492</li>
<li><a href="https://hub.docker.com/r/screwdrivercd/launcher">screwdrivercd/launcher</a>:v5.0.37</li>
<li><a href="https://hub.docker.com/r/screwdrivercd/store">screwdrivercd/store</a>:v3.3.11</li>
</ul><p><b>Note</b>: Please ensure the store service has sufficient available memory to handle the payload. For cache cleanup, we use AWS S3 <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html">Lifecycle Management</a>. If your store service is not configured to use S3, you might need to add a cleanup mechanism.</p>
<h2>Contributors</h2>
<p>Thanks to the following people for making this feature possible:</p>
<ul><li><a href="https://github.com/d2lam"><b>d2lam</b></a></li>
<li><a href="https://github.com/pranavrc"><b>pranavrc</b></a></li>
</ul><p>Screwdriver is an open-source build automation platform designed for Continuous Delivery. It is built (and used) by Yahoo. Don’t hesitate to reach out if you have questions or would like to contribute: <a href="http://docs.screwdriver.cd/about/support">http://docs.screwdriver.cd/about/support</a></p>