Thursday 31 August 2017

Easy Way To Add Node To Jenkins

The method explained below probably the easiest way of adding the Node to the Jenkins, at-least I found it very straight forward and simple to understand.

So let's begin adding the Nodes to the Jenkins


Add Node To Jenkins



  1. Open Jenkins, Navigate to Manage Jenkins ⥤ Configure Global Security, Select "Random" for "TCP port for JNLP agents", Save the changes. This is required as we are going to connect and Launch the node using "Launch Java via Java Web Start". Now, this is one-time Configuration and needed only if there is no Node attached to your Jenkins before. No need to do this step if you have already a Node connected using "Launch Java via Java Web Start" method.
  2. Navigate to Manage Jenkins ⥤ Manage Node, click Manage Node. You can see the Master Node added by default to the Jenkins, The execution happens on the Master Node if there is no Node added to the Jenkins. Click "New Node" link on the left-hand side.
  3. Enter the Node name (Actual name of the VM ), select "Permanent Agent" and Click ok.
  4. Keeps all the values default and click Save. You can observe value selected for Launch Method on this page. "Launch Agent via Java Web Start", Will be seen only if you Selected Random for "TCP port for JNLP agents" on Configure Global Security page.
  5. Once new node is added it will appear offline as shown below. 
  6. Click on the Node now. Node Page will be opened. Now there are 2 ways to connect the Node to the Jenkins. 1. Launch agent from browser and 2. Run from agent command Line. I would suggest taking the 2nd option.
  7. For running the agent from the command line you need to download the "slave.jar". If you observe carefully on your page there is a slave.jar link provided in the command written. Click that and it will download the jar for you.
  8. Now login to your remote machine that you have added as a Node to the Jenkins, Create a folder "NodeLauncher" in your C Drive. Copy the Slave.jar that you have downloaded to this folder.
  9. In the folder right click and create a new Text Document, Now copy the below command from you Jenkins Node page: 
  10. Paste it into the new text document created, and add one more line mentioned below to this document. "netsh advfirewall firewall set rule group="remote desktop" new enable=Yes"
  11. Your new text file should look like below:
  12. Save the test file as slaveLauncher.bat
  13. You should have 2 files in your NodeLauncher Folder.
  14. Double click slaveLauncher.bat, it will initiate the launch and connect the Node to the Jenkins.
  15. If you will go back to Jenkins and see, the Node will no longer be offline.

Hope you will find this document useful, Please write to me your doubts and issues.




Tuesday 29 August 2017

5 Small But Important Things To Do When Setting Proxy In Jenkins

"Plugins are not getting installed in Jenkins", This issue you might have faced when you have freshly installed the  Jenkins in your office or for your project. You might have Observed that there are no Plugins listed under "Available Tab" when you navigated to "Manage Jenkins ⥤Manage Plugins ⥤ Available". The reason for this could be Jenkins which is not able to access the internet directly and may need to setup proxy to access the same. We have to setup HTTP Proxy Configuration if you need to get it going.

Jenkins Behind Proxy


So lets us start and resolve your issue.


  1. You need to login to your Jenkins account
  2.  Once Logged, click Manage Jenkins on the left of the Jenkins
  3.  Click Manage Plugins
  4. Now click Advanced Tab
  5. Fill the details as mentioned below:
  6. Validate your proxy by clicking the validate proxy button. Make sure it shows Success of validating the proxy.
  7. Click Submit to confirm your entries.


5 Things to Remember
  • Do not add http:// or https:// to your proxy server details in the text box
  • Set Port Number to 80
  • Leave Username and Password empty
  • Validate your proxy settings
  • Restart your Jenkins, This you can do from your browser itself http://localhost:8080/restart

Once restart is done, Navigate to the page "Manage Jenkins ⥤Manage Plugins ⥤ Available" again, see if the page is loading the plugins, You won't be able to see anything on the screen till all the plugins will be loaded, but only thing you can see will be the browser tab in loading mode.

If still, nothing is happening, go to HTTP Proxy Configuration page where you did the proxy settings, Click "Check Now" button present at the bottom right corner of the page. Come back to the "Manage Jenkins ⥤Manage Plugins ⥤ Available". Now I hope you get your plugin list.

Write down to me if you still face some issues, I will get back to you as soon as possible.

Sunday 27 August 2017

Creating Jenkins Job Is This Much Easy !!!


I am assuming that if you are looking how one can create a job in Jenkins, you have Jenkins Installed. If you still want to know how Jenkins can be installed please click here.

Create a Jenkins Job

