This gist shows how you can validate Jenkinsfile within Vim :-) but if you don't use Vim, you should be able to use it in a terminal or adapt it to your needs anyway, you can even convert it to a bash function ;-)
It's inspired by the official documentation https://www.jenkins.io/doc/book/pipeline/development/#linter
- Expose your jenkins credentials and instance URLs somehow (environment variables)
JENKINS_URL
JENKINS_USERNAME
JENKINS_SECRET
(password, or user token...)
- Create somewhere (
~/scripts/checkci.sh
?) a script with the proposed content in this gist.- make it executable
chmod +x ~/.scripts/checkci.sh
- create a symbolic link to it. example :
ln -snf ~/.scripts/checkci.sh /usr/local/bin/checkci
- make it executable
- It should be enough to allow you to validate Jenkinsfile via the terminal. example:
checkci
,checkci Jenkinsfile.acceptance
, ...
- Install https://github.com/dense-analysis/ale via the vim plugin manager of your choice, or manually... I suggest you start at https://vimawesome.com/plugin/ale ;)
- Update your
~/.vimrc
with the proposed config - Create
~/.vim/ale_linters/Jenkinsfile/checkci.vim
with the proposed content
hot! i'm curious if this vim plugin works for your use case: https://github.com/burnettk/vim-jenkins. it looks like your vim integration goes a bit deeper by highlighting the lines of code that failed validation. feel free to pull request or submit an issue or point me to an alternate repo if you want to collaborate on this!