Class DockerCloud
java.lang.Object
hudson.model.AbstractModelObject
hudson.model.Actionable
hudson.slaves.Cloud
com.nirima.jenkins.plugins.docker.DockerCloud
- All Implemented Interfaces:
- ExtensionPoint,- Describable<Cloud>,- ModelObject,- SearchableModelObject,- SearchItem,- AccessControlled,- ModelObjectWithContextMenu
Docker Cloud configuration. Contains connection configuration,
 
DockerTemplate contains configuration for running docker image.- Author:
- magnayn
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class hudson.slaves.CloudCloud.CloudStateNested classes/interfaces inherited from interface hudson.ExtensionPointExtensionPoint.LegacyInstancesAreScopedToHudsonNested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenuModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionDockerCloud(String name, DockerCloud source) DockerCloud(String name, DockerAPI dockerApi, List<DockerTemplate> templates) DockerCloud(String name, List<DockerTemplate> templates, String serverUrl, int containerCap, int connectTimeout, int readTimeout, String credentialsId, String version, String dockerHostname) Deprecated.DockerCloud(String name, List<DockerTemplate> templates, String serverUrl, String containerCapStr, int connectTimeout, int readTimeout, String credentialsId, String version, String dockerHostname) Deprecated.DockerCloud(String name, List<DockerTemplate> templates, org.jenkinsci.plugins.docker.commons.credentials.DockerServerEndpoint dockerHost, int containerCap, int connectTimeout, int readTimeout, String version, String dockerHostname) Deprecated.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddJobTemplate(long jobId, DockerTemplate template) Adds a template which is temporary provided and bound to a specific job.voidAdd a new template to the cloudbooleancanProvision(Label label) intcountContainersInDocker(String imageName) Counts the number of instances currently running in Docker that are using the specified image.intcountContainersInProgress(DockerTemplate template) booleanstatic com.github.dockerjava.api.model.AuthConfiggetAuthConfig(org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint registry, ItemGroup context) com.github.dockerjava.api.DockerClientDeprecated.static DockerCloudgetCloudByName(String name) intDeprecated.intDeprecated.org.jenkinsci.plugins.docker.commons.credentials.DockerServerEndpointDeprecated.Deprecated.Deprecated.getTemplate(Label label) Gets firstDockerTemplatethat has the matchingLabel.getTemplate(String template) getTemplates(Label label) Multiple amis can have the same label.inthashCode()static List<DockerCloud>booleanbooleanisTriton()protected ObjectvoidremoveJobTemplate(long jobId) Removes a template which is bound to a specific job.voidRemove Docker templatestatic StringrunContainer(DockerTemplateBase dockerTemplateBase, com.github.dockerjava.api.DockerClient dockerClient) protected StringsanitizeUrl(String url) voidsetContainerCap(int containerCap) voidsetDisabled(DockerDisabled disabled) voidsetErrorDuration(Integer errorDuration) voidsetExposeDockerHost(boolean exposeDockerHost) static voidsetRegistryAuthentication(com.github.dockerjava.api.command.PullImageCmd cmd, org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint registry, ItemGroup context) static voidsetRegistryAuthentication(com.github.dockerjava.api.command.PushImageCmd cmd, org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint registry, ItemGroup context) toString()Methods inherited from class hudson.slaves.Cloudall, canProvision, doConfigSubmit, doDoDelete, getACL, getDescriptor, getDisplayName, getIcon, getIconAltText, getIconClassName, getSearchUrl, getUrl, provision, reconfigure, reconfigure, registerPermissionsMethods inherited from class hudson.model.ActionableaddAction, addOrReplaceAction, doContextMenu, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic, getDynamic, removeAction, removeActions, replaceAction, replaceActionsMethods inherited from class hudson.model.AbstractModelObjectgetSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendErrorMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface hudson.security.AccessControlledcheckAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2
- 
Field Details- 
credentialsIdDeprecated.
 
