How to set up Distributed build and Automated deployment in Jenkins

Last updated on May 28 2022
Uma Kulkarni

Table of Contents

How to set up Distributed build and Automated deployment in Jenkins

Jenkins – Distributed Builds

Sometimes many build machines are required if there are instances wherewithin there are a larger and bigger projects which get built on a regular basis. And running all of these builds on a central machine may not be the best option. In such a scenario, one can configure other Jenkins machines to be slave machines to take the load off the master Jenkins server.

Sometimes you would also need several different environments to test your builds. In this case using a slave to represent each of your required environments is almost a must.

A slave is a computer that’s set up to offload build projects from the master and once setup this distribution of tasks is fairly automatic. The exact delegation behavior depends on the configuration of each project; some projects may choose to “stick” to a particular machine for a build, while others may choose to roam freely between slaves.

Since each slave runs a separate program called a “slave agent” there is no need to install the full Jenkins (package or compiled binaries) on a slave. There are various ways to start slave agents, but within the end the slave agent and Jenkins master needs to establish a bi-directional communication link (for example a TCP/IP socket.) in order to operate.

To set up slaves/nodes in Jenkins follow the steps given below.

Step 1 − Go to the Manage Jenkins section and scroll down to the section of Manage Nodes.

How to set up Distributed build and Automated deployment in Jenkins
How to set up Distributed build and Automated deployment in Jenkins

Step 2 − Click on New Node

How to set up Distributed build and Automated deployment in Jenkins
How to set up Distributed build and Automated deployment in Jenkins

Step 3 − Give a name for the node, choose the Dumb slave option and click on Ok.

How to set up Distributed build and Automated deployment in Jenkins
How to set up Distributed build and Automated deployment in Jenkins

Step 4 − Enter the details of the node slave machine. Within the below example, we are considering the slave machine to be a windows machine, hence the option of “Let Jenkins control this Windows slave as a Windows service” was chosen as the launch method. We also need to add the necessary details of the slave node such as the node name and the login credentials for the node machine. Click the Save button. The Labels for which the name is entered as “New_Slave” is what can be employed to configure jobs to use this slave machine.

How to set up Distributed build and Automated deployment in Jenkins
How to set up Distributed build and Automated deployment in Jenkins

Once the above steps are completed, the new node machine will initially be in an offline state, but will come online if all the settings within the previous screen were entered correctly. One can at any time make the node slave machine as offline if required.

How to set up Distributed build and Automated deployment in Jenkins
How to set up Distributed build and Automated deployment in Jenkins

Jenkins – Automated Deployment

There are many plugins available which can be employed to transfer the build files after a successful build to the respective application/web server. On example is the “Deploy to container Plugin”. To use this follow the steps given below.

Step 1 − Go to Manage Jenkins → Manage Plugins. Go to the Available section and find the plugin “Deploy to container Plugin” and install the plugin. Restart the Jenkins server.

How to set up Distributed build and Automated deployment in Jenkins
How to set up Distributed build and Automated deployment in Jenkins

This plugin takes a war/ear file and deploys that to a running remote application server at the end of a build.
Tomcat 4.x/5.x/6.x/7.x
JBoss 3.x/4.x
Glassfish 2.x/3.x

Step 2 − Go to your Build project and click the Configure option. Choose the option “Deploy war/ear to a container”

How to set up Distributed build and Automated deployment in Jenkins
How to set up Distributed build and Automated deployment in Jenkins

Step 3 − Within the Deploy war/ear to a container section, enter the required details of the server on which the files got to be deployed and click on the Save button. These steps will now ensure that the necessary files get deployed to the necessary container after a successful build.

How to set up Distributed build and Automated deployment in Jenkins
How to set up Distributed build and Automated deployment in Jenkins

So, this brings us to the end of blog. This Tecklearn ‘How to set up Distributed build and Automated deployment in Jenkins’ blog helps you with commonly asked questions if you are looking out for a job in DevOps. If you wish to learn Jenkins and build a career in DevOps domain, then check out our interactive, Continuous Integration with Jenkins Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

Continuous Integration with Jenkins

Continuous Integration with Jenkins Training

About the Course

Tecklearn has specially designed this Continuous Integration with Jenkins Training Course to advance your skills for a successful career in this domain. This course helps you learn server automation, continuous integration, build and configuration tools, Jenkins master-slave architecture, different types of plugins, implementing automated testing and more through hands-on projects and exercises. Upon completion of this online training, you will hold a solid understanding and hands-on experience with Jenkins.

Why Should you take Continuous Integration with Jenkins Training?

• Average salary of Jenkins Professional is $110k (Indeed.com Salary Data)
• Jenkins is an open-source automation server which enables developers around the world to reliably build, test, and deploy their software.

What you will Learn in this Course?

Introduction to DevOps

• What is Software Development
• Software Development Life Cycle
• Why DevOps?
• What is DevOps?
• DevOps Lifecycle
• DevOps Tools
• Benefits of DevOps
• How DevOps is related to Agile Delivery
• DevOps Implementation

Continuous Integration with Jenkins

• Introduction to Continuous Integration and Jenkins
• Jenkins Management
• Jenkins Master Slave Architecture
• Tools Required for CI
• Understanding CI/CD Pipelines
• Creating an end-to-end automated CI/CD Pipeline
• Jenkins Versions

0 responses on "How to set up Distributed build and Automated deployment in Jenkins"

Leave a Message

Your email address will not be published. Required fields are marked *