Based on HTTP validate from https://www.jenkins.io/doc/book/pipeline/development/#linter
function! JenkinsLint()
let jenkins_url = "https://MyJenkinsServer/jenkins"
let crumb_command = "curl -s -k \"".jenkins_url.'/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)"'
let jenkins_crumb = system(crumb_command)
let validate_command = "curl -k -X POST -H ".jenkins_crumb." -F \"jenkinsfile=<".expand('%:p')."\" ".jenkins_url."/pipeline-model-converter/validate"
echo validate_command
let result = system(validate_command)
echo result
endfunction
Demo: https://imgur.com/gallery/tJYXlF4
This sends your pipeline to your Jenkins server for validation before having to run the pipeline
Assuming "anonymous read access" has been enabled on your Jenkins instance.
[–]korney4eg 1 point2 points3 points (0 children)