From 0685ca7e5f8b8ce1a356db7a790f36937cd80ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gencer=20W=2E=20Gen=C3=A7?= Date: Sat, 1 Apr 2023 23:56:52 +0300 Subject: [PATCH] Add `save-cache` option to README [ci skip] --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 8c8bfe1..b56d3c5 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Plus, In addition to tarball & rsync, we also do not re-create another tarball f - [Continue to cache on failed builds](#continue-to-cache-on-failed-builds) - [Multi-threaded compression](#multi-threaded-compression) - [Sharing caches between pipelines](#sharing-caches-between-pipelines) + - [Keep the cache file between jobs/builds](#keep-the-cache-file-between-jobsbuilds) - [Auto deletion old caches](#auto-deletion-old-caches) - [Globs on paths](#globs-on-paths) - [Roadmap](#roadmap) @@ -493,6 +494,31 @@ steps: pipeline-slug-override: "other-pipeline" # other-pipeline references the same Gemfile.lock ``` +## Keep the cache file between jobs/builds + +To prevent re-downloading the same cache again and place it to a temporary directory then copy when necessary use the `save-cache` option as follows: + +```yaml +steps: + - name: ':jest: Run tests' + key: jest + command: yarn test --runInBand + plugins: + - nienbo/cache#v2.4.13: + id: ruby # or ruby-3.0 + backend: s3 + key: "v1-cache-{{ id }}-{{ runner.os }}-{{ checksum 'Gemfile.lock' }}" + restore-keys: + - 'v1-cache-{{ id }}-{{ runner.os }}-' + - 'v1-cache-{{ id }}-' + compress: 2 # fast compression. + s3: + bucket: s3-bucket + save-cache: true # Optional. Saves the cache on temp folder and keep between builds/jobs on the same machine. Defaults to `false` + paths: + - bundle/vendor +``` + ## Auto deletion old caches For tarballs, To keep caches and delete them in _for example_ 7 days, use `max: 7`.