On this page
jenkins-lint#
Catch Jenkinsfile mistakes and security problems before they reach your CI.
jenkins-lint checks Jenkinsfiles and shared library files offline, in
milliseconds, with no Jenkins, Docker or JVM: Groovy syntax and Declarative
Pipeline structure, with the wording of Jenkins's own validator, and security
problems such as secrets and pull request titles interpolated into shell
steps, with fixes. --remote also validates the files with your Jenkins,
which knows its plugins. It is one small binary, for pre-commit, CI and the
command line.
Note
Formerly jenkinsfilelint: see Migrating to 2.0.
Quick Start#
pip install jenkins-lint
jenkins-lint Jenkinsfile # syntax, Declarative structure and security
jenkins-lint . # every Jenkinsfile and shared library file here
That works as is: files are checked offline, and --remote also checks them
with your own Jenkins. Then add the pre-commit hook (see Pre-commit hook) or keep
using the CLI.
Security rules#
| Rule | Severity | Confidence | Persona | Fix | |
|---|---|---|---|---|---|
| script-injectionA pull request title, branch name, webhook payload or build parameter interpolated by Groovy into a shell step | high, medium | high | regular | ⚠ | |
| secret-interpolationA secret interpolated by Groovy into a shell step | high | high | regular | ⚠ | |
controller-executionSteps that run on the Jenkins controller: agent { label 'built-in' }, node('master') | high | high, medium | regular | ❌ | |
unpinned-libraryA shared library loaded from a branch: @Library('lib@main') _ | medium | medium | regular | ❌ | |
unpinned-imageA container image without a tag, with latest, or without a digest | medium, low | high | regular, pedantic | ❌ | |
unrestricted-inputAn input without submitter, which any user may approve (pedantic) | medium | high | pedantic | ❌ |
Demo#
