Jenkins Distributed Builds
- When we try to build a jenkins job, jenkins will try to find an executor. Jenkins server has by default 2 executor. This implies we can build two jobs in parallel.
- In an enterprise scenario, each project has its set of tools/softwares which might be different, to support this jenkins has node concept
- A node is a VM or Physical or docker container with preconfigured set of tools installed.
- We need to configure the connection b/w jenkins Server and node and also configure number of executors. Each node will/should have a label.
- Now once this configuration is done, then we can have our jobs build on different node than jenkins server
- This gives an option to have various builds configured from one highly available jenkins.
- Adding nodes to jenkins server gives us the flexibility to create various environments (QA,Dev, Staging, pre-prod)
How to configure a node to Jenkins server
- Jenkins tries to login into remote node and execute the job for this jenkins uses an agent from jenkins called as jenkins-agent
- On the jenkins node java 8 or java 11 has to be installed
- For our lab set up lets create a ubuntu 18 node install java and maven
sudo apt update
sudo apt install openjdk-8-jdk -y
sudo apt install maven -y
- To configure a linux node we need to configure the ssh communication between jenkins server and node
- Jenkins server needs to know the username and password of the node
- Ensure password authentication is enabled by checking PasswordAuthentication value in /etc/ssh/sshd_config
- Ensure a user is created for running builds on jenkins node
sudo adduser jenkins
- Give the user necessary permissions
- Try to login into jenkins node from jenkins server as jenkins user
- Now lets try to configure this node from jenkins ui
- Now since the node is healthy lets try to build a game of life on the node
- Next Steps:
- We have configured a linux node with ssh username and password, we need to configure with name and ssh-key
- Other aspects of jenkins such as periodic builds, mail notifications, post build actions etc..
Like this:
Like Loading...