Overview

Plugins are Docker containers that perform pre-defined tasks and are configured as steps in your pipeline. Plugins can be used to deploy code, publish artifacts, send notification, and more.

Example pipeline using the Docker and Slack plugins:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
kind: pipeline
type: docker
name: default

steps:
- name: build
  image: golang
  commands:
  - go get
  - go test
  - go build

- name: publish
  image: plugins/docker
  settings:
    username: kevinbacon
    password: pa55word
    repo: foo/bar
    tags:
    - 1.0.0
    - 1.0

- name: notify
  image: plugins/slack
  settings:
    channel: developers
    username: drone

Plugins are just Docker containers which means you can write plugins in any programming language that runs inside a container. You can even create plugins using simple bash scripting.

Source Code

Plugins automatically have access to the relevant source code and commit for a build, mounted as a volume into the plugin container. The plugin is also started with the current working directory set to the root of the git repository. The plugin does not need to clone or checkout code; this is handled by Drone.

Plugin Inputs

Plugins parameters are defined in the settings section of the pipeline step and are passed to the plugin container as environment variables. The environment variables are prefixed to prevent naming conflicts.

  • Example plugin configuration.

    - name: publish
      image: plugins/docker
      settings:
        username: kevinbacon
        password: pa55word
        repo: foo/bar
        tags:
        - 1.0.0
        - 1.0
    
  • Example plugin variables passed to the container.

    PLUGIN_USERNAME=kevinbacon
    PLUGIN_PASSWORD=pa55word
    PLUGIN_REPO=foo/bar
    PLUGIN_TAGS=1.0.0,1.0
    

Plugin parameters can be any primitive type or array of primitive types. Arrays are converted to comma-separate strings.

Plugin Distribution

Plugins are distributed as Docker images. You can publish plugins to any Docker registry, private or public, to share plugins internally with your organization, or publicly with the broader developer community.

Plugin Registry

The Drone plugin registry is a listing of Open Source plugins created by the Drone community. Want to add your plugin to the registry? Send us a pull request that adds your plugin to the registry website.

Browse the Plugin Registry