public abstract class Cloud extends Actionable implements ExtensionPoint, Describable<Cloud>, AccessControlled
Node
s to dynamically expand/shrink the agents attached to Hudson.
Put another way, this class encapsulates different communication protocols needed to start a new agent programmatically.
Cloud
.
Doing so requires a use of RetentionStrategy
. Instantiate your Slave
subtype with something
like CloudSlaveRetentionStrategy
so that it gets automatically deleted after some idle time.
To do this, have your Slave
subtype remember the necessary handle (such as EC2 instance ID)
as a field. Such fields need to survive the user-initiated re-configuration of Slave
, so you'll need to
expose it in your Slave
configure-entries.jelly
and read it back in through DataBoundConstructor
.
You then implement your own Computer
subtype, override Slave.createComputer()
, and instantiate
your own Computer
subtype with this handle information.
Finally, override Computer.onRemoved()
and use the handle to talk to the "cloud" and de-allocate
the resource (such as shutting down a virtual machine.) Computer
needs to own this handle information
because by the time this happens, a Slave
object is already long gone.
top
or main
view
to be presented at the top of the page or at the bottom respectively. In the middle, actions have their summary
views displayed. Actions further contribute to sidepanel
with box
views. All mentioned views are
optional to preserve backward compatibility.NodeProvisioner
,
AbstractCloudImpl
Modifier and Type | Class and Description |
---|---|
static class |
Cloud.CloudState
Parameter object for
Cloud . |
ExtensionPoint.LegacyInstancesAreScopedToHudson
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem
Modifier and Type | Field and Description |
---|---|
static DescriptorList<Cloud> |
ALL
|
String |
name
Uniquely identifies this
Cloud instance among other instances in Jenkins.clouds . |
static Permission |
PROVISION
Permission constant to control mutation operations on
Cloud . |
Modifier and Type | Method and Description |
---|---|
static DescriptorExtensionList<Cloud,Descriptor<Cloud>> |
all()
Returns all the registered
Cloud descriptors. |
boolean |
canProvision(Cloud.CloudState state)
Returns true if this cloud is capable of provisioning new nodes for the given label.
|
boolean |
canProvision(Label label)
Deprecated.
Use
canProvision(CloudState) instead. |
ACL |
getACL()
Obtains the ACL associated with this object.
|
Descriptor<Cloud> |
getDescriptor()
Gets the descriptor for this instance.
|
String |
getDisplayName() |
String |
getSearchUrl()
Returns the URL of this item relative to the parent
SearchItem . |
String |
getUrl()
Get URL of the cloud.
|
Collection<NodeProvisioner.PlannedNode> |
provision(Cloud.CloudState state,
int excessWorkload)
Provisions new
Node s from this cloud. |
Collection<NodeProvisioner.PlannedNode> |
provision(Label label,
int excessWorkload)
Deprecated.
Use
provision(CloudState, int) instead. |
addAction, addOrReplaceAction, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic, removeAction, removeActions, replaceAction, replaceActions
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2
public final String name
Cloud
instance among other instances in Jenkins.clouds
.
This is expected to be short ID-like string that does not contain any character unsafe as variable name or
URL path token.@Deprecated public static final DescriptorList<Cloud> ALL
Cloud
implementations.public static final Permission PROVISION
Cloud
.
This includes provisioning a new node, as well as removing it.protected Cloud(String name)
public String getDisplayName()
getDisplayName
in interface ModelObject
@NonNull public String getUrl()
@NonNull public String getSearchUrl()
SearchItem
SearchItem
.getSearchUrl
in interface SearchItem
public ACL getACL()
AccessControlled
getACL
in interface AccessControlled
@Deprecated public Collection<NodeProvisioner.PlannedNode> provision(Label label, int excessWorkload)
provision(CloudState, int)
instead.Node
s from this cloud.
NodeProvisioner
performs a trend analysis on the load,
and when it determines that it really needs to bring up
additional nodes, this method is invoked.
The implementation of this method asynchronously starts node provisioning.
label
- The label that indicates what kind of nodes are needed now.
Newly launched node needs to have this label.
Only those Label
s that this instance returned true
from the canProvision(Label)
method will be passed here.
This parameter is null if Hudson needs to provision a new Node
for jobs that don't have any tie to any label.excessWorkload
- Number of total executors needed to meet the current demand.
Always ≥ 1. For example, if this is 3, the implementation
should launch 3 agents with 1 executor each, or 1 agent with
3 executors, etc.NodeProvisioner.PlannedNode
s that represent asynchronous Node
provisioning operations. Can be empty but must not be null.
NodeProvisioner
will be responsible for adding the resulting Node
s
into Hudson via Jenkins.addNode(Node)
, so a Cloud
implementation
just needs to return NodeProvisioner.PlannedNode
s that each contain an object that implements Future
.
When the Future
has completed its work, Future.get()
will be called to obtain the
provisioned Node
object.public Collection<NodeProvisioner.PlannedNode> provision(Cloud.CloudState state, int excessWorkload)
Node
s from this cloud.
NodeProvisioner
performs a trend analysis on the load,
and when it determines that it really needs to bring up
additional nodes, this method is invoked.
The implementation of this method asynchronously starts node provisioning.
state
- the current state.excessWorkload
- Number of total executors needed to meet the current demand.
Always ≥ 1. For example, if this is 3, the implementation
should launch 3 agents with 1 executor each, or 1 agent with
3 executors, etc.NodeProvisioner.PlannedNode
s that represent asynchronous Node
provisioning operations. Can be empty but must not be null.
NodeProvisioner
will be responsible for adding the resulting Node
s
into Hudson via Jenkins.addNode(Node)
, so a Cloud
implementation
just needs to return NodeProvisioner.PlannedNode
s that each contain an object that implements Future
.
When the Future
has completed its work, Future.get()
will be called to obtain the
provisioned Node
object.@Deprecated public boolean canProvision(Label label)
canProvision(CloudState)
instead.public boolean canProvision(Cloud.CloudState state)
public Descriptor<Cloud> getDescriptor()
Describable
Descriptor
is a singleton for every concrete Describable
implementation, so if a.getClass() == b.getClass()
then by default
a.getDescriptor() == b.getDescriptor()
as well.
(In rare cases a single implementation class may be used for instances with distinct descriptors.)
getDescriptor
in interface Describable<Cloud>
public static DescriptorExtensionList<Cloud,Descriptor<Cloud>> all()
Cloud
descriptors.Copyright © 2004–2021. All rights reserved.