Overview
Introduction
Drone CI's YAML is compact, but its secret-referencing syntax (`from_secret:`) and volume-mounting structure are easy to get subtly wrong when written from memory.
This tool generates a complete .drone.yml Docker pipeline from a form, with correctly structured steps, secret references, and volume mounts.
What Is Drone CI Generator?
A form-driven generator for Drone CI's Docker pipeline type. You add one or more steps, each with a name, Docker image, a list of commands, and optional secret names to inject as environment variables, plus optional shared volumes.
The output is a complete `kind: pipeline` / `type: docker` document with a top-level `steps:` list and, if configured, a `volumes:` list at the bottom.
How Drone CI Generator Works
Each secret name you list for a step becomes an environment variable (the secret name upper-cased and sanitized to a valid variable name) with a `from_secret:` reference to the lower-cased secret name, matching how Drone's secret store is typically referenced.
Each volume you define is mounted into every step that lists it under `volumes:` (by container path) and declared once at the document's bottom under the top-level `volumes:` key with its host path.
When To Use Drone CI Generator
Use it when setting up Drone CI for a new repository and you want a correctly structured .drone.yml, including secret references, without digging through Drone's docs.
It's also useful for adding a shared cache volume or a new secret-backed environment variable to an existing pipeline.
Often used alongside GitLab CI Generator, Buildkite Pipeline Generator and Bitbucket Pipelines Generator.
Features
Advantages
- Generates Drone's `from_secret:` syntax correctly, a detail that's easy to get wrong (e.g. confusing the environment variable name with the secret name) when hand-written.
- Keeps step-level and document-level volume declarations in sync, since Drone requires both a per-step mount and a top-level volume definition.
- Produces valid Docker-pipeline YAML with correct `kind`/`type` header fields every time.
Limitations
- Only the Docker pipeline type is covered; Kubernetes and exec pipeline types have different structures not generated here.
- Doesn't cover conditional execution (`when:` blocks), matrix builds, or multi-pipeline dependency graphs.
Examples
Best Practices & Notes
Best Practices
- Store any credential (npm tokens, API keys, deploy keys) as a Drone secret and reference it with from_secret rather than hard-coding it in the YAML.
- Use a shared cache volume for dependency directories to speed up repeated builds on self-hosted Drone runners with persistent disks.
- Keep step names short and descriptive (build, test, deploy) since they appear directly in Drone's build log UI.
Developer Notes
Secret environment variable names are derived by upper-casing the secret name and replacing any non-alphanumeric character with an underscore, since Drone expects a valid shell environment variable name on the left side of `from_secret:` while the secret name itself (looked up from Drone's secret store) is conventionally lower-cased. Volumes are rendered both inline (per step, referencing only the volume name and container path) and once at the document root with the host path, matching Drone's two-part volume declaration requirement.
Drone CI Generator Use Cases
- Scaffolding a new .drone.yml for a repository moving to Drone CI
- Adding a secret-backed environment variable (like a deploy token) to an existing pipeline
- Setting up a shared cache volume to speed up dependency installation across builds
Common Mistakes
- Referencing a from_secret name that doesn't match any secret actually configured in Drone, causing the step to fail on that missing secret at runtime.
- Mounting a volume in a step without declaring it at the top-level `volumes:` key (or vice versa), Drone requires both halves of the declaration.
Tips
- Register the referenced secrets in Drone's UI or CLI (`drone secret add`) before running the pipeline, generating the YAML doesn't create the secrets themselves.