Step model
Built: a job is a list of steps. A step has one command or in-process function, the artefacts it reads, inputs, prechecks, services with named ports and inputs and outputs of their own, outputs that may be marked debug, a timeout, accepted exit codes, pass and fail patterns, a parse function, a judge given the parsed results, and run_after_fail. A step with child steps is a cache unit, cached as a whole and resumed after an interrupt, whose children run side by side and can be units themselves, or a composite step, whose children are cached each by itself. A step holds threads, memory, disk space and licences from resource pools, and with resources.enforce its memory, threads and disk are enforced, with a systemd slice or a cgroup doris makes itself. With resources.pin each step runs on CPUs of its own. Working directories are cleaned by how a step ended, and doris clean removes those that were kept. See Steps and execution.
This page is what the step model still lacks, and what is built but not yet used by any flow.
What is left
| Part | Built | Left |
|---|---|---|
| Child steps | Cache units and composite steps | Normalised exports |
| Resources | Resource pools, enforced with systemd or cgroups, pinned to CPUs | Enforcement on a remote machine, and stricter limits |
| Flows that use these | TestRIG and lint read artefacts. TestRIG declares prechecks, a debug output, a pass pattern, service outputs and run_after_fail. Lint has a parse function and a judge on its results | A flow with a cache unit, a composite step, a fail pattern, and more |
Normalised exports
Downstream keys use the content of a step’s outputs. That only saves reruns if a rerun gives the same bytes, so what a cache unit exports should have no timestamps or absolute paths in it, or be a summary of a log rather than the log. Nothing in doris does this for a unit: it is up to each child, and there is no child that does. Lint’s parse function names each file from the job’s directory, so its messages.json is the same in every checkout, but lint is a step, not a unit: it is quick to run again and has nothing to resume.
A helper that strips the usual timestamps and the repo’s and job’s paths from a text file would let a unit’s last child normalise any log it exports.
Enforcing resources
Enforcement works with a systemd user manager, or with a cgroup v2 hierarchy delegated to doris, as in a container. Each step’s threads can be pinned to CPUs of its own. What is left:
- Enforcement on a remote machine, by a remote executor (see Scheduling and remote execution).
- A disk quota the kernel keeps. doris measures a step’s working directory while it runs and stops it once it is over, so a step can go over by what it writes between two measurements, and what it writes outside its directory is not counted. A filesystem’s project quotas, such as XFS’s, would stop the write itself, but need a filesystem set up for them and root to set them.
- Pinning a step’s processes for good. A step is pinned with its processes’ CPU affinity, which a process can change for itself. The
cpusetcontroller’scpuset.cpus, or systemd’sAllowedCPUs, would hold it, but a user systemd manager does not usually have that controller delegated.
No flow uses these yet
These parts of the step model are built and have unit tests. What is not built is a flow that uses them:
- Cache units, for synthesis.
- Composite steps.
- Fail patterns, for checking more of a TestRIG run.
Versionprechecks, and aCommandprecheck other than enforcement’s.- A service ready by a file or a line of its log, one that is waited for and not stopped, one with more than one port, and one with an input.
Invocation::shell,Step::afterandStep::hold.
Initialisation and teardown
The proposal is to leave these out. Setup that produces something is an upstream step. Something that must run during the step is a service. Clean-up is generic. They can be added if a real case doesn’t fit those three.