Promoting

Drone provides the ability to promote individual commits or tags (e.g. promote to production). When you promote a commit or tag it triggers a new pipeline execution with event type deployment. You can use the event type and target environment to limit step execution.

pipeline:
  build:
    image: golang
    commands:
      - go build
      - go test

  publish:
    image: plugins/docker
    registry: registry.heroku.com
    repo: registry.heroku.com/my-staging-app/web
    when:
+     event: deployment
+     environment: staging

  publish_to_prod:
    image: plugins/docker
    registry: registry.heroku.com
    repo: registry.heroku.com/my-production-app/web
    when:
+     event: deployment
+     environment: production

The above example demonstrates how we can configure pipeline steps to only execute when the deployment matches a specific target environment.

Trigger Deployments

Deployments are triggered from the command line utility. They are triggered from an existing build. This is conceptually similar to promoting builds.

drone deploy <repo> <build> <environment>

Promote the specified build number to your staging environment:

drone deploy octocat/hello-world 24 staging

Promote the specified build number to your production environment:

drone deploy octocat/hello-world 24 production

Questions?

We are always happy to help with questions you might have. Search our documentation or check out answers to common questions. You can also post questions or comments to our community forum.