Create or edit resource pools

4 minute readAutomation

Default resource pool

CloudBees CD/RO includes a default resource pool, that 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.

Create or edit a resource pool

  1. Navigate to DevOps Essentials  Resource pools.

    • To create a new resource pool, select the Add resource pool button and then do one of the following:

      • Select Create New… for a new resource pool screen.

      • Select Copy Existing… to copy an existing resource pool and then select the desired resource pool from the list provided.

        add resource pool type
        Figure 1. Add a resource pool type
    • To edit an existing resource pool, do one of the following:

      • Select the resource pool name to open the resource pool pop-up screen.

      • Select the Actions menu 3 dot icon and then Details option of the desired resource pool.

  2. Complete or update the fields or menus as follows:

    Field Name Description

    Name

    Enter a name for the resource pool. This name must be unique within a list of multiple resource pool names and cannot match another resource name.

    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:

      <i>Note</i>: For more information about the <b>abc</b> object, see https://www.google.com.

    Ordering Filter

    The designated Javascript ordering filter or empty if no filter is applied. For more information, refer to the Resource pools ordering filter section.

    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".

    Enabled

    Select this check box to enable the resource pool.

    Tags

    This binds a group of related objects by a user-defined term. Select Manage tags to the right to tag this object, modify, or delete a tag.

  3. Select 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.

Resource pools ordering filter

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.

  • Has a valid hostname value.

  • Is not disabled.

  • Is not already marked exclusive by another job or step.

  • 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, refer to the Unusable resources section.

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).