This extension validates Jenkinsfile by sending them to the Jenkins Pipeline Linter of a Jenkins server.
- Validate declarative Jenkinsfile in Visual Studio Code.
This extension contributes the following settings:
jenkins.pipeline.linter.connector.url
: is the endpoint at which your Jenkins Server expects the POST request, containing your Jenkinsfile which you want to validate. Typically this points to<your_jenkins_server:port>/pipeline-model-converter/validate
.jenkins.pipeline.linter.connector.crumbUrl
: has to be specified if your Jenkins Server has CRSF protection enabled. (eg:https://<your-jenkins-server>:<port>/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)
).jenkins.pipeline.linter.connector.user
: allows you to specify your Jenkins username.jenkins.pipeline.linter.connector.pass
: allows you to specify your Jenkins password.jenkins.pipeline.linter.connector.token
: Jenkins user API token.jenkins.pipeline.linter.onsave
: Controls whether the Jenkinsfile is checked immediately after it is saved (default: false).
Scenario 1: Jenkins does not have API authentication enabled
{
"jenkins.pipeline.linter.connector.url": "https://jenkins.shan333.cn/pipeline-model-converter/validate",
}
Scenario 2: Jenkins has API authentication enabled. Use a password for authentication.
{
"jenkins.pipeline.linter.connector.url": "https://jenkins.shan333.cn/pipeline-model-converter/validate",
"jenkins.pipeline.linter.connector.user": "jenkins_username",
"jenkins.pipeline.linter.connector.pass": "jenkins_password",
"jenkins.pipeline.linter.connector.token": "user_api_token"
}
Scenario 3: Jenkins has API authentication enabled. Use a API token for authentication.
{
"jenkins.pipeline.linter.connector.url": "https://jenkins.shan333.cn/pipeline-model-converter/validate",
"jenkins.pipeline.linter.connector.user": "jenkins_username",
"jenkins.pipeline.linter.connector.token": "user_api_token"
}
Scenario 4: Jenkins has API authentication enabled and CRSF protection enabled.
{
"jenkins.pipeline.linter.connector.url": "https://jenkins.shan333.cn/pipeline-model-converter/validate",
"jenkins.pipeline.linter.connector.user": "jenkins_username",
"jenkins.pipeline.linter.connector.pass": "jenkins_password",
"jenkins.pipeline.linter.connector.token": "user_api_token",
"jenkins.pipeline.linter.connector.crumbUrl": "https://jenkins.shan333.cn/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)"
}
- Publishing Extensions
- Project modified from: https://github.com/4roring/vscode-jenkins-pipeline-linter-connector