CINXE.COM

Set Up a CI/CD Pipeline for Cloud Deployments

<!DOCTYPE html SYSTEM "about:legacy-compat"> <html xml:lang="en-us" lang="en-us" class="solution automation"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="DC.Type" content="topic"> <meta name="DC.Title" content="Set Up a CI/CD Pipeline for Cloud Deployments"> <meta name="abstract" content="Rapid delivery of software is important for running your applications in the cloud efficiently. Jenkins is a popular product for automating the Ccontinuous Iintegration (CI) and Continuous Deployment (CD) pipelines for workloads in Oracle Cloud."> <meta name="description" content="Rapid delivery of software is important for running your applications in the cloud efficiently. Jenkins is a popular product for automating the Ccontinuous Iintegration (CI) and Continuous Deployment (CD) pipelines for workloads in Oracle Cloud."> <meta name="copyright" content="(C) Copyrightfr 2020" type="primary"> <meta name="DC.Rights.Owner" content="(C) Copyrightfr 2020" type="primary"> <meta name="copyright" content="(C) Copyrightfr 2022" type="secondary"> <meta name="DC.Rights.Owner" content="(C) Copyrightfr 2022" type="secondary"> <meta name="DC.Date.Created" content="August 2022"> <meta name="DC.Format" content="XHTML"> <meta name="DC.Identifier" content="GUID-D5231DA5-98CB-4690-B15F-656181B0080C"> <meta name="DC.Language" content="en-US"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="abstract" content="Rapid delivery of software is important for running your applications in the cloud efficiently. Jenkins is a popular product for automating the Ccontinuous Iintegration (CI) and Continuous Deployment (CD) pipelines for workloads in Oracle Cloud."> <meta name="description" content="Rapid delivery of software is important for running your applications in the cloud efficiently. Jenkins is a popular product for automating the Ccontinuous Iintegration (CI) and Continuous Deployment (CD) pipelines for workloads in Oracle Cloud."> <title>Set Up a CI/CD Pipeline for Cloud Deployments</title> <meta property="og:site_name" content="Oracle Help Center"> <meta property="og:title" content="Set up a CI/CD pipeline for cloud deployments with Jenkins"> <meta property="og:description" content="Rapid delivery of software is important for running your applications in the cloud efficiently. Jenkins is a popular product for automating the Ccontinuous Iintegration (CI) and Continuous Deployment (CD) pipelines for workloads in Oracle Cloud."> <link rel="stylesheet" href="/sp_common/book-template/ohc-book-template/css/book.css"> <link rel="shortcut icon" href="/sp_common/book-template/ohc-common/img/favicon.ico"> <meta name="application-name" content="Set up a CI/CD pipeline for cloud deployments with Jenkins"> <meta name="generator" content="DITA Open Toolkit version 1.8.5 (Mode = solution)"> <meta name="plugin" content="SP_docbuilder HTML plugin release 18.2.2"> <meta name="robots" content="all"> <meta name="keywords" content="CI/CD,Cloud Native,Terraform"> <link rel="schema.dcterms" href="http://purl.org/dc/terms/"> <meta name="dcterms.created" content="2022-08-09T17:33:57-07:00"> <meta name="dcterms.title" content="Set up a CI/CD pipeline for cloud deployments with Jenkins"> <meta name="dcterms.dateCopyrighted" content="2020, 2022"> <meta name="dcterms.category" content="solutions"> <meta name="dcterms.identifier" content="F27100-07"> <meta name="dcterms.product" content="en/solutions;en/cloud/oracle-cloud-infrastructure/oci"> <meta name="dcterms.release" content="Test Release"> <script> document.write('<style type="text/css">'); document.write('body > .noscript, body > .noscript ~ * { visibility: hidden; }'); document.write('</style>'); </script> <script data-main="/sp_common/book-template/ohc-book-template/js/book-config" src="/sp_common/book-template/requirejs/require.js"></script> <script> if (window.require === undefined) { document.write('<script data-main="sp_common/book-template/ohc-book-template/js/book-config" src="sp_common/book-template/requirejs/require.js"><\/script>'); document.write('<link href="sp_common/book-template/ohc-book-template/css/book.css" rel="stylesheet"/>'); } </script> <script type="application/json" id="ssot-metadata">{"primary":{"category":{"short_name":"solutions","element_name":"Solutions","display_in_url":true},"suite":{"short_name":"reference-architectures","element_name":"Reference Architectures","display_in_url":false},"product_group":{"short_name":"oci","element_name":"OCI Architectures","display_in_url":false}}}</script> <meta name="dcterms.isVersionOf" content="CICD-PIPELINE"> <script type="application/ld+json"> {"@context":"https://schema.org","@type":"WebPage","name":"Set Up a CI/CD Pipeline for Cloud Deployments","description":"Rapid delivery of software is important for running your applications in the cloud efficiently. Jenkins is a popular product for automating the Ccontinuous Iintegration (CI) and Continuous Deployment (CD) pipelines for workloads in Oracle Cloud.","datePublished":"2020-02-07 17:20:02 GMT","dateModified":"2022-08-10 00:36:42 GMT"} </script> <script>window.ohcglobal || document.write('<script src="/en/dcommon/js/global.js">\x3C/script>')</script></head> <body> <div class="noscript alert alert-danger text-center" role="alert"> <a href="index.html" class="pull-left"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>Previous</a> <a href="#" class="pull-right">Next<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a> <span class="fa fa-exclamation-triangle" aria-hidden="true"></span> JavaScript must be enabled to correctly display this content </div> <article> <header> <ol class="breadcrumb" vocab="http://schema.org/" typeof="BreadcrumbList"> <li property="itemListElement" typeof="ListItem"><a href="index.html" property="item" typeof="WebPage"><span property="name">Set up a CI/CD pipeline for cloud deployments with Jenkins</span></a></li> <li class="active" property="itemListElement" typeof="ListItem">Set Up a CI/CD Pipeline for Cloud Deployments</li> </ol> <a id="GUID-D5231DA5-98CB-4690-B15F-656181B0080C" name="GUID-D5231DA5-98CB-4690-B15F-656181B0080C"></a> <h2 id="OWLWD-GUID-D5231DA5-98CB-4690-B15F-656181B0080C" class="sect2">Set Up a CI/CD Pipeline for Cloud Deployments</h2> </header> <div class="ind"> <p>Rapid delivery of software is important for running your applications in the cloud efficiently. Jenkins is a popular product for automating the Ccontinuous Iintegration (CI) and Continuous Deployment (CD) pipelines for workloads in <span>Oracle Cloud</span>. </p> <div class="sect2"><a id="GUID-D741A2F7-7E15-44ED-8B57-CB7197FE5D07" name="GUID-D741A2F7-7E15-44ED-8B57-CB7197FE5D07"></a><h3 id="OWLWD-GUID-D741A2F7-7E15-44ED-8B57-CB7197FE5D07" class="sect3">Architecture</h3> <div> <p>In this reference architecture, Jenkins is hosted on <span>Oracle Cloud Infrastructure</span> to centralize build automation and scale the deployment. The Continuous Integration process creates an application and deploys it by using <span>Oracle Cloud Infrastructure Registry</span> (OCIR) and Container Engine for Kubernetes (OKE). GitHub is used to manage source code. </p> <p>GitHub provides web hook integration, so Jenkins starts running automated builds and tests after each code check-in. A sample web application is deployed as part of CI/CD pipeline, which end users can access from the Container Engine for Kubernetes cluster. To simplify the process, Terraform is used for infrastructure automation.</p> <p>In this reference architecture, Terraform leverages a Terraform module capable of deploying Jenkins in several different configurations from a single Jenkins VM through to a controller (server) and agent (worker) node configuration. This means that the Jenkins module can be incorporated into other architecture deployments for non-Kubernetes use cases (for example APEX application development, WebLogic on VMs and so on). </p> <p>The agent configuration means that the environment can be reconfigured to provide different numbers of compute instances reflecting the workload requirements. This includes the possibility of replacing agent VMs to avoid problems of accumulating old dependencies, transient dependency conflicts, and builds working with undeclared dependencies. </p> <p>The VM Nodes running Jenkins are configured using a predefined VM image that has been prebuilt with all the necessary software to support Jenkins. </p> <p>The following diagram illustrates this reference architecture.</p><img id="GUID-D741A2F7-7E15-44ED-8B57-CB7197FE5D07__IMAGE_LMD_FV4_NKB" height="614" width="894" src="img/cicd-oci.png" alt="Description of cicd-oci.png follows" title="Description of cicd-oci.png follows" longdesc="img_text/cicd-oci.html"><br><a href="img_text/cicd-oci.html">Description of the illustration cicd-oci.png</a><p> <a href="img/cicd-oci-oracle.zip" class="de-download">cicd-oci-oracle.zip</a> </p> <div class="p">This architecture has the following components: <ul style="list-style-type: disc;" id="GUID-D741A2F7-7E15-44ED-8B57-CB7197FE5D07__UL_WBN_NFN_NKB"> <li><span class="bold">Region</span><p>An <span>Oracle Cloud Infrastructure</span> region is a localized geographic area that contains one or more data centers, called availability domains. Regions are independent of other regions, and vast distances can separate them (across countries or even continents). </p> </li> <li><span class="bold">Availability domains</span><p>Availability domains are standalone, independent data centers within a region. The physical resources in each availability domain are isolated from the resources in the other availability domains, which provides fault tolerance. Availability domains don鈥檛 share infrastructure such as power or cooling, or the internal availability domain network. So, a failure at one availability domain is unlikely to affect the other availability domains in the region.</p> </li> <li><span class="bold">Virtual cloud network (VCN) and subnets</span> <p>Jenkins runs on a virtual machine (VM) Compute instance that鈥檚 deployed in a VCN that you can segment into subnets. Jenkins is hosted on regional public subnet A, and Container Engine for Kubernetes is deployed in regional public subnet B.</p> </li> <li><span class="bold">Compute instance</span> <p>Jenkins is deployed to a Compute instance VM. The Container Engine for Kubernetes cluster also runs its nodes on Compute instances.</p> </li> <li><span class="bold">Container Engine for Kubernetes</span> <p>Container Engine for Kubernetes is a fully managed, scalable, and highly available service that you can use to deploy your containerized applications to the cloud. You specify the Compute resources that your applications require, and Container Engine for Kubernetes provisions them on <span>Oracle Cloud Infrastructure</span> in an existing tenancy. </p> </li> <li><span class="bold">Registry</span> <p>Registry is an Oracle-managed registry that enables you to simplify the development of production workflow. Registry makes it easy for you as a developer to store, share, and manage development artifacts like Docker images.</p> </li> <li><span class="bold">Jenkins</span> <p>Jenkins is an open source automation server that lets developers reliably build, test, and deploy software. Jenkins supports the master/agent mode, where the workload of building projects is delegated to multiple agent nodes by the master. A single Jenkins installation can host multiple projects or provide different environments for builds and tests.</p> </li> </ul> </div> </div> </div> <div class="sect2"><a id="GUID-DBFDDAAD-AFB5-4932-B1A3-DF854022FB16" name="GUID-DBFDDAAD-AFB5-4932-B1A3-DF854022FB16"></a><h3 id="OWLWD-GUID-DBFDDAAD-AFB5-4932-B1A3-DF854022FB16" class="sect3">Recommendations</h3> <div> <p>Your requirements might differ from the architecture described here. Use the following recommendations as a starting point.</p> <ul style="list-style-type: disc;" id="GUID-DBFDDAAD-AFB5-4932-B1A3-DF854022FB16__UL_WJM_C3N_NKB"> <li><span class="bold">Compute shapes</span><p>This architecture uses an Oracle Linux OS image with the VM.Standard2.1 shape to host both the Jenkins server and the Container Engine for Kubernetes cluster nodes. If your application needs more memory or cores, you can choose a different shape.</p> </li> <li><span class="bold">VCN</span><p>When you create a VCN, determine the number of CIDR blocks required and the size of each block based on the number of resources that you plan to attach to subnets in the VCN. Use CIDR blocks that are within the standard private IP address space.</p> <p>After you create a VCN, you can change, add, and remove its CIDR blocks.</p> <p>This architecture uses a public VCN to host Container Engine for Kubernetes. You can also use a private VCN. In that case, use a NAT gateway to give the cluster access over the public internet.</p> </li> <li><span class="bold">Jenkins</span><p>This architecture deploys Jenkins on a Compute instance. A Jenkins master node is used to build the CI/CD pipeline. If you have multiple pipelines to build and run in parallel, you can use a Jenkins agent node to develop more pipelines.</p> </li> <li><span class="bold">Container Engine for Kubernetes</span><p>This architecture deploys the Container Engine for Kubernetes cluster. The worker nodes are deployed on a VM.Standard2.1 Oracle Linux OS. This architecture uses three worker nodes in the cluster, but you can create up to 1000 nodes on each cluster.</p> </li> <li><span class="bold">Registry</span><p>This architecture deploys Registry as a <span class="italic">private</span> Docker registry for internal use. Docker images are pushed to and pulled from the Registry. You can also use Registry as a <span class="italic">public</span> Docker registry, enabling any user with internet access and knowledge of the appropriate URL to pull images from public repositories in Oracle Cloud. </p> </li> </ul> </div> </div> <div class="sect2"><a id="GUID-3C4AE98F-09A2-49B7-B893-3F3898B3E281" name="GUID-3C4AE98F-09A2-49B7-B893-3F3898B3E281"></a><h3 id="OWLWD-GUID-3C4AE98F-09A2-49B7-B893-3F3898B3E281" class="sect3">Considerations</h3> <div> <p></p> <ul style="list-style-type: disc;" id="GUID-3C4AE98F-09A2-49B7-B893-3F3898B3E281__UL_LQB_2Z4_NKB"> <li><span class="bold">Scalability</span><p>You can scale out your application by updating the number of worker nodes in the Container Engine for Kubernetes cluster, depending on the load. You can also scale in by reducing the number of worker nodes in the cluster. When you create a service on the cluster, you can create a load balancer to distribute traffic among the nodes assigned to that service. For Jenkins, you can use the Jenkins master node to create more agents for multiple pipelines.</p> </li> <li><span class="bold">Application availability</span><p>Fault domains provide the best resilience within a single availability domain. You can deploy Compute instances that perform the same tasks in multiple availability domains. This design removes a single point of failure by introducing redundancy.</p> </li> <li><span class="bold">Manageability</span><p>This architecture uses a sample web application that鈥檚 hosted on GitHub for source control. Registry is used in the build pipeline to store the Docker build image for the application.</p> </li> <li><span class="bold">Security</span><p>Use policies to restrict who can access the <span>Oracle Cloud Infrastructure</span> resources that your company has and how. </p> <p>Container Engine for Kubernetes is integrated with <span>Oracle Cloud Infrastructure Identity and Access Management</span> (IAM), which provides easy authentication with native <span>Oracle Cloud Infrastructure</span> identity functionality. </p> </li> </ul> </div> </div> <div class="sect2"><a id="GUID-195273F1-8F61-42C2-A57A-B523F0812F7B" name="GUID-195273F1-8F61-42C2-A57A-B523F0812F7B"></a><h3 id="OWLWD-GUID-195273F1-8F61-42C2-A57A-B523F0812F7B" class="sect3">Deploy</h3> <div> <p>The code required to deploy this reference architecture is available in GitHub. You can pull the code into <span>Oracle Cloud Infrastructure Resource Manager</span> with a single click, create the stack, and deploy it. Alternatively, download the code from GitHub to your computer, customize the code, and deploy the architecture by using the Terraform CLI. </p> <div class="section"> <ul style="list-style-type: disc;" id="GUID-195273F1-8F61-42C2-A57A-B523F0812F7B__UL_UB5_JPW_F4B"> <li>Deploy by using <span>Oracle Cloud Infrastructure Resource Manager</span>: <ol id="GUID-195273F1-8F61-42C2-A57A-B523F0812F7B__OL_R3V_KPW_F4B"> <li>Click <a href="https://docs.oracle.com/pls/topic/lookup?ctx=en/solutions/cicd-pipeline&amp;id=github-oci-arch-ci-cd-zip" target="_blank"><img id="GUID-195273F1-8F61-42C2-A57A-B523F0812F7B__IMAGE_PLP_GXC_5NB" src="img/deploy-oracle-cloud-button-png.png" height="29" width="202" alt="Deploy to Oracle Cloud" title="Deploy to Oracle Cloud"></a><p>If you aren't already signed in, enter the tenancy and user credentials.</p> </li> <li>Review and accept the terms and conditions.</li> <li>Select the region where you want to deploy the stack.</li> <li>Follow the on-screen prompts and instructions to create the stack.</li> <li>After creating the stack, click <span class="uicontrol bold">Terraform Actions</span>, and select <span class="uicontrol bold">Plan</span>. </li> <li>Wait for the job to be completed, and review the plan. <p>To make any changes, return to the Stack Details page, click <span class="uicontrol bold">Edit Stack</span>, and make the required changes. Then, run the <span class="uicontrol bold">Plan</span> action again. </p> </li> <li>If no further changes are necessary, return to the Stack Details page, click <span class="uicontrol bold">Terraform Actions</span>, and select <span class="uicontrol bold">Apply</span>. </li> </ol> </li> <li>Deploy by using the Terraform CLI: <ol id="GUID-195273F1-8F61-42C2-A57A-B523F0812F7B__OL_LJC_KPW_F4B"> <li>Go to <a href="https://docs.oracle.com/pls/topic/lookup?ctx=en/solutions/cicd-pipeline&amp;id=github-oci-arch-ci-cd" target="_blank">GitHub</a>. </li> <li>Download or clone the code to your local computer.</li> <li>Follow the instructions in <code>README.md</code>. </li> </ol> </li> </ul> </div> <!-- class="section" --> </div> </div> <div class="sect2"><a id="GUID-F5A77F06-395B-4D46-B95E-71DB234C151A" name="GUID-F5A77F06-395B-4D46-B95E-71DB234C151A"></a><h3 id="OWLWD-GUID-F5A77F06-395B-4D46-B95E-71DB234C151A" class="sect3">Explore More</h3> <div> <p>Learn more about deploying containerized applications on Kubernetes in the cloud.</p> <ul style="list-style-type: disc;" id="GUID-F5A77F06-395B-4D46-B95E-71DB234C151A__UL_Z3J_BDN_RKB"> <li><a href="https://docs.oracle.com/pls/topic/lookup?ctx=en/solutions/cicd-pipeline&amp;id=oci-oke" target="_blank">Overview of Container Engine for Kubernetes</a></li> <li><a href="https://docs.oracle.com/pls/topic/lookup?ctx=en/solutions/cicd-pipeline&amp;id=oci-registry" target="_blank">Overview of Registry</a></li> <li><a href="https://docs.oracle.com/pls/topic/lookup?ctx=en/solutions/cicd-pipeline&amp;id=GVVGQ" target="_blank"><span><cite>Best practices framework for Oracle Cloud Infrastructure</cite></span></a></li> <li><a href="https://docs.oracle.com/pls/topic/lookup?ctx=en/solutions/cicd-pipeline&amp;id=github-oci-arch-ci-cd" target="_blank">terraform-oci-arch-ci-cd </a> on Github </li> <li><a href="https://docs.oracle.com/pls/topic/lookup?ctx=en/solutions/cicd-pipeline&amp;id=jenkins-plugin" target="_blank">Jenkins Plugins for OCI </a></li> <li><a href="https://docs.oracle.com/pls/topic/lookup?ctx=en/solutions/cicd-pipeline&amp;id=details-scm-image" target="_blank">Oracle Cloud Infrastructure Documentation Images</a></li> <li><a href="https://docs.oracle.com/pls/topic/lookup?ctx=en/solutions/cicd-pipeline&amp;id=github-oci-jenkins" target="_blank">oracle-quickstart / oci-jenkins on Github (module for deploying just Jenkins components)</a></li> <li><a href="https://docs.oracle.com/pls/topic/lookup?ctx=en/solutions/cicd-pipeline&amp;id=maven-dep-mgmt" target="_blank">Maven Dependency Management </a></li> <li><a href="https://docs.oracle.com/pls/topic/lookup?ctx=en/solutions/cicd-pipeline&amp;id=jenkins-best-prac" target="_blank">Jenkins Pipeline Best Practices </a></li> </ul> </div> </div> <div class="sect2"><a id="GUID-90BDB3F5-D7AC-4833-9561-D08D9809ACEC" name="GUID-90BDB3F5-D7AC-4833-9561-D08D9809ACEC"></a><h3 id="OWLWD-GUID-90BDB3F5-D7AC-4833-9561-D08D9809ACEC" class="sect3">Change Log</h3> <div> <p>This log lists significant changes:</p> <table cellpadding="4" cellspacing="0" summary frame="hsides" border="1" rules="rows" id="GUID-90BDB3F5-D7AC-4833-9561-D08D9809ACEC__SIMPLETABLE_RM3_NHT_GMB" role="presentation"> <tr> <td valign="top" width="28%">January 6, 2021</td> <td valign="top" width="72%">Added instructions for deploying the architecture by using <span>Oracle Cloud Infrastructure Resource Manager</span>. </td> </tr> <tr> <td valign="top">August 5, 2022</td> <td valign="top">Added new content to Architecture topic. <p>Added new links to Explore More topic.</p> </td> </tr> </table> </div> </div> </div> </article> <div id="disclaimers" class="legal"> <div><a href="#copyright-information" role="button" data-toggle="collapse" aria-expanded="false" class="collapsed" aria-controls="copyright-information" id="copyright-information-btn">Title and Copyright Information</a></div> <div class="collapse" id="copyright-information" aria-expanded="false"> <p class="legal">Set up a CI/CD pipeline for cloud deployments with Jenkins</p> <p class="legal">F27100-07</p> <p class="date legal">August 2022</p> <p class="legal legal"><a href="/pls/topic/lookup?ctx=en/legal&amp;id=cpyr" target="_blank">Copyright&nbsp;&copy;&nbsp;</a>2020, 2022, Oracle&nbsp;and/or&nbsp;its&nbsp;affiliates.&nbsp; </p> </div> <div><a href="#oracle-accessibility" role="button" data-toggle="collapse" aria-expanded="false" class="collapsed" aria-controls="oracle-accessibility" id="oracle-accessibility-btn">Documentation Accessibility</a></div> <div class="collapse" id="oracle-accessibility" aria-expanded="false"> <div> <p class="legal">For information about Oracle's commitment to accessibility, visit the Oracle Accessibility Program website at <a href="https://docs.oracle.com/pls/topic/lookup?ctx=acc&amp;id=docacc" target="_blank"><code class="codeph">https://docs.oracle.com/pls/topic/lookup?ctx=acc&amp;id=docacc</code></a>. </p> <div class="section" id="GUID-0D7ACBE9-7047-4DBE-97AA-703FD2FFBE5A__GUID-D88DC1A6-B2C8-4B61-85D2-23B0215F1664"> <p class="subhead1 legal" id="GUID-0D7ACBE9-7047-4DBE-97AA-703FD2FFBE5A__GUID-C09CA7BE-D07E-4AA0-B42A-8D7427CA200B">Access to Oracle Support</p> <p class="legal">Oracle customers that have purchased support have access to electronic support through My Oracle Support. For information, visit <a href="https://docs.oracle.com/pls/topic/lookup?ctx=acc&amp;id=info" target="_blank"><code class="codeph">https://docs.oracle.com/pls/topic/lookup?ctx=acc&amp;id=info</code></a> or visit <a href="https://docs.oracle.com/pls/topic/lookup?ctx=acc&amp;id=trs" target="_blank"><code class="codeph">https://docs.oracle.com/pls/topic/lookup?ctx=acc&amp;id=trs</code></a> if you are hearing impaired. </p> </div> <!-- class="section" --> </div> </div> </div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10