Plugin Information |
---|
View DigitalOcean on the plugin site for more information. |
Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:
Configure plugin via Groovy script
Either automatically upon Jenkins post-initialization or through Jenkins script console, example:
import com.dubture.jenkins.digitalocean.DigitalOceanCloud import com.dubture.jenkins.digitalocean.SlaveTemplate import jenkins.model.Jenkins // parameters def slaveTemplateParameters = [ idleTerminationInMinutes: '10', imageId: 'ubuntu-17-10-x64', initScript: '', installMonitoring: false, instanceCap: '2', labellessJobsAllowed: false, labelString: 'digitalocean.toronto.ubuntu.17.10', name: 'digitalocean.toronto.ubuntu.17.10', numExecutors: '1', regionId: 'tor1', sizeId: '512mb', sshPort: 22, tags: '', userData: '', username: 'root', workspacePath: '/home/jenkins' ] def cloudParameters = [ authToken: '01234567890123456789012345678901234567890123456789', connectionRetryWait: '30', instanceCap: '2', name: 'mycompany', sshKeyId: '01234567', timeoutMinutes: '10', usePrivateNetworking: false, 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.17/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.labellessJobsAllowed, slaveTemplateParameters.instanceCap, slaveTemplateParameters.installMonitoring, slaveTemplateParameters.tags, slaveTemplateParameters.userData, slaveTemplateParameters.initScript ) // https://github.com/jenkinsci/digitalocean-plugin/blob/digitalocean-plugin-0.17/src/main/java/com/dubture/jenkins/digitalocean/DigitalOceanCloud.java DigitalOceanCloud digitalOceanCloud = new DigitalOceanCloud( cloudParameters.name, cloudParameters.authToken, cloudParameters.privateKey, cloudParameters.sshKeyId, cloudParameters.instanceCap, cloudParameters.usePrivateNetworking, cloudParameters.timeoutMinutes, cloudParameters.connectionRetryWait, [slaveTemplate] ) // get Jenkins instance Jenkins jenkins = Jenkins.getInstance() // add cloud configuration to Jenkins jenkins.clouds.add(digitalOceanCloud) // save current Jenkins state to disk jenkins.save()