Drone CI 中文文档

Plugins

Plugins are docker containers that encapsulate commands, and can be shared and re-used in your pipeline. Use plugins to build and publish artifacts, send notifications, and more.

Example Slack plugin:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
kind: pipeline
type: kubernetes
name: default

steps:
- name: build
  image: node
  commands:
  - npm install
  - npm test

- name: notify
  image: plugins/slack
  settings:
    webhook: https://hooks.slack.com/services/...

As you can see plugins are just Docker containers. Anyone can encapsulate logic, bundle as a Docker image, and publish to a Docker registry to share with their organization, or with the broader community.

Secrets

Drone provides the ability to source any configuration parameter from a named secret using the from_secret syntax.

Example Slack plugin using secrets:

 5
 6
 7
 8
 9
10
11
12
13
14
15
16
steps:
- name: build
  image: node
  commands:
  - npm install
  - npm test

- name: notify
  image: plugins/slack
  settings:
    webhook:
      from_secret: webhook

Example NPM plugin using secrets:

 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
steps:
- name: build
  image: node
  commands:
  - npm install
  - npm test

- name: publish
  image: plugins/npm
  settings:
    username:
      from_secret: username
    password:
      from_secret: password

Registry

The community maintains a public registry of Open Source plugins. You can browse the plugin registry at plugins.drone.io.

Plugin Registry