Skip to main content
A test usually identifies the box that it uses, for example --box BENCH-3. With lager lease, a test requests a box from a pool instead. A pool is a named set of requirements, for example “an nRF52840 board and a debug probe”. A lease server finds a box that agrees with the requirements, is online, and is not in use. Lager then runs your command on that box and releases the box when the command stops. The lease server is not part of Lager. Lager sends the pool name and gets one box. The server keeps the pools and the record of each lease.

Syntax

The -- separates the lager lease options from your command. lager lease does not read the text after --.

Options

How it operates

  1. Lager asks the lease server for a box from the pool.
  2. The server locks one box for the lease, and sends the box address to Lager.
  3. Lager runs COMMAND with these environment variables:
  4. While COMMAND runs, Lager renews the lease at the interval that the server sets.
  5. When COMMAND stops, Lager releases the box. This also occurs when COMMAND fails and when you push Ctrl-C.
Every lager command in COMMAND uses LAGER_BOX and LAGER_LOCK_HOLDER. Thus, each command uses the leased box, and each command sees the lock of the lease as its own lock. See Box Locking.
Do not use --box in COMMAND. --box overrides LAGER_BOX. The command then uses a different box, and the leased box stays unused until the command stops.

Examples

Run one script on a leased box:
Run more than one command on the same box. The lease holds the box until the shell stops:
Run a test in a GitHub Actions job:

Server and credentials

Lager finds the lease server in this sequence:
  1. The --server option.
  2. The STOUT_URL environment variable.
  3. The server of your lager login session, if you have exactly one session.
For the credential, Lager uses the STOUT_TOKEN environment variable if it is set. If not, Lager uses your lager login session. See Signing In. Use a token in CI, because a CI job cannot sign in.

Exit status

Status 75 is different from a test failure. Thus, your CI can show “no box available” separately from “test failed”.

Problems