Automation Platform Tasks

Resource Pool—Create a New Pool or Edit Existing Pool

Default resource pool

CloudBees Flow includes a default resource pool, which is created during installation. It initially includes the local resource. The default resource pool’s description is Default resource pool containing local agent created during installation.

Following is the order of precedence that determines how jobs select resources. The order of precedence includes the default resource pool as indicated below:

  1. When a job step is run, it checks if a resource or pool was defined at the step level.

  2. If the resource field at the step level is empty, it checks the resource field at the procedure level.

  3. If the resource field at the procedure level is empty, it checks the resource field at the project level.

  4. If the resource field at the project level is empty, a resource is chosen from the default resource pool.

    If the default resource pool is disabled, the job step will hang until it is re-enabled. If the default resource pool is deleted, renamed, or empty, a NonExistent_Resource error message appears when a job is run, which means that no resource was chosen for the job.

Viewing or editing resource pool details

  • Open the Resource Pools page using one of the following methods:

    • From the Deploy UI: browse to https://<cloudbees-flow-server>/flow/, and then from the main menu, click DevOps Essentials > Resource Pools.

    • From the Automation Platform UI: browse to https://<cloudbees-flow-server>/commander/, and then from the main menu, click Administration > Pools.

  • If you are creating a new resource pool, open the resource pool editor using one of the following methods:

    • From the Deploy UI: click New Resource Pool.

    • From the Automation Platform UI: click Create Resource Pool.

  • If you are editing an existing resource pool, click the resource pool name to open the resource pool editor.

  • Complete or update the fields or menus as follows:

    Field NameDescription

    Pool Name

    Enter a name for the resource pool. This name must be unique within a list of multiple resource pool names and cannot be the same as any resource name.

    Enabled

    Select this check box to enable the resource pool.

    Type

    A resource can be static or dynamic .

    • A static resource is part of your system or network (not in the cloud), such as a server, database, or agent machine.

    • A dynamic resource is a cloud resource that can be provisioned and later spun up on-demand when an application or microservice is deployed.

    Number of resources in the resource pool.

    Resource Template Name

    The name of the resource template to which the resource is applied. Only dynamic resources can be applied to a resource template.

    Auto Delete

    If you select this check box, the pool is deleted when the last resource is deleted or removed.

    • The autoDelete property flag is automatically set to "true" if the pool was created on the Create Resource page, as a side-effect of the resource API calls.

    • By default, resource pools created explicitly on the Create Resource Pool page, have the autoDelete flag set to false—the checkbox is "unchecked".

    Description

    (Optional) Plain text or HTML description for this object. If using HTML, you must surround your text with <html> …​ </html> tags. Allowable HTML tags are <a>, <b>, <br>, <div>, <dl>, <font>, <i>, <li>, <ol>, <p>, <pre>, <span>, <style>, <table>, <tc>, <td>, <th>, <tr>, and <ul>.

    For example, the following HTML:

    <p>
    <span style="font-family: Arial;">
      <i>Note:</i> For more information about the <b>abc</b> object, see
             <a href="https://www.google.com/">\https://www.google.com</a>.
    </span>
    </p>

    renders as follows:

    _Note:_ For more information about the *abc* object, see \https://www.google.com.

    Actions

    Actions you can perform on the resource pool, including:

    • Copy —Creates a new resource by copying the this resource pool.

    • Delete —Deletes this resource pool.

    • Tear Down —Removes (decommissions) the dynamic resource pool from a dynamic environment.

    • Track Changes —Opens the Change History for the resource pool.

  • Click OK to save your changes.

Resource pools cannot be nested, which means if the name of a resource pool is added to a resource pool, it is ignored.

A resource pool can override the default algorithm by providing a JavaScript fragment in the Ordering. The default algorithm schedules steps on the resource from the pool that has the least number of running steps, as long as that resource is able to run a new step. Provided: * It has not reached its step limit. * It has a valid hostname value. * It is not disabled. * It is not already marked exclusive by another job or step. * It passes permission and license checks. If you provide a JavaScript fragment to override the default ordering, the evaluation result is expected to be an array of resources, in the order they should be considered by the scheduler. Before evaluation, the JavaScript fragment is wrapped as a function, to make it possible to use the return statement in the script.

It is possible to return any resources in the result, not just those grouped in a pool, so this feature enables true dynamic resource selection. Resources are still subject to the "usable" criteria. For details, see Unusable resources .

Examples for the Ordering Filter field:

  • Sort by resource name in descending order:

return resourceList.sort(function(a,b) {return b.resourceName.localeCompare(a.resourceName);});

  • Ignore the default resources and return different resources:

var result = new Array();result[0] = resources["resource1"];result[1] = resources["resource2"];return result;

Unusable resources

Resources, whether in a pool or not, are not considered usable if any of the following are true:

  • The resource does not exist.

  • The resource is disabled.

  • The resource does not have a host name.

  • The agent where the resource is associated is not reachable.

  • The number of steps running on the resource is equal to the resource step limit.

  • The resource is exclusive to a different job using the job exclusiveMode.

  • The resource is exclusive to a step in a different job using the step or call exclusiveMode.

  • The resource is exclusive to a different step in the same job using the call exclusiveMode. and the other step is not an ancestor of the step.

  • The resource is exclusive to a different step in the same job using the step exclusiveMode.

  • The job step does not have execute privileges on the resource.

  • The resource assignment exceeds the license limit (if any).