Custom 'when' or events

this is not possible, but if you want to manually trigger builds you can use drone deploy. You pick and existing build number, and you promote it. Example command signature:

drone deploy <repo> <build number> <environment>

Example command with dummy data

drone deploy octocat/hello-world 22 prod

Then in your yaml you can specify that certain steps should only execute for deployment events and for certain environments. For example:

pipeline:
  ...
  docker_stage:
    image: plugins/docker
    when:
      event: deployment
      environment: staging
  docker_prod:
    image: plugins/docker
    when:
      event: deployment
      environment: production

Note that you will need to enable deployment events for your repository for this to work. You can enable deployment events by going to your repository settings in Drone.

2 Likes