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 kind: pipeline
2 type: docker
3 name: default
4
5 steps:
6 - name: test
7 image: golang
8 commands:
9 - go build
10 - 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.
1 kind: pipeline
2 type: docker
3 name: backend
4
5 steps:
6 - name: build
7 image: golang
8 commands:
9 - go build
10 - go test
11
12 ---
13 kind: pipeline
14 type: docker
15 name: frontend
16
17 steps:
18 - name: build
19 image: node
20 commands:
21 - npm install
22 - 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 kind: pipeline
2 type: docker
3 name: amd64
4
5 platform:
6 arch: amd64
7
8 steps:
9 - name: build
10 image: golang
11 commands:
12 - go build
13 - go test
14
15 ---
16 kind: pipeline
17 type: docker
18 name: arm
19
20 platform:
21 arch: arm64
22
23 steps:
24 - name: build
25 image: golang
26 commands:
27 - go build
28 - 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 kind: pipeline
2 type: docker
3 name: backend
4
5 steps:
6 - name: build
7 image: golang
8 commands:
9 - go build
10 - go test
11
12 ---
13 kind: pipeline
14 type: docker
15 name: frontend
16
17 steps:
18 - name: build
19 image: node
20 commands:
21 - npm install
22 - npm test
23
24 ---
25 kind: pipeline
26 name: after
27
28 steps:
29 - name: notify
30 image: plugins/slack
31 settings:
32 room: general
33 webhook: https://...
34
35 depends_on:
36 - backend
37 - 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.