Package it.dockins.dockerslaves.api
Class OneShotSlave
java.lang.Object
hudson.model.AbstractModelObject
hudson.model.Node
hudson.model.Slave
it.dockins.dockerslaves.api.OneShotSlave
- All Implemented Interfaces:
ExtensionPoint,Describable<Node>,ModelObject,PersistenceRoot,ReconfigurableDescribable<Node>,Saveable,SearchableModelObject,SearchItem,AccessControlled,EphemeralNode,Serializable,OnMaster
- Direct Known Subclasses:
DockerSlave
A slave that is designed to be used only once, for a specific $
Run, and as such has a life cycle
to fully match the Run's one.
Provisioning such a slave should be a lightweight process, so one can provision them at any time and concurrently
to match $Queue load. Typical usage is Docker container based Jenkins agents.
Actual launch of the Slave is postponed until a $Run is created, so we can have a 1:1 match between Run and
Executor lifecycle:
- dump the launch log in build log.
- mark the build as $
Result.NOT_BUILTon launch failure. - shut down and remove the Executor on build completion
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.model.Slave
Slave.JnlpJar, Slave.SlaveDescriptorNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RunListenerWe listen to loggers creation by $Runs so we can write the executor's launch log into build log.Fields inherited from class hudson.model.Node
holdOffLaunchUntilSave, SKIP_BUILD_CHECK_ON_FLYWEIGHTS -
Constructor Summary
ConstructorsConstructorDescriptionOneShotSlave(String name, String nodeDescription, String remoteFS, String labelString, ComputerLauncher launcher) -
Method Summary
Modifier and TypeMethodDescriptioncreateLauncher(TaskListener listener) Pipeline does not use the same mechanism to use nodes, so we also need to consider $createLauncher(TaskListener)as an event to determine first use of the slave.intMethods inherited from class hudson.model.Slave
createComputer, drainLabelsToTrim, equals, getClockDifferenceCallable, getDescriptor, getLabelAtomSet, getLabelString, getLauncher, getMode, getNodeDescription, getNodeName, getNodeProperties, getRemoteFS, getRetentionStrategy, getRootPath, getUserId, getWorkspaceFor, getWorkspaceRoot, hashCode, readResolve, save, setLabelString, setLauncher, setMode, setNodeDescription, setNodeName, setNodeProperties, setNumExecutors, setRetentionStrategy, setUserId, toStringMethods inherited from class hudson.model.Node
canTake, canTake, createPath, getACL, getAssignedLabels, getChannel, getClockDifference, getConfigFile, getDisplayName, getFileSystemProvisioner, getLabelCloud, getNodeProperty, getNodeProperty, getNodePropertyDescriptors, getRootDir, getSearchUrl, getSelfLabel, getTemporaryOfflineCause, isAcceptingTasks, isHoldOffLaunchUntilSave, onLoad, reconfigure, reconfigure, setTemporaryOfflineCause, toComputerMethods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendErrorMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2Methods inherited from interface hudson.slaves.EphemeralNode
asNodeMethods inherited from interface hudson.search.SearchItem
getSearchGroup, getSearchIcon
-
Field Details
-
RUN_LISTENER
We listen to loggers creation by $Runs so we can write the executor's launch log into build log. Relying on this implementation detail is fragile, but we don't really have a better option yet.
-
-
Constructor Details
-
OneShotSlave
public OneShotSlave(String name, String nodeDescription, String remoteFS, String labelString, ComputerLauncher launcher) throws Descriptor.FormException, IOException - Throws:
Descriptor.FormExceptionIOException
-
-
Method Details
-
getNumExecutors
public int getNumExecutors()- Overrides:
getNumExecutorsin classSlave
-
getComputer
- Overrides:
getComputerin classSlave
-
createLauncher
Pipeline does not use the same mechanism to use nodes, so we also need to consider $createLauncher(TaskListener)as an event to determine first use of the slave.- Overrides:
createLauncherin classSlave
-