Skip to content

sinlead/drone-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

drone-cache

A Drone CI plugin for caching data.

Usable Settings

action

  • required: true
  • value: 'load' or 'save'

key

  • required: true
  • usage: a file to identify whether we could use existed cache
  • value: a file/folder path

mount

  • required: true
  • usage: data should be chached
  • value: a file/folder path

prefix

  • required: suggested
  • value: a string in format: [A-Za-z][A-Za-z0-9_-]+

Example

kind: pipeline

steps:
  # find cached node_modules by the file 'yarn.lock'
  - name: load-yarn-cache
    image: sinlead/drone-cache:1.0.0
    settings:
      action: load
      key: yarn.lock
      mount: node_modules
      prefix: yarn-modules-v1
    volumes:
      - name: cache
        path: /cache

  - name: yarn-install
    image: node:11-alpine
    commands:
      - yarn install

  # save installed node_modules to cache
  - name: save-yarn-cache
    image: sinlead/drone-cache:1.0.0
    settings:
      action: save
      key: yarn.lock
      mount: node_modules
      prefix: yarn-modules-v1
    volumes:
      - name: cache
        path: /cache

# the cache storage at your host
volumes:
  - name: cache
    host:
      path: /tmp/cache

TODO

  • Clear old caches