By WalkingTree  June 02,  2021

Using Jenkins to implement CI-CD on OpenShift

Jenkins is a well-established tool used in CI/CD and DevOps implementations. Even though modern tools are being introduced, Jenkins can still do the job and be easily integrated with OpenShift as well. 

Firstly, start by deploying Jenkins. OpenShift provides a ready-to-use template to instantiate and run a containerized Jenkins. 

  • Start by creating a new OpenShift project, and name it Jenkins
  • Instantiate Jenkins in the project with the following command

oc new-app –name jenkins –template jenkins-ephemeral -p MEMORY_LIMIT=2048Mi

  • Lastly, you need to grant Jenkins an edit role in OpenShift projects where it will need to run and deploy

Once Jenkins is set up, you will need to configure which projects Jenkins is allowed to sync BuildConfig from. Open Jenkins UI console, go to Manage Jenkins > System Configuration > OpenShift Jenkins Sync, and set Namespace appropriately. 

Build and Deployment process implementation

OpenShift has different ways to manage the application build and deployment process, based on BuildConfigs there are different strategies, one of them is jenkinsPipelineStrategy. 

You can start by creating a ‘Jenkins Pipeline Strategy’ BuildConfig and create a YAML file to define a BuildConfig for the application’s backend application component. 

Jenkins Pipeline Strategy for OpenShift BuildConfig requires you to indicate the following –

  1. GitHub repository where it must search for Jenkinsfile 
  2. jenkinsFilePath – This is the path where Jenkins can find the file which shows what the pipeline needs to do. 

Read on to learn more about using the Jenkins pipeline for integrating CI/CD in an OpenShift framework.

Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.