- 
- 
Constructor Details- 
DockerCloud@DataBoundConstructor public DockerCloud(String name, DockerAPI dockerApi, List<DockerTemplate> templates) 
- 
DockerCloud
- 
DockerCloud@Deprecated public DockerCloud(String name, List<DockerTemplate> templates, org.jenkinsci.plugins.docker.commons.credentials.DockerServerEndpoint dockerHost, int containerCap, int connectTimeout, int readTimeout, String version, String dockerHostname) Deprecated.
- 
DockerCloud@Deprecated public DockerCloud(String name, List<DockerTemplate> templates, String serverUrl, int containerCap, int connectTimeout, int readTimeout, String credentialsId, String version, String dockerHostname) Deprecated.
- 
DockerCloud@Deprecated public DockerCloud(String name, List<DockerTemplate> templates, String serverUrl, String containerCapStr, int connectTimeout, int readTimeout, String credentialsId, String version, String dockerHostname) Deprecated.
 
- 
- 
Method Details- 
getDockerApi
- 
getConnectTimeoutDeprecated.
- 
getDockerHost@Deprecated public org.jenkinsci.plugins.docker.commons.credentials.DockerServerEndpoint getDockerHost()Deprecated.
- 
getServerUrlDeprecated.
- 
getDockerHostnameDeprecated.
- 
getContainerCapStrDeprecated.- Returns:
- getContainerCap()as a- String.
 
- 
getContainerCappublic int getContainerCap()
- 
setContainerCap@DataBoundSetter public void setContainerCap(int containerCap) 
- 
sanitizeUrl
- 
getClientDeprecated.UsegetDockerApi()and thenDockerAPI.getClient()to get the client, followed by a call toDockerClient.close().Connects to Docker. NOTE: This should not be used for any long-running operations as the client it returns is not protected from closure.- Returns:
- Docker client.
 
- 
countContainersInProgress@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public int countContainersInProgress(DockerTemplate template) 
- 
provisionpublic Collection<NodeProvisioner.PlannedNode> provision(Label label, int numberOfExecutorsRequired) 
- 
runContainerpublic static String runContainer(DockerTemplateBase dockerTemplateBase, com.github.dockerjava.api.DockerClient dockerClient) 
- 
canProvision- Overrides:
- canProvisionin class- Cloud
 
- 
getTemplate
- 
getTemplateGets firstDockerTemplatethat has the matchingLabel.- Parameters:
- label- The label we're looking to match.
- Returns:
- The first DockerTemplatethat has the matchingLabel, or null if not found.
 
- 
addTemplateAdd a new template to the cloud- Parameters:
- t- The template to be added.
 
- 
addJobTemplateAdds a template which is temporary provided and bound to a specific job.- Parameters:
- jobId- Unique id (per master) of the job to which the template is bound.
- template- The template to bound to a specific job.
 
- 
removeJobTemplatepublic void removeJobTemplate(long jobId) Removes a template which is bound to a specific job.- Parameters:
- jobId- Id of the job.
 
- 
getTemplates
- 
getTemplatesMultiple amis can have the same label.- Parameters:
- label- The label to be matched, or null if no label was provided.
- Returns:
- Templates matched to requested label assuming agent Mode
 
- 
removeTemplateRemove Docker template- Parameters:
- t- The template to be removed.
 
- 
countContainersInDockerCounts the number of instances currently running in Docker that are using the specified image.WARNING: This method can be slow so it should be called sparingly. - Parameters:
- imageName- If null, then all instances belonging to this Jenkins instance are counted. Otherwise, only those started with the specified image are counted.
- Returns:
- The number of containers.
- Throws:
- Exception- if anything went wrong.
 
- 
getCloudByName
- 
readResolve
- 
toString
- 
hashCodepublic int hashCode()
- 
equals
- 
isTritonpublic boolean isTriton()
- 
isExposeDockerHostpublic boolean isExposeDockerHost()
- 
setExposeDockerHost@DataBoundSetter public void setExposeDockerHost(boolean exposeDockerHost) 
- 
getDisabled
- 
setDisabled
- 
getErrorDuration
- 
setErrorDuration
- 
instances
- 
setRegistryAuthentication@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static void setRegistryAuthentication(com.github.dockerjava.api.command.PullImageCmd cmd, org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint registry, ItemGroup context) 
- 
setRegistryAuthentication@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static void setRegistryAuthentication(com.github.dockerjava.api.command.PushImageCmd cmd, org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint registry, ItemGroup context) 
- 
getAuthConfig@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static com.github.dockerjava.api.model.AuthConfig getAuthConfig(org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint registry, ItemGroup context) 
 
- 
getDockerApi()and thenDockerAPI.getClient()to get the client, followed by a call toDockerClient.close().