Lets us begin creating a new job:

  1. Once you are done installing Jenkins, you will be taken to the Home page, where you will see the option to create a new job Or you can click "New Item" on the top left-hand side.
  2. Now Enter the suitable name for your Job, select freestyle option and click ok button.
  3. Now you are on the configuration page of your job. Jobs are configured based on your project requirements, Here I will be covering basic configuration that will help you in getting started.
  4. Under General Tab, enter the details related to your job. Giving Job description is important which will help someone to under stand what is this job about and this becomes very important when there are a lot of jobs added to the Jenkins. I have given the value of 30 but you can give any value for "Days to keep builds".
  5. Slave Node Configuration: Now you can mention the remote VM where your automation will be executing. This option will only be visible if you have added a Node as a slave to the Jenkins (Please click here to how to add a Node to Jenkins). If there is no node available then the Jenkins machine itself will behave as a slave and will execute test on the same machine where Jenkins has been installed. This execution may happen in Headless mode (means, you won't be able to see the execution going through), but you will be able to see the proceedings in the Jenkins console. 
  6. As we are just doing the basic configurations, we can leave Source Code Management and Build Triggers, to make the job creation simple to understand.
  7. Build Setup: This is the where you can specify what you want to execute. Suppose I am executing one of my Ruby files at a specific location then I would to the following configuration. First, you need to click "Add Build Step" and select "Execute Shell" and then add below lines, you can do a similar setup for executing batch files, java files etc.
  8. For the testing purpose, I am adding "Execute Windows Batch Command" and executing the command "@echo off title This is your first batch script! echo Welcome to batch scripting! pause"
  9. Click Save button to save all your configurations.
  10. You will be navigated back to the Job.
  11. These are the basic configurations that can be done for your project.
  12. If you want to add few more configurations you can click "Configure".
  13. Now you are ready to execute your first job 😊
  14. Click Build, This will execute your job.
  15. Now click on the job just executed and click console output.
  16. You will find the execution log for the job just executed. Ball Color turns Blue if the build is successful. It turns Red if there is an error in the build.
Hope this info was useful to you. Do let me know if you need more details related to the job creation.

Thursday 24 August 2017

Eliminate Your Fears And Doubts About Jenkins Installation

Jenkins installation is fairly easy when it comes to its installation on Windows machine. We just need to follow step by step approach.


Getting started with Jenkins

 You may be installing Jenkins for your own testing purpose or may be based on your project needs. So whatever may be the reason you must have Java installed on your system before start installing the Jenkins. 

Be careful when you do the installation, as if the installation happens behind your office network firewalls it may go through fine but your plugins might not get installed, You might get empty "Available" plugins list. So I would suggest doing the installation on your home network. or you may need to do the configure the proxy if you are using VMs or office network. click here if you want to see how to setup the proxy.
JenkinsàpluginManageràadvancedàHTTP Proxy Configuration


Now let's follow the steps below: 
  • Downloading Jenkins
  • Installing Jenkins
  • Configuring a Job on Jenkins
  • Configuring a Node  on Jenkins

Downloading Jenkins 

You can download Jenkins from Jenkins Home Page, The Jenkins project produces two release lines, LTS and weekly. Depending on your organization's needs, one may be preferred over the other. 

For this topic, I will cover installation using windows installer. 



Installing Jenkins
  1. Download the Jenkins as mentioned above.
  2. You will get a zipped file. Unzip it and you will get the installer.
  3. Double click and follow the instructions to finish the installation. 
  4. Once you click the finish button, new setup wizard window will get popped up, like one mentioned below. 
  5. "Unlock Jenkins" has been introduced recently by Jenkins which you might not see in the older versions of it. So, Go to the location mentioned on the screenshot, copy and paste the password
  6. Click continue.
  7. You can proceed as you wish at this step, I am just covering basic installation so I am going ahead with default plugin installation.
  8. Now, Sit back and relax, it will start downloading the default plugins.
  9. NOTE: I want to remind you that your download of plugins may end up in error or no plugins will be installed if you are sitting behind on your office network with proxy or firewall. So if that happens, no problem, don't get frustrated,
    you can configure the proxy settings here. 😉
  10. Once plugins will be installed, navigation will be moved to the admin user creation page.
  11. I would suggest creating an admin user and then go ahead.
  12. Click Save and Finish. 
  13. You will be navigated to another screen and you need to click on the "Start Using Jenkins".
  14. Congratulations!!!!!!!!!, you are ready to use your Jenkins.
  15. Note the URL, http://localhost:8080/, Same can be used when you need to access the Jenkins again. You may need the credentials created at step 11 to log in again.