Jenkins is an open source automation server that helps you automate the building, testing, and deployment of any project across multiple platforms. Jenkins helps you save time and avoid big breaking changes, so that you can ensure the delivery of high-quality software. It can be extended with hundreds of plugins to suit your needs better. It also has a web interface from which you can easily manage your projects.
Bitnami has a production-ready Jenkins cluster comprising one master node and a configurable number of slaves. This architecture allows you to create large-scale CI pipelines easily. By default, Bitnami's solution also includes the Swarm plugin for Jenkins, enabling you to immediately start testing containerized applications and building containers for Kubernetes.
Jenkins has become a critical component of the software development pipeline as it provides the ability to test several types of software on different platforms or operating systems. Use the Bitnami Jenkins cluster as a safe way to test your applications before taking them to production. Deploying the Bitnami Jenkins cluster on Azure enables you to quickly start executing jobs without worrying about software upgrades or plugin installation.
The Bitnami Jenkins solution is available in the Microsoft Azure Marketplace. Continue reading to find out how to get started with it.
Bitnami Jenkins cluster default configuration
The default configuration of the Bitnami Jenkins cluster is defined in its Azure Resource Manager (ARM) template following the best practices of the software provider. The image is configured with 3.5 GB RAM and 50 GB of disk space on each virtual machine (VM) and uses multiple VMs: three nodes in total, one master and two slaves. This configuration can be changed at deployment time and you can also add more nodes by launching more servers after the cluster is created.
Adding slave machines to your cluster means better distribution of workloads and higher fail tolerance on your deployment. If a slave node goes down, jobs will be scheduled to a different slave. This makes the Bitnami Jenkins cluster a good solution when dealing with multiple concurrent jobs and heavy workloads.
The Bitnami Jenkins solution also includes:
- The latest version of Jenkins and its components, including major security updates.
- The latest versions of community-recommended plugins, including pipelines and Git integration.
- A secure authentication method: an administrative user account is created and the password is entered by you at deploy-time.
Bitnami Jenkins cluster deployment on Azure
The Bitnami Jenkins cluster provides an excellent deployment experience. All resources, objects, and parameters are declared in its ARM template.
To start with a new Bitnami Jenkins cluster deployment on Microsoft Azure, follow the instructions below:
- Register with Microsoft Azure if you are not registered yet.
- Browse to the Azure Marketplace and select the "Bitnami Jenkins cluster stack".
- On the description page, review the information and fees. Click "Get it now" to proceed. In the pop-up window, click "Continue".
- You will now be redirected to the Microsoft Azure management console. Log in if required.
- On the resulting page, click the "Create" button to proceed.
In the "Basics" tab, provide a name for the deployment and an application password. If necessary, change the default number of slave servers in the deployment. This example uses three slave nodes.
Also, select a subscription, a resource group and the location. Click "OK" to continue.
- In the "Environment Configuration" tab, enter an SSH public key or a password to connect to the server. Select the data and VM size. Click "OK".
- In the "Summary" tab, verify the chosen settings. Click "OK" to proceed.
You can download the solution template and parameters by clicking the link beside the "OK" button.
The Azure Marketplace will now begin spinning up the new server. A notification will appear indicating the current status. The process usually takes a few minutes. Once the template has been provisioned, you will see a notification and the new instances and related resources will appear in the "Resource groups" section of the Microsoft Azure management console.
Notice that the resource group includes 4 virtual machines in total since 3 slaves servers were selected at deployment time:
Access the Jenkins dashboard
To access the Jenkins dashboard, it is necessary to retrieve the public IP address of the deployment and have the application username and password in hand. Follow these instructions to start using your Jenkins deployment:
- Navigate to the "Resource groups" section of the Microsoft Azure management console. From the resulting list, select on the resource group associated with your deployment. You will see a list of all the resources that have been deployed.
- Select the "Public IP address" resource as shown below:
- From the resulting screen, copy the DNS name. As you can see in the image below, the public IP address of the deployment matches the public IP address of the master node (virtual machine 0).
- Browse to the virtual machine, by entering the server IP address directly into your browser's address bar. You should see the Jenkins login page.
- Enter the username (user) and the password you specified at deployment time:
Congratulations! You have successfully deployed a Jenkins cluster on Azure. Keep reading to learn how to execute your first job in Jenkins.
Execute your first Jenkins job
A "job", in Jenkins terminology is the set of runnable tasks that are controlled by Jenkins while a "build" is the term used to refer to the result of running those tasks in a project.
The Jenkins dashboard is the central location for all your interactions with Jenkins. It has controls for creating and running builds, checking build outputs, managing credentials, and much more.
Once you access the dashboard, you will find an intermediate screen for installing a recommended set of additional plugins and restarting Jenkins. It is not mandatory to do this for this guide, but it may be useful for other projects. To skip this step, close the window and then click "Start using Jenkins":
If you decide to install all suggested plugins, you will be prompted to confirm the Jenkins URL. Then, click "Save and Finish". On the resulting screen, click "Restart" to finish the Jenkins setup. Refresh the page to avoid unexpected issues during the loading process.
You can now create and build a project.
Create and build a sample project
- In the Jenkins dashboard, click the "New item" link on the left-side menu:
- In the resulting screen, enter a name for your project and select "Freestyle Project" as the project type. Click "OK" to proceed:
- Navigate to the "Build Triggers" tab and add a build step by selecting the "Execute shell" option:
In the resulting "Command" box, enter a shell command that displays output. See an example below. Click "Save" to save the changes:
To check the available environment variables in Jenkins, click the "See the list of available environment variables" link below the "Command" box.
- Back to the Jenkins dashboard and click "Build Now" to start building the new project.
Jenkins should start building the project. Once it finishes, you can see the result under the "Build History" section.
- Click on the "Console Output" link. The build log should display the output of the shell command you specified earlier.
You just completed your first successful build with Jenkins!
Let's move on with a real-world example.
Build a GitHub project
This next section walks you, step by step, through the process of building a project stored in an external SCM, such as a Git project on GitHub.
This tutorial uses a public repository with a simple C++ application. If you want to use a private repository, you must configure the Jenkins user to access the Git repository before following the steps below.
- Begin by logging into GitHub with your account. Browse to the repository for the example C++ application. Click the "Fork" button to create your own personal fork of the repository.
- Navigate back to the Jenkins dashboard, click "New item", enter a name for your project and select "Freestyle Project". Click "OK" to proceed.
- Navigate to the "Source Code Management" tab, select the "Git" option and enter the GitHub repository URL in the "Repository URL" field:
- Scroll down to set up a build step. Select "Execute shell" and enter the following command to run the Makefile in the right directory:
cd original make echo Hello Jenkins!
- Click "Save" to save the changes.
- Head back to the project page and click the "Build now" link. Jenkins should clone your GitHub repository and build it. Once the build is complete, select the "Console Output" menu item (as done previously in Step 1) to access detailed build information.
Congratulations! You have build a GitHub project successfully.
Points to remember
The Bitnami Jenkins cluster template is perfect for quickly start and testing your applications before taking them into production. The cluster configuration enables you to:
- Have different build and testing environments for your builds by creating a complete testing environment having different operating systems in each node.
- Handle heavy and large projects on a regular basis.
- Secure your main Jenkins node by having the jobs executed in slaves. If one of the slaves fails, jobs will be scheduled to a different slave.
- Distribute workloads across all nodes.
The Bitnami Jenkins cluster template allows you to scale up by adding more nodes to the deployment at any time with no extra cost.
The Swarm plugin is activated by default so you can start testing your containerized applications right away.
The integration with Git is already included, making it easy to create a continuous integration pipeline for GitHub and GitLab projects.
To learn more about the Bitnami Jenkins cluster, it is highly recommended that you follow these next steps:
- Secure your deployment by installing a Let's Encrypt certificate
- Configure load balancing with SSL for ensuring quick response times and rapid adaptation to traffic peaks in your deployment
- Use a custom executable in a Jenkins job
- Configure Jenkins to access a private Git repository
- Add more nodes to the cluster
- Upgrade Jenkins
- Upgrade Jenkins plugins