Class SlaveTemplate

java.lang.Object
com.dubture.jenkins.digitalocean.SlaveTemplate
All Implemented Interfaces:
Describable<SlaveTemplate>

public class SlaveTemplate extends Object implements 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
  • 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 name
      imageId - 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 login
      workspacePath - path to the workspace
      sshPort - ssh port to be used
      idleTerminationInMinutes - how long to wait before destroying a agent
      numExecutors - the number of executors that this agent supports
      labelString - the label for this agent
      labellessJobsAllowed - if jobs without a label are allowed
      instanceCap - if the number of created instances is capped
      installMonitoring - whether expanded monitoring tool agent should be installed
      tags - the droplet tags
      userData - user data for DigitalOcean to apply when building the agent
      initScript - setup script to configure the agent
  • Method Details

    • isInstanceCapReachedLocal

      public boolean isInstanceCapReachedLocal(String cloudName)
    • 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

      public Descriptor<SlaveTemplate> getDescriptor()
      Specified by:
      getDescriptor in interface Describable<SlaveTemplate>
    • getName

      public String getName()
    • getSizeId

      public String getSizeId()
    • getRegionId

      public String getRegionId()
    • getLabels

      public String getLabels()
    • getLabelString

      public String getLabelString()
    • isLabellessJobsAllowed

      public boolean isLabellessJobsAllowed()
    • getLabelSet

      public Set<LabelAtom> getLabelSet()
    • getImageId

      public String getImageId()
    • getUsername

      public String getUsername()
    • getWorkspacePath

      public String getWorkspacePath()
    • getNumExecutors

      public int getNumExecutors()
    • getIdleTerminationInMinutes

      public int getIdleTerminationInMinutes()
    • getInstanceCap

      public int getInstanceCap()
    • isInstallMonitoring

      public boolean isInstallMonitoring()
    • getTags

      public String getTags()
    • getUserData

      public String getUserData()
    • getInitScript

      public String getInitScript()
    • getSshPort

      public int getSshPort()
    • isSetupPrivateNetworking

      public boolean isSetupPrivateNetworking()
    • readResolve

      protected Object readResolve()