Drone and the Nomad Scheduler

#1

You can now use Nomad as the default scheduler for your Drone pipelines. The benefit of Nomad is that you no longer need to manage Drone agents. Just point Drone at Nomad and it will start scheduling builds.

Drone for Nomad is already being used to power cloud.drone.io.

Why Nomad

Drone for Nomad uses the powerful nomad scheduler to schedule your build resources across server nodes without having to install Drone Agents. This can dramatically simplify your Drone setup and ongoing maintenance.

The other benefit to Nomad is support for non-Docker workloads. We are planning to introduce host-machine builds in Drone 1.1 which will allow you to execute builds directly on the host machine (or optionally in a chroot). This will allow Drone to support workloads that are insufficient for containers, such as OSX and IOS.

Which Version of Drone

Drone for Nomad just landed in master and is available in the drone/drone:latest image. It will also be available in our 1.0.0-rc.6 release which is schedule for a few days from now.

How to Configure

To enable Drone for Nomad you need to pass the following environment variables to Drone server.

-e DRONE_NOMAD_ENABLED=true
-e DRONE_NOMAD_IMAGE_PULL=false
-e DRONE_NOMAD_IMAGE=drone/controller:latest

You will also need to pass your Nomad credentials to the Drone server so that it can connect to your nomad instance:

NOMAD_ADDR=http://127.0.0.1:4646
NOMAD_TOKEN=ae1c3a58-e239-38b2-2d1g-ec3829e31aa5
NOMAD_SKIP_VERIFY=
NOMAD_CLIENT_KEY=
NOMAD_CLIENT_CERT=
NOMAD_CAPATH=
NOMAD_CACERT=
NOMAD_REGION=

Installation Issues?

This feature is brand new, which means we do not have any common errors or troubleshooting tips to offer yet. So if you are having difficulty getting this installed and configured, please post in the comments below.

1.0.0-rc.6 release notes
#2

My nomad cluster isn’t using ACLs at the moment so I only populated the NOMAD_ADDR and NOMAD_REGION yet the jobs are staying stuck at “Pending”.

Logs at debug doesn’t show anything specific regarding that. Should the drone server be running within nomad itself for it to work?

#3

nope, this is not required. I use Drone+Nomad and do not run Drone itself in Nomad.

If a job is stuck in pending it could mean that Nomad never schedule the job, or Nomad failed to schedule the job. You should check Nomad to see the status and look for a failure message.

If Drone fails to hand the job off to Nomad, you would see an error message in the Drone logs. Since you did not mention this, it leads me to believe that the job was successfully schedule, but Nomad failed to execute.

#4

Couldn’t get this working until I put

DRONE_AGENTS_ENABLED=false

in the drone server env