janjoerke / vscode-jenkins-pipeline-linter-connector

MIT License
60 stars 21 forks source link

Question from a beginner - how to use this tool #16

Open tomeks666 opened 4 years ago

tomeks666 commented 4 years ago

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.

mbedded commented 4 years ago

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". image

After that you see the results in a small popup beneath. As example i have some errors: image

Don't forget to open your settings.json in VS Code to set the required parameters like Jenkins-URL, Username and Password.

tomeks666 commented 4 years ago

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.

mbedded commented 4 years ago

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.

Bonn93 commented 4 years ago

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.

niajthat commented 3 years ago

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.

robross0606 commented 3 years ago

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?