Develop groovy scripts for jenkins in vscode or intellij - jenkins

Is it possible to connect to jenkins instance to get the available libraries (including the ones from plugins) for locally developing groovy scripts with code completion in intellij or vscode?

It is not possible to have the same library as that of Jenkins instance to compile groovy inside these IDE'S.
Instead you need to have Groovy SDK installed and configured for each of there IDEs separately. (IntelliJ is simple to configure while VS Code usages .json file for all configuration). Once you have the Groovy SDK lib configured, within IDE project you can compile and run the sample .groovy (And or .gdsl) script (without any jenkins plugin).
If you are trying to trigger .jenkinsfile then, you need to change configuration in IDE to treat .jenkinsfile equal to .groovy file see below screenshot.
While it is possible to configure your Jenkins instance into IDE and also to control (Run, cancel and re-run) the jobs directly remotely in runtime from IntelliJ or from VS Code.
For this you can use;
Jenkins-Control-Plugin - IntelliJ IDEA
To Configure Jenkins instance is very simple.
see the Link here
Jenkins Jack(many other plugins are available but this is most popular) - VS Code.
I Struggled a bit to configure the Jenkins Jack but with this you can compile the Groovy and trigger it remotely.
see the link JenkinsJack
Jenkins Runner - VS Code
This is same as that of Jenkins Control Plugin mentioned in point 1.
My favorite is VS code with Jenkins Jack simple and effective.

Related

What is the difference between running jenkins with .war file and using installer?

I would like to know what are the difference between using Jenkins on terminal with .war file vs using installer. And which is better?
Always use the installer if you can. My main experience is with Linux but I’m pretty sure this applies to Windows as well:
The installer will automatically pull in any dependencies that Jenkins needs in order to run
You can easily upgrade Jenkins and its dependencies by installing a new version of the package
It will set up Jenkins as a service that will restart automatically if the server reboots
It provides a script to set parameters such as the JVM memory allocation and the port number that Jenkins runs on - if you use the JAR file you’d have to write a script yourself.

Jenkins Packaging a exe and dll's to msi

I'm new to using jenkins.I am working on C# project and using jenkins for continuous build and release. I completed creating builds for my project and got the .exe and dll files. But i need to repackage it(create a msi) before deploying to servers. So can anyone give a stepwise information for rePackaging and tool to be used with jenkins for packaging. I want to automate this process in jenkins CI AND CD.
Repackaging implies you have a third party installer that you want to reverse engineer into a new/better MSI. You are just packaging not repackaging.
This is a two part question:
Author an MSI. I recommend using WiX and IsWiX starting with this tutorial.
Build it using Jenkins. WiX supports MSBuild and Jenkins has a MSBuild PlugIn. Standard stuff except not that the .WIXPROJ created by IsWiX templates expects you to pass the MSBuild Property MSIProductVersion. The correct format for this property is 0-255.0-255.0-65535. You can tack on a fourth field if you would like but it will be ignored. The IsWiX project templates are set up for Major Upgrades by default so make sure one of these 3 fields is incremeented with each release. ( 1.0.0, 1.0.1, 1.1.0, 1.1.1, 2.0.0 )
This is more of a packaging issue than a Jenkins issue.
Take a look at WIX Toolset. I used it successfully in the past with various projects. Integration with Jenkins should be easy. There are 2 options I'm aware of:
After installing the WIX toolset, add a new WIX project to your Visual Studio solution. Once configured, commit the new project to your source code repository. Then developers can build .MSI packages on their own development workstation. Assuming you use MSBuild in Jenkins to build your C# project, the new project will "just build" and create .MSI package (remember to install WIX on your Jenkins build server). This is the recommended option.
Use WIX's command line utilities to generate MSI in a Jenkins batch step. This is more cumbersome and difficult to debug.

Convert Maven Project to Jenkins

Is it possible to convert Maven Project to Jenkins (I want to convert all the project from Maven to Jenkins)
My organization does not want to use Maven any more. The project has to be completely in Jenkins.
Please let me know the process of converting the project.
Thank you.
As Krishnan said in the comments, Jenkins is not a build tool. Jenkins is a build server that is meant for invoking build tools like Maven. It doesn't replace build tools.
So your question of converting Maven to Jenkins doesn't really make sense, since they are doing different things. However, if you are for some reason unable to use Maven, you have some alternatives. Some I can think of:
Use Gradle
Use Ant (only recommended for simply structured projects with little to no dependencies)
Use command line calls with plain javac like this: How to compile and run a simple java file in jenkins on Windows (not recommended since you have to script everything a build tool does yourself)

How to use a script shell or a jenkins plugin to create or to delete a sonarqube project?

I have many project of Sonarqube, each project correspond to a a version of my software.
At the same moment, I save the last 5 version of my software. I use jenkins for integration continue.
My aims it to delete or to create a sonarqube project by a script or a jenkins plugins
Thank you
Projects are created on their first analysis. If you need to create them before that, you can Provision them via the UI or via web services, which will also let you delete projects: https://sonarqube.com/web_api/api/projects
So your script simply needs to invoke the web services with the proper permissions.

Alternatives for QC

In my project we are using QC to execute our test cases(QTP), moving forward we would be eliminating QC (for cost reasons).
As far as I explored MSBuild & Jenkins, they would be suitable.
But MSBuild will trigger the execution when a new build pushed to the repository. Also it will automatically test on the latest build.
Is there any other CI tool available to execute test cases through QTP?
I will be executing automation once in a release. Also we install our application by manual since it requires lots of configuration.
Take a look at HP Application Automation Tools.
This plugin basically replaces the need for QC, and is developed by HP.
Create a Jenkins job using this plugin on the same Jenkins installation used to build your code, then you can configure your job to run your tests as soon the code is available (e.g. on a nightly basis).
See here for a helpful guide on how to implement a simple Jenkins job using this plugin.
They also host the code on Github, which is very useful if you need to change the behavior of the plugin to suit your needs.

Resources