vscode-jenkins-pipeline-linter-connector
vscode-jenkins-pipeline-linter-connector copied to clipboard
Question from a beginner - how to use this tool
I have a Jenkinsfile in SCM that does not compile. When I run "Replay" I am just getting some java stack trace on the screen. I downloaded VS Code just to use this extension. So what are the next steps? Should I navigate to the workspace and edit Jenkinsfile from there? I would like to avoid making 100 consecutive code check-ins just to figure out what is wrong with my Jenkinsfile. I thought I will be able to develop Jenkinsfile in some iterative approach with very quick feedback loop.
You have to open and edit your file with VS Code. You save (!) your changes to the local file. Then you press F1 and call "validate Jenkinsfile".
After that you see the results in a small popup beneath. As example i have some errors:
Don't forget to open your settings.json
in VS Code to set the required parameters like Jenkins-URL, Username and Password.
Thanks a lot. I have already figured this out. I am using exactly the method described above. Beginnings are really frustrating, but now everything is going smoothly.
Your welcome :)
That's true. You have to spend some time but the short description (https://jenkins.io/blog/2018/11/07/Validate-Jenkinsfile/) could be added to the readme.
My personal most common issue is that i forget to save the file before validation. You have to save and then validate. The file on disk is validated via Jenkins, not the file you see (if you have unsaved changes). This may lead to strange errors (or false positives) sometimes.
This extension is magic! Though took me a while and coming here to even know about the whole F1 >Validate. If you update the doco it might be easier for others.
Thanks for the awesome extension.
Agree. For a newcomer to VSCode, it was difficult to find out how to validate the file. It was as simple as pressing F1 but I was not aware. Thanks to @tomeks666 for posting this question and to those who answered. Updating documentation with this info will he helpful for others.
Would be great if there were other ways to trigger this, such as automatically upon saving the Jenkinsfile. Or perhaps with a right click option?