Class DockerTemplate
- java.lang.Object
-
- com.nirima.jenkins.plugins.docker.DockerTemplate
-
- All Implemented Interfaces:
Describable<DockerTemplate>
public class DockerTemplate extends Object implements Describable<DockerTemplate>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DockerTemplate.DescriptorImpl
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_STOP_TIMEOUT
The default timeout in seconds (10s) to wait during container shutdown until it will be forcefully terminated.int
instanceCap
String
remoteFs
-
Constructor Summary
Constructors Constructor Description DockerTemplate()
Deprecated.This gives an empty image name, which isn't valid.DockerTemplate(DockerTemplateBase dockerTemplateBase, DockerComputerConnector connector, String labelString, String instanceCapStr)
DockerTemplate(DockerTemplateBase dockerTemplateBase, DockerComputerConnector connector, String labelString, String remoteFs, String instanceCapStr)
-
Method Summary
-
-
-
Field Detail
-
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:
- Constant Field Values
-
remoteFs
@CheckForNull public String remoteFs
-
instanceCap
public final int instanceCap
-
-
Constructor Detail
-
DockerTemplate
@Deprecated public DockerTemplate()
Deprecated.This gives an empty image name, which isn't valid.Default constructor; give an unusable instance.
-
DockerTemplate
public DockerTemplate(@NonNull DockerTemplateBase dockerTemplateBase, @NonNull DockerComputerConnector connector, String labelString, String remoteFs, String instanceCapStr)
-
DockerTemplate
@DataBoundConstructor public DockerTemplate(@NonNull DockerTemplateBase dockerTemplateBase, @NonNull DockerComputerConnector connector, String labelString, String instanceCapStr)
-
-
Method Detail
-
getImage
public String getImage()
-
getDnsString
public String getDnsString()
-
getDnsSearchString
public String getDnsSearchString()
-
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()
-
getExtraHostsString
public String getExtraHostsString()
-
getSecurityOptsString
public String getSecurityOptsString()
-
getCapabilitiesToAddString
public String getCapabilitiesToAddString()
-
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 theNode
name chosen byfillContainerConfig(CreateContainerCmd)
.- Parameters:
containerConfig
- TheCreateContainerCmd
previously returned byfillContainerConfig(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()
-
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)
-
getShortDescription
public String getShortDescription()
-
getDescriptor
public Descriptor<DockerTemplate> getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<DockerTemplate>
-
provisionNode
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public DockerTransientNode provisionNode(DockerAPI api, TaskListener listener) throws IOException, Descriptor.FormException, InterruptedException
-
-