*Background: * Our IT team set out to develop a long-term deployment strategy for our CI/CD pipeline. Before Jenkins, it was very tricky to use Blue-Green deployment on dynamic content, which changes frequently. Although they could swap the slots to use production or UAT, the data synchronization and maintaining stateful content was very challenging.
Goals: To develop and deploy a full stack application using Jenkins CI/CD pipeline.
"Jenkins is a very popular Java-based, open-source, continuous integration (CI) server that allows teams to continuously build applications across platforms."
*Solution & Results: *
Jenkins allows our teams to build applications across platforms continuously. The Azure pipeline includes the ability to create any application on any platform, including Windows, Linux, and Mac. However, it also integrates well with Jenkins for teams who already use or prefer to use Jenkins for CI.
As our release pipeline is very much integrated, we chose to use docker images once we complete the CI build we store in our private repository, Artifactory. We then push the image to trigger the development instance. Once the development instance is verified, we can trigger the UAT instance for testing. Once UAT is signed off, we release the same in production. In this way, we ensure that the same image is verified with different configs, i.e., test, UAT, and prod config. If the production fails, we can quickly rollback by releasing the last successful production. Since it only takes five to ten minutes, we can ensure that there is hardly any downtime if production fails due to some reason.
This is what we used to integrate Jenkins with Azure pipelines:
One way is to run CI jobs in Jenkins separately. This involves configuring a CI pipeline in Jenkins and a webhook in Azure DevOps that invokes the CI process when source code is pushed to a repository or branch.
Create an Azure DevOps Build Pipeline for Jenkins.
Create a Personal Access Token for connecting Jenkins and Azure DevOps. Then set up a Jenkins Build Project. Test the Jenkins Build. Set up an Azure DevOps pipeline release. Trigger the release with a Post Build Action in Jenkins.
We have used the following plugins.
Azure AD plugin allows the Jenkins server to support SSO for users based on Azure AD.
Azure VM Agents plugin uses an Azure Resource Manager template to create Jenkins agents in Azure virtual machines.
Azure Storage plugin uploads build artifacts to — or downloads build dependencies from — Azure Blob storage.
Azure Container Agents helps you to run a container as an agent in Jenkins.
Kubernetes Continuous Deploy deploys resource configurations to a Kubernetes cluster.
Azure Container Service deploys configurations to Azure Container Service with Kubernetes, DC/OS with Marathon, or Docker Swarm. Azure Functions deploys your project to Azure Function.
Azure App Service deploys to Azure App Service.
I am happy that I have used Azure DevOps with Jenkins and, in doing so, learned many new concepts. I am even more satisfied with the results:
Release time is very fast
Rollback time is quick
Downtime is negligible
Failback or failover chances are slim