Step failures and retries
A configuration step, such as a package, a script or a code source, can fail. You decide whether that blocks the workstation, and how often the step is tried again.
A configuration step, such as a package, a script or a code source, can fail. You decide whether that blocks the workstation, and how often the step is tried again. A step that installs your team’s toolchain should block the workstation when it fails. A step that adds your own shell preferences usually shouldn’t.
Fatal and optional steps
Ringleader applies a workstation’s configuration in a pass, running each step in order. A
fatal step blocks the workstation when it fails: the workstation’s Configured
condition is
False, so the workstation isn’t Available. An optional step doesn’t block when it
fails. The workstation stays Configured, and its status.nonFatalConfig names the
failing step until it recovers.
These kinds of step take a fatal setting: scripts, sources, packages, devtools,
files, services and dotfilesRepo. Most are fatal by default. dotfilesRepo is
optional by default, and so is every step of these kinds that a
personal layer
contributes. A personal Integration’s endpoint file is optional too.
Step failure policy
lists the default for each kind.
Some steps take no fatal setting, because Ringleader merges their entries from every
layer into one step:
- The
dotfilesmap never blocks the workstation. environment,sysctls,hostname,timezone,localeandlimitsalways block it, even when a personal layer adds them.- The refresh of the package index that comes before installing packages always blocks it, even when the package that needs it is optional.
Retries after a failed step
A fatal step that fails also fails the pass, and the next pass comes quickly, so the workstation’s own retry schedule tries it again.
A step can also try again inside one pass, before the pass moves on. Its retries setting
is the number of extra attempts, from 0 to 5. With no retries, an optional step gets 2
and a fatal step gets 0. The extra attempts fix a failure that lasts only a moment, such as
a clone at boot, without waiting for the next run.
Scripts that stop the pass
A script’s failOnError setting stops the rest of the pass when the script fails: the
scripts and services after it don’t run. failOnError and fatal are independent, and both
apply.
Make a step optional
To stop a step from blocking the workstation when it fails, set fatal: false on its
entry.
spec:
sources:
- name: notes
path: /home/dev/notes
fatal: false
git:
url: https://github.com/me/notes.gitThe workstation then reaches Configured even while the clone fails.
Retry a step that fails now and then
To give a step more attempts inside one pass, set retries on its entry, up to 5:
spec:
scripts:
- name: fetch-fixtures
retries: 3
content: |
curl -fsSL https://example.com/fixtures.tar.gz | tar -xz -C /srvFind the step that failed
When a workstation isn’t Configured, run rl troubleshoot with the workstation’s name:
rl troubleshoot my-box -n localIt names the failing step and shows its output. The workstation’s status.configState
also names the step and a cause, such as disk-full or network-unreachable.
Fields that report a problem
lists every cause and what to do about it. For an optional step that is failing,
rl workstation describe lists the failure under Optional configuration.
Next steps
- Configuration merging and resolution shows the configuration a workstation is set up to match.
- The reference’s
Step failure policy
lists the
fatalandretriesfields and their defaults.