public class OneShotSlave
extends hudson.model.Slave
implements hudson.slaves.EphemeralNode
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:
Result.NOT_BUILT on launch failure.hudson.model.Slave.JnlpJar, hudson.model.Slave.SlaveDescriptor| Constructor and Description |
|---|
OneShotSlave(String nodeDescription,
String remoteFS,
hudson.slaves.ComputerLauncher launcher,
Charset charset) |
| Modifier and Type | Method and Description |
|---|---|
OneShotSlave |
asNode() |
hudson.model.Computer |
createComputer() |
hudson.Launcher |
createLauncher(hudson.model.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. see https://issues.jenkins-ci.org/browse/JENKINS-35521 |
OneShotComputer |
getComputer() |
String |
getNodeDescription() |
int |
getNumExecutors() |
protected boolean |
hasExecutable() |
void |
setExecutable()
Set executable based on current Executor activity.
|
void |
setExecutable(hudson.model.Run run)
Assign a $
Run to this OneShotSlave. |
equals, getClockDifferenceCallable, getDescriptor, getLabelString, getLauncher, getMode, getNodeName, getNodeProperties, getRemoteFS, getRetentionStrategy, getRootPath, getUserId, getWorkspaceFor, getWorkspaceRoot, hashCode, readResolve, setLabelString, setLauncher, setMode, setNodeDescription, setNodeName, setNodeProperties, setNumExecutors, setRetentionStrategy, setUserId, toStringcanTake, canTake, checkPermission, createPath, getACL, getAssignedLabels, getChannel, getClockDifference, getDisplayName, getFileSystemProvisioner, getLabelCloud, getNodePropertyDescriptors, getSearchUrl, getSelfLabel, hasPermission, isAcceptingTasks, isHoldOffLaunchUntilSave, reconfigure, save, toComputerpublic OneShotSlave(String nodeDescription, String remoteFS, hudson.slaves.ComputerLauncher launcher, @Nullable Charset charset) throws hudson.model.Descriptor.FormException, IOException
hudson.model.Descriptor.FormExceptionIOExceptionpublic String getNodeDescription()
getNodeDescription in class hudson.model.Slavepublic hudson.model.Computer createComputer()
createComputer in class hudson.model.Slavepublic int getNumExecutors()
getNumExecutors in class hudson.model.Slaveprotected boolean hasExecutable()
public OneShotComputer getComputer()
getComputer in class hudson.model.Slavepublic void setExecutable(hudson.model.Run run)
Run to this OneShotSlave. By design, only one Run can be assigned, then slave is shut down.
This method has to be called just as the $Run as been created, typically relying on
RunListener.fireFinalized(Run) event. It run the actual launch of the executor
and collect it's log into the the Run's $BuildListener.
Delaying launch of the executor until the Run is actually started allows to fail the build on launch failure, so we have a strong 1:1 relation between a Run and it's Executor.
public void setExecutable()
public hudson.Launcher createLauncher(hudson.model.TaskListener listener)
createLauncher(TaskListener)
as an event to determine first use of the slave. see https://issues.jenkins-ci.org/browse/JENKINS-35521createLauncher in class hudson.model.Slavepublic OneShotSlave asNode()
asNode in interface hudson.slaves.EphemeralNodeCopyright © 2016. All rights reserved.