Skip to content

rackn-test-allocate-machine

create a batch of test run based upon parameters

This task script is designed to allocate a machine from a specified machine pool using the drpcli command-line tool. Here's a step-by-step breakdown of what it does:

  1. Prelude Template: It includes a prelude template, which likely sets up the environment or includes common functions.

  2. Cleanup Previous Workorder: If the parameter rackn/test/workorder-cleanup is set, it destroys the previous work order using drpcli.

  3. Get Machine from Machine Pool:

  4. It counts the number of machines in the specified machine pool that match the given filter.
  5. If no machines are available, it logs a success message and exits.

  6. Allocate Machine:

  7. It attempts to allocate one machine from the pool using drpcli.
  8. If the allocation fails, it retries up to 5 times.
  9. If after 5 retries it still fails, it logs an error message and initiates a new work order template with updated metadata and parameters.

  10. Work Order Template Initialization:

  11. It retrieves the current work order template and updates its metadata and parameters.
  12. It creates a new work order with the updated template.

The script uses various drpcli commands to interact with the RackN Digital Rebar Provision (DRP) API, managing machine pools and work orders.