Class DockerTemplate

java.lang.Object
com.nirima.jenkins.plugins.docker.DockerTemplate
All Implemented Interfaces:
Describable<DockerTemplate>

public class DockerTemplate extends Object implements Describable<DockerTemplate>
  • Field Details

    • DEFAULT_STOP_TIMEOUT

      public static final int DEFAULT_STOP_TIMEOUT
      The default timeout in seconds (10s) to wait during container shutdown until it will be forcefully terminated.
      See Also:
    • remoteFs

      @CheckForNull public String remoteFs
    • instanceCap

      public final int instanceCap
  • Constructor Details

  • Method Details

    • getImage

      public String getImage()
    • getDnsString

      public String getDnsString()
    • getMounts

      @CheckForNull public String[] getMounts()
    • getMountsString

      public String getMountsString()
    • getVolumesFrom

      @Deprecated public String getVolumesFrom()
      Deprecated.
    • getVolumesFrom2

      public String[] getVolumesFrom2()
    • getVolumesFromString

      public String getVolumesFromString()
    • getMacAddress

      @CheckForNull public String getMacAddress()
    • getDisplayName

      public String getDisplayName()
    • getMemoryLimit

      public Integer getMemoryLimit()
    • getMemorySwap

      public Integer getMemorySwap()
    • getCgroupParent

      public String getCgroupParent()
    • getCpus

      public String getCpus()
    • getCpuPeriod

      public Long getCpuPeriod()
    • getCpuQuota

      public Long getCpuQuota()
    • getCpuShares

      public Integer getCpuShares()
    • getShmSize

      public Integer getShmSize()
    • getDockerCommandArray

      public String[] getDockerCommandArray()
    • getPortMappings

      public Iterable<com.github.dockerjava.api.model.PortBinding> getPortMappings()
    • getEnvironmentsString

      public String getEnvironmentsString()
    • getExtraHosts

      @CheckForNull public List<String> getExtraHosts()
    • getExtraHostsString

      public String getExtraHostsString()
    • getSecurityOpts

      @CheckForNull public List<String> getSecurityOpts()
    • getSecurityOptsString

      public String getSecurityOptsString()
    • getCapabilitiesToAdd

      @CheckForNull public List<String> getCapabilitiesToAdd()
    • getCapabilitiesToAddString

      public String getCapabilitiesToAddString()
    • getCapabilitiesToDrop

      @CheckForNull public List<String> getCapabilitiesToDrop()
    • getCapabilitiesToDropString

      public String getCapabilitiesToDropString()
    • getRegistry

      public org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint getRegistry()
    • fillContainerConfig

      public com.github.dockerjava.api.command.CreateContainerCmd fillContainerConfig(com.github.dockerjava.api.command.CreateContainerCmd containerConfig)
    • setNodeNameInContainerConfig

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static void setNodeNameInContainerConfig(com.github.dockerjava.api.command.CreateContainerCmd containerConfig, String nodeName)
    • getNodeNameFromContainerConfig

      @NonNull public static String getNodeNameFromContainerConfig(com.github.dockerjava.api.command.CreateContainerCmd containerConfig)
      Retrieves the Node name chosen by fillContainerConfig(CreateContainerCmd).
      Parameters:
      containerConfig - The CreateContainerCmd previously returned by fillContainerConfig(CreateContainerCmd).
      Returns:
      The name that Node.getNodeName() should return for the node for the container that will be created by this command.
      Throws:
      IllegalStateException - if no label was found.
    • getFullImageId

      public String getFullImageId()
    • getDockerTemplateBase

      public DockerTemplateBase getDockerTemplateBase()
    • isRemoveVolumes

      public boolean isRemoveVolumes()
    • setRemoveVolumes

      @DataBoundSetter public void setRemoveVolumes(boolean removeVolumes)
    • getStopTimeout

      public int getStopTimeout()
    • setStopTimeout

      @DataBoundSetter public void setStopTimeout(int timeout)
    • getLabelString

      @CheckForNull public String getLabelString()
    • setMode

      @DataBoundSetter public void setMode(Node.Mode mode)
    • getMode

      public Node.Mode getMode()
    • getNumExecutors

      public int getNumExecutors()
    • setRetentionStrategy

      @DataBoundSetter public void setRetentionStrategy(DockerOnceRetentionStrategy retentionStrategy)
    • getRetentionStrategy

      public RetentionStrategy getRetentionStrategy()
    • getConnector

      @NonNull public DockerComputerConnector getConnector()
    • getRemoteFs

      @CheckForNull public String getRemoteFs()
    • setRemoteFs

      @DataBoundSetter public void setRemoteFs(String remoteFs)
    • getInstanceCapStr

      public String getInstanceCapStr()
    • getInstanceCap

      public int getInstanceCap()
    • getLabelSet

      @NonNull public Set<LabelAtom> getLabelSet()
    • getPullStrategy

      @NonNull public DockerImagePullStrategy getPullStrategy()
    • setPullStrategy

      @DataBoundSetter public void setPullStrategy(DockerImagePullStrategy pullStrategy)
    • getPullTimeout

      public int getPullTimeout()
    • setPullTimeout

      @DataBoundSetter public void setPullTimeout(int pullTimeout)
    • getNodeProperties

      @CheckForNull public List<? extends NodeProperty<?>> getNodeProperties()
    • setNodeProperties

      @DataBoundSetter public void setNodeProperties(List<? extends NodeProperty<?>> nodeProperties)
    • getDisabled

      public DockerDisabled getDisabled()
    • setDisabled

      @DataBoundSetter public void setDisabled(DockerDisabled disabled)
    • setName

      @DataBoundSetter public void setName(String name)
    • getName

      @NonNull public String getName()
    • readResolve

      protected Object readResolve()
      Initializes data structure that we don't persist.
      Returns:
      this, but populated
    • cloneWithLabel

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public DockerTemplate cloneWithLabel(String label)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getShortDescription

      public String getShortDescription()
    • getDescriptor

      public Descriptor<DockerTemplate> getDescriptor()
      Specified by:
      getDescriptor in interface Describable<DockerTemplate>
    • provisionNode

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public DockerTransientNode provisionNode(DockerAPI api, TaskListener listener) throws IOException, Descriptor.FormException, InterruptedException
      Throws:
      IOException
      Descriptor.FormException
      InterruptedException