Package com.dubture.jenkins.digitalocean
Class SlaveTemplate
java.lang.Object
com.dubture.jenkins.digitalocean.SlaveTemplate
- All Implemented Interfaces:
Describable<SlaveTemplate>
A
SlaveTemplate
represents the configuration values for creating a new agent via a DigitalOcean droplet.
Holds things like Image ID, sizeId and region used for the specific droplet.
The provision(org.jenkinsci.plugins.cloudstats.ProvisioningActivity.Id, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.util.List<com.myjeeva.digitalocean.pojo.Droplet>, java.lang.Boolean)
method
is the main entry point to create a new droplet via the DigitalOcean API when a new agent needs to be provisioned.
- Author:
- robert.gruendler@dubture.com
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionSlaveTemplate
(String name, String imageId, String sizeId, String regionId, String username, String workspacePath, Integer sshPort, Boolean setupPrivateNetworking, String idleTerminationInMinutes, String numExecutors, String labelString, Boolean labellessJobsAllowed, String instanceCap, Boolean installMonitoring, String tags, String userData, String initScript) Data is injected from the global Jenkins configuration via jelly. -
Method Summary
Modifier and TypeMethodDescriptionint
int
getName()
int
int
getTags()
boolean
boolean
isInstanceCapReachedLocal
(String cloudName) boolean
isInstanceCapReachedRemote
(List<com.myjeeva.digitalocean.pojo.Droplet> droplets, String cloudName) boolean
boolean
provision
(org.jenkinsci.plugins.cloudstats.ProvisioningActivity.Id provisioningId, String dropletName, String cloudName, String authToken, String privateKey, Integer sshKeyId, List<com.myjeeva.digitalocean.pojo.Droplet> droplets, Boolean usePrivateNetworking) protected Object
-
Constructor Details
-
SlaveTemplate
@DataBoundConstructor public SlaveTemplate(String name, String imageId, String sizeId, String regionId, String username, String workspacePath, Integer sshPort, Boolean setupPrivateNetworking, String idleTerminationInMinutes, String numExecutors, String labelString, Boolean labellessJobsAllowed, String instanceCap, Boolean installMonitoring, String tags, String userData, String initScript) Data is injected from the global Jenkins configuration via jelly.- Parameters:
name
- image nameimageId
- an image slug e.g. "debian-8-x64", or an integer e.g. of a backup, such as "12345678"sizeId
- the image size e.g. "512mb" or "1gb"regionId
- the region e.g. "nyc1"username
- username to loginworkspacePath
- path to the workspacesshPort
- ssh port to be usedidleTerminationInMinutes
- how long to wait before destroying a agentnumExecutors
- the number of executors that this agent supportslabelString
- the label for this agentlabellessJobsAllowed
- if jobs without a label are allowedinstanceCap
- if the number of created instances is cappedinstallMonitoring
- whether expanded monitoring tool agent should be installedtags
- the droplet tagsuserData
- user data for DigitalOcean to apply when building the agentinitScript
- setup script to configure the agent
-
-
Method Details
-
isInstanceCapReachedLocal
-
isInstanceCapReachedRemote
public boolean isInstanceCapReachedRemote(List<com.myjeeva.digitalocean.pojo.Droplet> droplets, String cloudName) throws com.myjeeva.digitalocean.exception.DigitalOceanException - Throws:
com.myjeeva.digitalocean.exception.DigitalOceanException
-
provision
public Slave provision(org.jenkinsci.plugins.cloudstats.ProvisioningActivity.Id provisioningId, String dropletName, String cloudName, String authToken, String privateKey, Integer sshKeyId, List<com.myjeeva.digitalocean.pojo.Droplet> droplets, Boolean usePrivateNetworking) throws IOException, com.myjeeva.digitalocean.exception.RequestUnsuccessfulException, Descriptor.FormException - Throws:
IOException
com.myjeeva.digitalocean.exception.RequestUnsuccessfulException
Descriptor.FormException
-
getDescriptor
- Specified by:
getDescriptor
in interfaceDescribable<SlaveTemplate>
-
getName
-
getSizeId
-
getRegionId
-
getLabels
-
getLabelString
-
isLabellessJobsAllowed
public boolean isLabellessJobsAllowed() -
getLabelSet
-
getImageId
-
getUsername
-
getWorkspacePath
-
getNumExecutors
public int getNumExecutors() -
getIdleTerminationInMinutes
public int getIdleTerminationInMinutes() -
getInstanceCap
public int getInstanceCap() -
isInstallMonitoring
public boolean isInstallMonitoring() -
getTags
-
getUserData
-
getInitScript
-
getSshPort
public int getSshPort() -
isSetupPrivateNetworking
public boolean isSetupPrivateNetworking() -
readResolve
-