Skip to content

Instantly share code, notes, and snippets.

@guitarmanvt
Created June 18, 2019 18:19
Show Gist options
  • Save guitarmanvt/b06dcce1507386b6638b1a9ccaddc7d9 to your computer and use it in GitHub Desktop.
Save guitarmanvt/b06dcce1507386b6638b1a9ccaddc7d9 to your computer and use it in GitHub Desktop.
Jenkinsfile linter
#!/bin/bash
src="${1:-Jenkinsfile}"
JENKINS_URL="https://jenkins.example.com"
function lint() {
JENKINS_CRUMB=$(curl --user USERNAME:PASSWORD -k "$JENKINS_URL/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)")
curl --user USERNAME:PASSWORD -k -X POST -H $JENKINS_CRUMB -F "jenkinsfile=<${src}" $JENKINS_URL/pipeline-model-converter/validate
}
lint 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment