Isolated Drone Servers

We’re evaluating drone for CI/CD. The approach we’d like to take is to have two separate drone servers in our staging and production clusters. The two clusters are isolated and cannot communicate with one another. We’re trying to figure out how to best setup our .drone.yaml to support running this.

For example, we’d like to have code automatically get deployed to staging when it’s merged to master. However, we don’t want the same code to be deployed in production until some user does a drone deploy. Since there is only one .drone.yml file per repo how would we prevent that automatic deploy from happening in our production environment?

you have two options

Since there is only one .drone.yml file per repo

You can customize the name and path of the yaml configuration file. This would allow you to have separate yaml files for each drone instance:

drone repo update octocat/hello-world --config=.drone.yml
drone repo update octocat/hello-world --config=.github/.drone.yml
drone repo update octocat/hello-world --config=.drone.stage.yml

Alternatively, you can have a single yaml configuration file and limit step execution based on the instance hostname, for example:

pipeline:

  # only execute step for prod drone instance
  step:
    when:
      instance: drone.company.com
  
  # only execute step for stage drone instance
  step:
    when:
      instance: stage.drone.company.com
1 Like

Awesome, not sure which approach we’ll take yet but both should work great for our needs.

The instance condition definitely needs to end up in the docs. I assume http://docs.drone.io/conditional-steps/ is the correct location for this info?

Also, https://github.com/drone/docs is the correct repo for docs PRs? If so, I’ll send one your way shortly!

Yes, thanks, that would be much appreciated :slight_smile:

PR here: