How the promotion feature works

You can use the promote feature to promote a build to an environment, for example, promote build number 42 to production. This creates and executes a new build with a new build number using the same details as build number 42 (commit sha, ref, etc) and with a promote event type.

You can promote builds using the command line utility:

drone build promote <repo> <number> <environment>
drone build promote octocat/hello-world 42 staging
drone build promote octocat/hello-world 42 production

This feature is useful when you want to promote code from development to staging to production environments in an automated fashion. This provides the following benefits:

  1. reduces human error
  2. creates an audit trail
  3. eliminates the need to provide all developers access to environments

If you are using promotions you probably want to restrict certain pipeline steps to only execute for promotion events, or for promotion events to specific environments. For example, only execute a pipeline step when promoting a build to production:

  - promote
  - production