×
Find plugins

DigitalOcean0.16Minimum Jenkins requirement: 2.60.1ID: digitalocean-plugin

Installs: 208
Last released: 5 days ago
Maintainers
Robert Gruendler
Andreas Pieber
Maxim Biro

View DigitalOcean plugin on the plugin site for more information.

Allow Jenkins to start slaves on DigitalOcean droplets on demand and destroy them as they get unused.

Configure plugin via Groovy script

Either automatically upon Jenkins post-initialization or through Jenkins script console, example:

import com.dubture.jenkins.digitalocean.Cloud
import com.dubture.jenkins.digitalocean.SlaveTemplate
import jenkins.model.Jenkins

// parameters
def slaveTemplateParameters = [
  idleTerminationInMinutes: '10',
  imageId:                  'ubuntu-17-10-x64',
  initScript:               '',
  instanceCap:              '2',
  labelString:              'digitalocean.toronto.ubuntu.17.10',
  name:                     'digitalocean.toronto.ubuntu.17.10',
  numExecutors:             '1',
  regionId:                 'tor1',
  sizeId:                   '512mb',
  sshPort:                  22,
  userData:                 '',
  username:                 'root',
  workspacePath:            '/home/jenkins'
]

def cloudParameters = [
  authToken:      '01234567890123456789012345678901234567890123456789',
  instanceCap:    '2',
  name:           'mycompany',
  sshKeyId:       '01234567',
  timeoutMinutes: '10',
  privateKey:     '''-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgGuoiHtwl8T2cKfclsWLOcv8S6p74iOAQX1kwCLvLy7ioDFlNzsI
U235N1StnZYZIwGla+3Uo3jMSUuWkMH85+d3KoRFPS+6RJCiAvMI0hr8FByes22v
DAVDnhkZ2SFOeh1SPxWDygPo2fW5sgqL2eYLO1CplDdqYhHLAL1FDV5tAgMBAAEC
gYBWRZoJgXK9zdb9TZIs/6LzSlzAY8IWPOM+PwyRcibXZZiFvNyDm+pviHTEkNRl
wgMBgLR6xBmz5dEel6utKKQVEPtD1m6N+z6hwUw+Nis35DCvmBX+hQSK+atGgjYH
ZKz0oqWUSuzHG+CxxcrePDTYJ4fdSyLPsQqaWoCZseDDwQJBANLey9r+juBEQe2N
MJoZTU1q/AoS5kY7OWQ1aF495I9fz87u9vx8BJh8djvmABwidUWREnd4vwwEIS3M
JtFGn+kCQQCCsvBvOXgVAlcR54/6ro6R42/0F3bZw0ZFVXvgRRjCZW6m4FyHq4AL
+gfAV0HERkMdlO1zBpBwkSURekDc9NvlAkAA3zj6k9jlZoLbR50u1fHy4wFdzUw0
eCQ5nNrsoNbkHOJQGb7dtmmSc9lNUBsqAp53hi0MX2xy0UWN2e1DKkaZAkBi9stH
7OQYRGVZkVVcI8Cghu7GjN3ZlhsndMsPzkIpMFTQ1yI5OIsEhpZH9co+rFU1mQcT
Ce1kzwKacU+b/2xhAkEAovqzUMFB9YEbc8C9AzTej5F2ttyuKBDJJ+kvQeJP+PnW
4ovFI4Ee5UmTWI6k/Md9BM+MvEMWs3nPoF4MULHqNg==
-----END RSA PRIVATE KEY-----'''
]

// https://github.com/jenkinsci/digitalocean-plugin/blob/digitalocean-plugin-0.12/src/main/java/com/dubture/jenkins/digitalocean/SlaveTemplate.java
SlaveTemplate slaveTemplate = new SlaveTemplate(
  slaveTemplateParameters.name,
  slaveTemplateParameters.imageId,
  slaveTemplateParameters.sizeId,
  slaveTemplateParameters.regionId,
  slaveTemplateParameters.username,
  slaveTemplateParameters.workspacePath,
  slaveTemplateParameters.sshPort,
  slaveTemplateParameters.idleTerminationInMinutes,
  slaveTemplateParameters.numExecutors,
  slaveTemplateParameters.labelString,
  slaveTemplateParameters.instanceCap,
  slaveTemplateParameters.userData,
  slaveTemplateParameters.initScript
)

// https://github.com/jenkinsci/digitalocean-plugin/blob/digitalocean-plugin-0.12/src/main/java/com/dubture/jenkins/digitalocean/Cloud.java
Cloud cloud = new Cloud(
  cloudParameters.name,
  cloudParameters.authToken,
  cloudParameters.privateKey,
  cloudParameters.sshKeyId,
  cloudParameters.instanceCap,
  cloudParameters.timeoutMinutes,
  [slaveTemplate]
)

// get Jenkins instance
Jenkins jenkins = Jenkins.getInstance()

// add cloud configuration to Jenkins
jenkins.clouds.add(cloud)

// save current Jenkins state to disk
jenkins.save()
ArchivesGet past versions
Labels
This plugin has no labels