Faster software development has become a competitive advantage for companies. The automation of software development processes facilitates speed and consistency, which led to the rise for having a Continuous Integration (CI) and Continuous Delivery and Deployment (CD) pipelines. Jenkins is a very popular product among Oracle Cloud Infrastructure customers, which can automate all of the phases of CI and CD. You can host Jenkins on Oracle Cloud Infrastructure to centralize your build automation and scale your deployment as the needs of your software projects grow.
This is the first in a series of blog posts on how to set up a CI/CD build pipeline on Oracle Cloud Infrastructure using Jenkins. Jenkins is extensible by design via plugins. Plugins give Jenkins the flexibility to automate a wide range of processes on diverse platforms. Without delving too much into the architecture of Jenkins, let’s quickly understand the concept of master/slave in Jenkins. Jenkins supports the master and slave/agent mode, where the workload of building projects is delegated to multiple agent nodes by the master, allowing a single Jenkins installation to host multiple projects, or to provide different environments needed for builds/tests.
A master operating by itself is the basic installation of Jenkins and in this configuration the master handles all the tasks for your build system. If you start to use Jenkins frequently with just a master, it's common to find that you run out of resources (memory, CPU, etc.). At this point, you can either upgrade your master or you can set up agents to pick up the load. Alternatively, in a scenario where you need several different environments to test your builds, using an agent to represent each of your required environments can be a better solution. An agent is a computer that is set up to offload build projects from the master. Once the agent has been set up, this distribution of tasks is fairly automatic.
In this tutorial, we demonstrate how to create a Jenkins master/slave architecture on Oracle Cloud Infrastructure using the Jenkins Oracle Cloud Infrastructure Compute plugin. When installed on Jenkins master, the plugin allows you to spin up instances (slaves/agents) on demand within Oracle Cloud Infrastructure, and remove instances or free resources automatically once the build job completes.
Let's look at how to launch a Jenkins master/slave deployment on Oracle Cloud Infrastructure, in a few easy steps:
sudo yum -y update
sudo yum -y install java
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum -y install jenkins
sudo service jenkins start
If successful, the command output looks similar to this:
sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
This concludes this tutorial on setting up Jenkins master/slave nodes on Oracle Cloud Infrastructure (OCI). There are other ways to deploy Jenkins on OCI which are also quite suitable for enterprise deployments. We shall demonstrate these deployment strategies in my subsequent blog posts:
1) Traditional deployment - which involves manually launching and configuring the agent nodes by just using Jenkins SSH slave plugins and not Oracle cloud infrastructure compute plugin. A setup like this involves a lot of manual configuration, but on the contrary, it gives a lot more granular control over how to launch Jenkins agents. Currently, using the Oracle cloud infrastructure compute plugin, you can launch agent nodes within a single Availability Domain, if you plan on launching agent nodes across multiple Availability Domains, we recommend this approach.
2) Containerized deployment - which involves deploying and running Jenkins master and the worker nodes as Docker containers. Running Jenkins in Docker containers allows you to use servers running Jenkins agent nodes more efficiently. It also simplifies the configuration of the agent node servers. Using containers to manage builds allows the underlying servers to be pooled into a cluster. The Jenkins agent containers can then run and execute a build on any of the servers with resources available to support the build. This ability to pool multiple builds to run independently of each other on the server improves the utilization of the server.
In my next blog post, we shall demonstrate how to create a Jenkins build pipeline on Oracle Cloud Infrastructure using the setup we just created.
We are pleased to announce the immediate availability of the HashiCorp Terraform Provider for Oracle Cloud Infrastructure, which is...
Thymos Intelligence Providing an Environment in the Cloud to Run HPC Applications Tokyo, Japan - 2018/07/26 Oracle Corporation Japan...
As part of our series of interviews with Oracle employees, partners, and customers who have successfully passed the Oracle Cloud...