Drone plugins > Drone Cache
drone_cache.svg

Drone Cache

by meltwater


A Drone plugin for caching current workspace files between builds to reduce your build times. `drone-cache` is a small CLI program, written in Go without any external OS dependencies (such as tar, etc).

Example

kind: pipeline
name: default

steps:
  - name: restore-cache
    image: meltwater/drone-cache:dev
    pull: true
    settings:
      access-key:
        from_secret: aws_access_key_id
      secret-key:
        from_secret: aws_secret_access_key
      restore: true
      bucket: drone-cache-bucket
      region: eu-west-1
      mount:
        - 'vendor'

  - name: build
    image: golang:1.11-alpine
    pull: true
    commands:
      - apk add --update make git
      - make drone-cache

  - name: rebuild-cache
    image: meltwater/drone-cache:dev
    pull: true
    settings:
      access-key:
        from_secret: aws_access_key_id
      secret-key:
        from_secret: aws_secret_access_key
      rebuild: true
      bucket: drone-cache-bucket
      region: eu-west-1
      mount:
        - 'vendor'

Properties

  • backend

    stringoptional

    cache backend to use in plugin (s3, filesystem).

    Default: s3

  • mount

    arrayoptional

    cache directories, an array of folders to cache.

    Default: none

  • rebuild

    booleanoptional

    whether to rebuild the cache directories.

    Default: false

  • restore

    booleanoptional

    whether to restore the cache directories.

    Default: false

  • cache-key

    stringoptional

    cache key to use for the cache directories.

    Default: none

  • archive-format

    stringoptional

    archive format to use for the cache directories (tar, gzip).

    Default: tar

  • debug

    booleanoptional

    whether to enable debug mode.

    Default: false

  • filesystem-cache-route

    stringoptional

    local filesystem root directory for the filesystem cache.

    Default: /tmp/cache

  • endpoint

    stringoptional

    endpoint for the s3 connection.

    Default: none

  • access-key

    stringoptional

    AWS access key.

    Secret recommended

    Default: none

  • secret-key

    stringoptional

    AWS secret key.

    Secret recommended

    Default: none

  • bucket

    stringoptional

    AWS bucket name.

    Default: none

  • region

    stringoptional

    AWS bucket region.

    Default: none

  • path-style

    booleanoptional

    use path style for bucket paths. (true for minio, false for aws).

    Default: false

  • acl

    stringoptional

    upload files with acl (private, public-read, ...).

    Default: private

  • encryption

    stringoptional

    server-side encryption algorithm (AES256, aws:kms).

    Default: none