Google Cloud Storage Plugin

Use this plugin to upload files and build artifacts to the Google Cloud Storage (GCS) bucket.

You will need to a Service Account to authenticate to the GCS.

The following parameters are used to configure this plugin:

  • auth_key - service account auth key
  • source - location of files to upload
  • target - destination to copy files to, including bucket name
  • ignore - skip files matching this pattern, relative to source
  • acl - a list of access rules applied to the uploaded files, in a form of entity:role
  • gzip - files with the specified extensions will be gzipped and uploaded with “gzip” Content-Encoding header
  • cache_control - Cache-Control header
  • metadata - an arbitrary dictionary with custom metadata applied to all objects

The following is a sample configuration in your .drone.yml file:

publish:
  gcs:
    auth_key: >
      $SERVICE_ACCOUNT_KEY
    source: dist
    target: bucket/dir/
    ignore: bin/*
    acl:
      - allUsers:READER
    gzip:
      - js
      - css
      - html
    cache_control: public,max-age=3600
    metadata:
      x-goog-meta-foo: bar

SERVICE_ACCOUNT_KEY would be defined in .drone.sec (before encryption):

checksum: ...
environment:
  SERVICE_ACCOUNT_KEY: >
    {
    "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
    "client_email": "[email protected]",
    "client_id": "12487645876234765",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://accounts.google.com/o/oauth2/token",
    }
This website is a public GitHub repository, which is forked from upstream Drone CI documentation. Please help us by forking and improving upstream Drone CI documentation or Tea CI documentation.