A Lean 4 library for building Jenkins pipelines you can trust.
- Build pipelines in Lean. Describe Jenkins declarative pipelines (agents,
stages, steps,
when,post, …) as ordinary Lean data types instead of hand-written Groovy. - Prove things about them. State and prove properties of those pipelines
before they ever run, so whole classes of runtime failures can't happen. For example:
- every stage runs on a real agent (no
agent nonewithout a per-stage agent); - every variable a step uses is declared, exactly once, before it is used;
- deploy stages only run on
main, and only after tests have passed.
- every stage runs on a real agent (no
- Generate Jenkinsfiles. Print a checked pipeline as a valid
Jenkinsfilefrom a Lean program, so the file Jenkins runs is the one that was proved correct.
- Model: the pipeline is plain Lean data, and a printer function turns it into Jenkinsfile text.
- Checked output: only a pipeline bundled with a proof of its properties can be printed.
- Groovy in
scriptblocks: inline Groovy, top-level@Fields and helper functions are described by a small Groovy model, so they can be checked too. A raw Groovy escape hatch stays available for anything the model can't express yet. - Logic at build time: logic that needs a real program can run as a compiled
Lean executable on the build agent, called from the pipeline (via
sh), rather than as generated Groovy.
Proofs cover the model of the pipeline, not what shell scripts, Jenkins plugins, or Groovy itself do at runtime.
Early exploration.