The drone runtime package implements the execution model for container-based
pipelines. It is effectively a lightweight container orchestration engine
optimized for pipelines.
Definition File
The runtime package accepts a pipeline definition file as input, which is a
simple json file. This file is not intended to be read or written by humans.
It is considered an intermediate representation, and should be generated by
a computer program from more user-friendly formats such a yaml.
Example hello world definition file:
{
"version": 1,
"pipeline": [
{
"name": "stage_0",
"alias": "stage_0",
"steps": [
{
"name": "step_0",
"alias": "step_0",
"image": "alpine:3.6",
"working_dir": "/",
"entrypoint": [
"/bin/sh",
"-c"
],
"command": [
"echo hello world"
],
"on_success": true
}
]
}
],
"networks": [ ],
"volumes": [ ]
}
Local Testing
The runtime package includes a simple command line utility allowing you to
test pipeline execution locally. You should use this for local development and
testing.
The runtime package includes sample definition files that you can safely
execute on any machine with Docker installed. These sample files should be used
for research and testing purposes.
Example commands:
drone-runtime samples/1_hello_world.json
drone-runtime samples/2_on_success.json
drone-runtime samples/3_on_failure.json
drone-runtime samples/4_volume_read_write.json
drone-runtime samples/5_redis.json
drone-runtime samples/6_redis_multi.json
drone-runtime samples/7_postgres.json
drone-runtime --chroot=/tmp/drone samples/8_backup_restore.json
drone-runtime --chroot=/tmp/drone samples/9_restore.json
Runtime Engines
The default runtime engine targets Docker, but can be extended using plugins.
The plugin loader expects your custom engine is exposed using the following
convention:
package main
import "github.com/drone/drone-runtime/engine"
func Engine() (engine.Engine, error) {
// return your custom engine implementation
}
Test your plugin using the command line utility:
drone-runtime --plugin=custom/plugin.so samples/1_hello_world.json