Configuration

This document provides a high-level overview of the .drone.yml configuration file. The configuration file is placed in the root of your repository and defines one or more continuous integration or continuous delivery Pipelines.

Example pipeline configuration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
kind: pipeline
type: docker
name: default

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

Objects

The configuration file defines one or many objects in the same file, where each object is a separate yaml document. Pipelines are one kind of object. You can also define Signature and Secret objects.

  • Example Pipeline configuration:

    kind: pipeline
    type: docker
    name: default
    
    steps:
    - name: test
      image: golang
      commands:
      - go build
      - go test
    
  • Example Pipeline and Signature configuration:

    ---
    kind: pipeline
    type: docker
    name: default
    
    steps:
    - name: test
        image: golang
        commands:
        - go build
        - go test
    
    ---
    kind: signature
    hmac: F10E2821BBBEA527EA02200352313BC059445190
    

Each object must include the kind attribute. The kind attribute identifies the kind of object being declared, and helps to distinguish one object from another.

Pipelines

The Pipeline object defines a Continuous Integration and Continuous Delivery pipeline. The type attribute defines the runtime that should be used when executing the pipeline. Drone offers support for a variety of runtimes.

  • Example Docker pipeline, which executes each pipeline steps inside isolated Docker containers.

    kind: pipeline
    type: docker
    
  • Example Kubernetes pipeline, which executes pipeline steps as containers inside of Kubernetes pods.

    kind: pipeline
    type: kubernetes
    
  • Example Exec pipeline, which executes pipeline steps directly on the host machine, with zero isolation.

    kind: pipeline
    type: exec
    

Multiple Pipelines

When you define multiple Pipeline objects in the same configuration file, pipelines are spread across runners and executed in parallel. The below example configures two pipelines to execute in parallel. The overall build status is determined by the successful completion of both pipelines.

Please note that Pipelines do not share state. It is not possible for two pipelines to access the same underlying file system or generated files.
When running multiple pipelines if any of the sibling pipelines fails further build pipelines will be stopped. This may present different behaviour, depending on the scheduling of sibling pipelines. This will give non-deterministic behaviour.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
kind: pipeline
type: docker
name: backend

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

---
kind: pipeline
type: docker
name: frontend

steps:

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

Multiple Platforms

One common use case for multiple pipelines is to define and execute pipelines for different platforms. For example, execute one pipeline on x86 and another pipeline on arm.

 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
28
kind: pipeline
type: docker
name: amd64

platform:
  arch: amd64

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

---
kind: pipeline
type: docker
name: arm

platform:
  arch: arm64

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

Graph Execution

Drone also supports describing your pipelines as a directed acyclic graph. In the below example we fan-out to execute the first two pipelines in parallel, and then once complete, we fan-in to execute the final pipeline.

 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
28
29
30
31
32
33
34
35
36
37
kind: pipeline
type: docker
name: backend

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

---
kind: pipeline
type: docker
name: frontend

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

---
kind: pipeline
name: after

steps:
- name: notify
  image: plugins/slack
  settings:
    room: general
    webhook: https://...

depends_on:
- backend
- frontend

Scripting

Drone supports custom language extensions for when you need a more powerful alternative to yaml. See the Starlark and Jsonnet documentation for more details. You can also create your own language extension.