Package hudson.slaves

Class CloudProvisioningListener

  • All Implemented Interfaces:
    ExtensionPoint

    public abstract class CloudProvisioningListener
    extends Object
    implements ExtensionPoint
    Allows extensions to be notified of events in any Cloud and to prevent provisioning from a Cloud.
    Since:
    1.520
    Author:
    Ryan Campbell
    • Constructor Detail

      • CloudProvisioningListener

        public CloudProvisioningListener()
    • Method Detail

      • canProvision

        @Deprecated
        public CauseOfBlockage canProvision​(Cloud cloud,
                                            Label label,
                                            int numExecutors)
        Deprecated.
        Allows extensions to prevent a cloud from provisioning. Return null to allow provisioning, or non-null to prevent it.
        Parameters:
        cloud - The cloud being provisioned from.
        label - The label which requires additional capacity. IE, the NodeProvisioner.label. May be null if provisioning for unlabeled builds.
        numExecutors - The number of executors needed.
        Returns:
        null if provisioning can proceed, or a CauseOfBlockage reason why it cannot be provisioned.
      • canProvision

        public CauseOfBlockage canProvision​(Cloud cloud,
                                            Cloud.CloudState state,
                                            int numExecutors)
        Allows extensions to prevent a cloud from provisioning. Return null to allow provisioning, or non-null to prevent it.
        Parameters:
        cloud - The cloud being provisioned from.
        state - The current cloud state.
        numExecutors - The number of executors needed.
        Returns:
        null if provisioning can proceed, or a CauseOfBlockage reason why it cannot be provisioned.
      • onStarted

        public void onStarted​(Cloud cloud,
                              Label label,
                              Collection<NodeProvisioner.PlannedNode> plannedNodes)
        Called after a cloud has returned a PlannedNode, but before that node is necessarily ready for connection.
        Parameters:
        cloud - the cloud doing the provisioning
        label - the label which requires additional capacity. IE, the NodeProvisioner.label May be null if provisioning for unlabeled builds.
        plannedNodes - the planned nodes
      • onCommit

        public void onCommit​(@NonNull
                             NodeProvisioner.PlannedNode plannedNode,
                             @NonNull
                             Node node)
        Called when the nodeis fully connected in the Jenkins.
        Parameters:
        plannedNode - the plannedNode which resulted in the node being provisioned
        node - the node which has been provisioned by the cloud
        Since:
        2.37
      • onRollback

        public void onRollback​(@NonNull
                               NodeProvisioner.PlannedNode plannedNode,
                               @NonNull
                               Node node,
                               @NonNull
                               Throwable t)
        Called when Jenkins.addNode(Node) throws an exception.
        Parameters:
        plannedNode - the plannedNode which resulted in the node being provisioned
        node - the node which has been provisioned by the cloud
        t - the exception
        Since:
        2.37