Maintaining a Stable Continuous Integration environment the traditional way requires a lot of work. It involves building an Army of Jenkins Agents, configuring them in a certain way (SDKs, Build and Runtime configuration etc.).
This is further complicated if you need to setup a platform for User Acceptance Testing (or Functional) which includes adding a Selenium Grid to your environment including the Hub and one or more Agents. And you will need to test against multiple Browsers (Chrome, Firefox, IE) and multiple versions of them. Companies such as Perfecto, Sauce Labs and BrowserStack offer cloud based testing solutions. But if you an on premises solutions within the Enterprise, Jenkins Kubernetes plugin provides an elegant solution.
Here’s what we will accomplish with this tutorial
- Install Minikube
- Helm & Tiller
- Kubernetes plugin
- Jenkins pipeline project
- Create an on Demand Jenkins Agent*
- Selenium Grid & Selenium Nodes for testing*
*Resources are destroyed after use.
- Windows 7/10/Linux/MacOS
- Chocolatey for Windows or an equivalent package manager such as Brew, APT etc.
choco install minikube
Follow this guide for instructions on other Operating Systems
minikube start --cpus 4 --memory 8192
Run the Minikube Dashboard
The dashboard provides a GUI to view and manage Kubernetes resources.
Setup Networking for Minikube
Install and Initialize Helm & Tiller
choco install kubernetes-helm
For other OSes, follow these instructions
Save the following as jenkins.yaml
master: installPlugins: - kubernetes:1.15.5 - htmlpublisher:1.18 - workflow-aggregator:2.6 - workflow-job:2.32 - credentials-binding:1.18 - git:3.12.0 - greenballs:1.15 - role-strategy:2.9.0 - locale:1.4
helm install --name jenkins -f jenkins.yaml stable/jenkins
Jenkins login credentials can be found on the Pod description page on the Minikube Dashboard
Jenkins IP address can be found in the “Services” tab.
Setup a Jenkins Pipeline Project
Login to Jenkins and create a new Pipeline project
Add the following the the “Script” section
Build the project. Jenkins will create a temporary (dynamic) agent including an instance of Selenium Hub and each instances of Chrome and Firefox.