4 releases
0.2.2 | Dec 20, 2020 |
---|---|
0.2.1 | Dec 20, 2020 |
0.2.0 | Dec 20, 2020 |
0.1.1 | Dec 20, 2020 |
#12 in #jenkins
34KB
737 lines
Jenkins Declarative Parser
This repository contains an grammar and parser for the link:Jenkins Declarative Pipeline syntax. It's for educational and testing purposes :)
CLI
This repository provides the jdp
command line utility which can be used for syntax
checking a declarative Jenkinsfile
:
[source,bash]
❯ jdp check data/valid/complex-deployment/Jenkinsfile
Checking: data/valid/complex-deployment/Jenkinsfile
Looks valid! Great work!
Installing
You can download built release binaries from the link:GitHub Releases
or* just run cargo install jdp
.
Caveats
This parser is not a Groovy syntax parser, and as such any advanced or wacky
groovy that is littered around a Jenkinsfile
should largely be ignored. This
includes the script
step which is basically checked to make sure that there is
a script { }
block, but anything within it is explicitly ignored.
Development
Development of jdp
is all driven through the use of cargo
, e.g. cargo test
.
It's relatively straightforward to use a local test Jenkins environment to validate
the Jenkinsfile
located in data/
. There is a major caveat in that many files
will fail to validate if certain plugins are not installed on the Jenkins.
Once a local Jenkins is created, be sure to set a fixed sshd port in the
/configureSecurity
view (e.g. 2022
).
[source]
find data/valid -iname Jenkinsfile -exec ./scripts/declarative-linter {} \;
Dependencies
~6–15MB
~177K SLoC