Jsonnet

Templates can be used by setting the kind to ’template’, the name of the base template to load, and a set of freeform template inputs in their drone.yml file:

kind: template
load: plugin.jsonnet
data:
  stepName: my_step
  image: my_image
  commands: my_command

Example base template:

local stepName = std.extVar("input.stepName");
local image = std.extVar("input.image");
local commands = std.extVar("input.commands");
{
  "kind": "pipeline",
  "type": "docker",
  "name": "default",
  "steps": [
    {
      "name": stepName,
      "image": image,
      "commands": [
        commands
      ]
    }
  ]
}

Predefined variable list can be found at: https://docs.drone.io/template/variables

Create organization templates using the command line tools:

$ drone template add [namespace] [name] [data]
$ drone template add octocat template_name @path_to_file