Drone plugins > Google Cloud Storage Cache
google_gcs.svg

Google Cloud Storage Cache

by hvalle


The GCS cache plugin can be used to preserve files and directories between builds.

Example

kind: pipeline
name: default

steps:
- name: restore-cache
  image: homerovalle/drone-gcs-cache
  pull: true
  settings:
    bucket: gcs_bucket
    json_key: your-service-account-json-key
    restore: true
- name: build
  image: node
  commands:
  - npm install
- name: rebuild-cache
  image: homerovalle/drone-gcs-cache
  pull: true
  mount:
    - node_modules
  settings:
    bucket: gcs_bucket
    json_key: your-service-account-json-key
    rebuild: true
- name: flush-cache
  image: homerovalle/drone-gcs-cache
  pull: true
  settings:
    bucket: gcs_bucket
    json_key: your-service-account-json-key
    flush: true
    flush_age: 14

Properties

  • json_key

    stringrequired

    service account json key.

    Secret recommended

    Default: none

  • restore

    booleanoptional

    mode to restore the build environment from cache.

    Default: false

  • rebuild

    booleanoptional

    mode to rebuild the cache from the build environment and specified mounts.

    Default: false

  • flush

    booleanoptional

    mode to flush the cache of old cache items (please be sure to set this so we don't waste storage).

    Default: false

  • flush_age

    numberoptional

    flush cache files older then x days.

    Default: 30

  • mount

    arrayoptional

    list of files/directories to cache.

    Default: none

  • debug

    booleanoptional

    enabling more logging for debugging.

    Default: false

  • filename

    stringoptional

    filename to use for cache.

    Default: none

  • bucket

    stringrequired

    bucket to use to rebuild and restore cache.

    Default: none

  • path

    stringrequired

    path to store the cache file.

    Default: [bucket]/<owner>/<repo>/<branch>/

  • fallback_path

    stringrequired

    fallback path for the cache file.

    Default: [bucket]/<owner>/<repo>/<branch>/

  • flush_path

    stringrequired

    path to search for flushable cache files.

    Default: [bucket]/<owner>/<repo>/