vscode-jenkins-pipeline-linter-connector icon indicating copy to clipboard operation
vscode-jenkins-pipeline-linter-connector copied to clipboard

Question from a beginner - how to use this tool

Open tomeks666 opened this issue 5 years ago • 6 comments

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.

tomeks666 avatar Oct 23 '19 11:10 tomeks666

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.

mbedded avatar Jan 22 '20 09:01 mbedded

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.

tomeks666 avatar Jan 22 '20 09:01 tomeks666

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.

mbedded avatar Jan 22 '20 20:01 mbedded

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.

Bonn93 avatar Apr 02 '20 09:04 Bonn93

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.

niajthat avatar Dec 02 '20 18:12 niajthat

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?

robross0606 avatar May 06 '21 21:05 robross0606