In this blog, we’ll explore how Jenkins integrates with these tools using a master-slave configuration — with a simple example to tie it all together.
Understanding Jenkins Master-Slave Setup
- Master Node: Controls the Jenkins environment, handles scheduling, and assigns jobs to slaves
- Slave Node (Agent): Performs the actual tasks like pulling code, building Docker containers, or running test scripts.
This separation of responsibilities ensures that heavy tasks don't overload the master and builds/tests can run in parallel.
"The best way to secure a system is not to have it accessible in the first place."
by Eugene H. SpaffordaIntegrating Git, Docker, and Selenium — Step-by-Step Example
Scenario:
You're developing a web application. You want Jenkins to:
1. Pull the latest code from Git.
2. Build and containerize the app using Docker.
3. Run Selenium test cases to verify the UI.
Step 1: Git Integration on Jenkins Master
- The Jenkins master monitors the Git repository for changes.
- When a developer pushes code to GitHub, a webhook triggers a Jenkins job.
- Jenkins pulls the source code and schedules the pipeline execution.
Step 2: Docker Build on Slave Node
- The Jenkins slave (with Docker installed) receives the build job.
- It creates a Docker image of the application using the pulled source code.
- The image is then run as a container for further testing or deployment.
Step 3: Selenium Testing on Slave Node
- Another Jenkins slave (configured with Selenium and browser drivers) picks up the nextstage
- It runs automated Selenium scripts against the Dockerized app to verify the UI.
- Test results are sent back to the Jenkins master for reporting.
Final Workflow Summary
Why Use Jenkins with Master-Slave Setup?
- Load distribution across nodes
- Environment isolation for builds and tests
- Faster execution with parallel tasking
- Scalability for enterprise pipelines
Final Thoughts
Integrating Jenkins with Git, Docker, and Selenium in a master-slave environment creates a reliable, scalable, and automated DevOps pipeline. You ensure that every code commit is built, tested, and packaged — without slowing down your infrastructure or your team.