Skip to content

Commit f82080c

Browse files
authored
Merge pull request #129 from buildkite-plugins/SUP-2015-Update-readme-with-backend-examples
Sup 2015- update readme with backend examples
2 parents 8fcd50e + e59f2e8 commit f82080c

1 file changed

Lines changed: 48 additions & 3 deletions

File tree

README.md

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,25 @@ The `BUILDKITE_PLUGIN_FS_CACHE_FOLDER` environment variable defines where the co
7171

7272
**IMPORTANT**: the `fs` backend just copies files to a different location in the current agent, as it is not a shared or external resource, its caching possibilities are quite limited.
7373

74+
#### Example
75+
76+
```yaml
77+
env:
78+
BUILDKITE_PLUGIN_FS_CACHE_FOLDER: "/var/cache/buildkite" # Optional: where to store cache on the agent.
79+
80+
steps:
81+
- label: ':nodejs: Install dependencies'
82+
command: npm ci
83+
plugins:
84+
- cache#v1.7.0:
85+
backend: fs
86+
path: node_modules
87+
manifest: package-lock.json
88+
restore: file
89+
save: file
90+
compression: tgz # Optional compression
91+
```
92+
7493
#### `s3`
7594

7695
Store things in an S3 bucket. You need to make sure that the `aws` command is available and appropriately configured.
@@ -82,6 +101,29 @@ You also need the agent to have access to the following defined environment vari
82101

83102
Setting the `BUILDKITE_PLUGIN_S3_CACHE_ONLY_SHOW_ERRORS` environment variable will reduce logging of file operations towards S3.
84103

104+
105+
#### Example
106+
107+
```yaml
108+
env:
109+
BUILDKITE_PLUGIN_S3_CACHE_BUCKET: "my-cache-bucket" # Required: S3 bucket to store cache objects
110+
BUILDKITE_PLUGIN_S3_CACHE_PREFIX: "buildkite/cache"
111+
BUILDKITE_PLUGIN_S3_CACHE_ENDPOINT: "https://<your-endpoint>"
112+
BUILDKITE_PLUGIN_S3_CACHE_ONLY_SHOW_ERRORS: "true"
113+
114+
steps:
115+
- label: ':nodejs: Install dependencies'
116+
command: npm ci
117+
plugins:
118+
- cache#v1.7.0:
119+
backend: s3
120+
path: node_modules
121+
manifest: package-lock.json
122+
restore: file
123+
save: file
124+
compression: zstd
125+
```
126+
85127
### `compression` (string)
86128

87129
Allows for the cached file/folder to be saved/restored as a single file. You will need to make sure to use the same compression when saving and restoring or it will cause a cache miss.
@@ -190,7 +232,8 @@ steps:
190232
command: npm ci
191233
plugins:
192234
- cache#v1.7.0:
193-
manifest: package-lock.json
235+
manifest:
236+
- package-lock.json
194237
path: node_modules
195238
restore: pipeline
196239
save:
@@ -201,7 +244,8 @@ steps:
201244
command: npm test # does not save cache, not necessary
202245
plugins:
203246
- cache#v1.7.0:
204-
manifest: package-lock.json
247+
manifest:
248+
- package-lock.json
205249
path: node_modules
206250
restore: file
207251
- wait: ~ # don't run deploy until tests pass
@@ -210,7 +254,8 @@ steps:
210254
command: npm run deploy
211255
plugins:
212256
- cache#v1.7.0:
213-
manifest: package-lock.json
257+
manifest:
258+
- package-lock.json
214259
path: node_modules
215260
restore: file
216261
save:

0 commit comments

Comments
 (0)