Creating a continuous integration environment in Oracle Cloud Infrastructure using Jenkins

April 28, 2021 | 3 minute read
Text Size 100%:

This post was written by Jeevan Joseph, a principal solution architect on the Developer Adoption team in Oracle Cloud Infrastructure.

We’re pleased to announce a new quickstart solution that demonstrates how to create a continuous integration environment on Oracle Cloud Infrastructure (OCI). Quickstarts are complete solutions that you can launch quickly on your OCI free tier account or trial account. They let you try real solutions while learning about the services and capabilities in OCI. This quickstart solution for Jenkins shows you how to set up and use Jenkins to automate your build and deployment processes in OCI.

Jenkins is a free, open source automation server. It helps automate the parts of software development related to building, testing, and deploying, and facilitating continuous integration and continuous delivery (CICD) of software. Jenkins is a server-based system that typically runs as a standalone application in its own process with the built-in Java servlet container or application server, Jetty.

In this solution, we use Docker containers to run and manage Jenkins on OCI. Docker’s fundamental platform and container design enables you to run Jenkins in a distributed manner on any Compute platform and scale efficiently. You deploy Jenkins using the official jenkins/jenkins image from the Docker Hub. This image contains the current production-ready long-term support (LTS) release of Jenkins. The solution also installs plugins that integrate Jenkins with OCI to provision Compute instances as build agent nodes. This installation provides a high degree of elasticity in the Jenkins deployment to provision and pay for Compute only during a build.

The solution

This quickstart solution for Jenkins provides all the required automation to provision the resources in your tenancy. OCI supports several industry standard resource management tools such as Terraform and Ansible. In this quickstart, we use Terraform to create and manage the resources.

OCI also provides a managed Terraform service called Oracle Resource Manager. This free service makes it even easier for you to work with Terraform by integrating directly with various source control systems, providing infrastructure automation and managing Terraform states. Oracle Resource Manager can also help package Terraform configurations as stacks, which create and manage infrastructure components in a user-friendly and wizard-driven manner. You can apply the same steps presented here to build your own stacks for easy, consistent, and repeatable deployments.

This quickstart solution is open source, which enables you to use it as a sandbox or starting point for more complex deployments. The Terraform automation manages the components and is packaged as a reusable stack that you can later use to modify the topology and configuration. You can run the Terraform code published on GitHub in multiple ways. For a quick deployment, you can use the deploy button, which uses the Oracle Resource Manager. You can also choose to deploy the solution directly through the Terraform CLI in your development environment or in the Oracle Cloud Shell.

Expressing infrastructure as code using the methods described in this example gives you repeatability and consistency in their infrastructure and application deployments.

The architecture

Jenkins is deployed in a scalable model, where the only persistent infrastructure used is for the Jenkins controller. The Jenkins Controller manages the various jobs and tasks that run on Jenkins agents. Jenkins agents are Compute instances that you can provision on-demand when a job triggers and terminate when a job is complete. This model makes it scalable and cost-efficient. The integration with OCI to map Jenkins agents as OCI Compute instances is achieved through the OCI Jenkins plugin. The plugin is installed by the solution along with other popular plugins, such as Blue Ocean and Jenkins configuration as code.

A graphic depicting the architecture connecting the Jenkins controlling to OCI Block Storage.

Next steps

To learn more about the architecture, the automation tools and to build your own cloud native deployments, head over to the GitHub repository. Here, we provide a Deploy to Oracle Cloud button that automates the resource creation and deployment process. You can also evolve your deployment to production scale using the advanced deployment patterns provided in our reference architecture published in the OCI Architecture Center. The OCI Architecture Center provides a catalog of cross-product reference architectures, solution playbooks, and best practices.

You can get started on OCI by signing up for the Oracle Cloud Free Tier. The Oracle Cloud Free Tier includes Always Free services that never expire and a 30-day free trial, which includes US$300 in credits to get you started with a range of services, including compute, storage, and networking.

Jeevan Joseph

Previous Post

How Oracle Dedicated Region Cloud@Customer brings a more complete set of public cloud services to customers’ data centers than AWS Outposts

Brian Huynh | 3 min read

Next Post

Customers continue to enhance their AI and ML workloads on Oracle Cloud Infrastructure

Gloria Lee | 2 min read