On this page
Jenkinsfile Lint#
Catch Jenkinsfile syntax errors before they break your CI.
jenkinsfilelint checks your Declarative Pipeline syntax offline, with no
Jenkins at all, or with your Jenkins's own validator
(/pipeline-model-converter/validate)
when you configure one. It's primarily a pre-commit
hook, but also works as a standalone CLI tool.
đź“– Read the official blog post for the story behind this tool.
Quick Start#
pip install jenkinsfilelint
jenkinsfilelint Jenkinsfile
jenkinsfilelint . # every Jenkinsfile in this directory
jenkinsfilelint --audit . # and look for security problems
That works as is: with no Jenkins server configured, files are checked offline. Then add the pre-commit hook (see Pre-commit hook) or keep using the CLI.
Security audit rules#
| Rule | Severity | Confidence | Persona | |
|---|---|---|---|---|
| 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#
