Jenkins is one of the most popular open-source automation engines and it has been the leading CI engine used in most development projects. As more and more organizations adopt DevOps and Continuous Delivery, Jenkins has been getting more focus as a tool for building CI/CD pipelines which resulted in Jenkins 2.x bringing in Pipelines as a built-in feature and enable building complex CI/CD pipelines using the Groovy based pipeline DSL.
Despite the native pipeline support in Jenkins, the UI and user experience has been mostly intact and inherited from an earlier version which made visualization of pipelines somewhat technical and limiting. The Blue Ocean project was conceived to revisit Jenkins user experience and redesign it from the ground up to accommodate the new ways people build and interact with pipelines. The new UX features provide visualizations of CI/CD pipelines, an editor for creating pipelines, dashboard personalization, the ability to pinpoint issues, and native integration for Git repository branch and pull requests.
Waiting is over and Jenkins Blue Ocean 1.0 is finally released. Like you, we couldn’t wait to get our hands on it and in this blog we show how to use Blue Ocean with OpenShift Pipelines. OpenShift Pipeline allows developers to define a Jenkins pipeline for execution by Jenkins server and can be started, monitored, and managed by OpenShift in a single place with other build types (source code build, docker build, etc).
Deploying Blue Ocean on OpenShift
OpenShift provides a certified Jenkins docker image which a set of common plugins pre-configured on it. The provided Jenkins docker image supports Source-To-Image (S2I) builds in order to easily and without hassle be able to customize the Jenkins docker image with plugins, job definitions, global configurations, etc and produce a customized Jenkins docker image to be used within your projects.
The first step is to create a project and an S2I build to customize the Jenkins docker image and install the Blue Ocean plugin on it. All we need to do is to create a file called plugins.txt
which lists the Jenkins plugins we want to install in the root of a Git repository and point the S2I buildconfig to that Git repo. We have created an example of plugins.txt
and the buildconfig in this GitHub repository:
$ oc new-project ci
$ oc new-build jenkins:2~https://github.com/siamaksade/jenkins-blueocean.git \
--name=jenkins-blueocean
A build called jenkins-blueocean
is created and is running to produce our customized Jenkins docker image with the Blue Ocean plugin installed. You can see the logs as the build runs using OpenShift CLI or OpenShift Web Console:
$ oc logs -f bc/jenkins-blueocean
When the build completes, we can deploy our customized Jenkins docker image using the Jenkins templates available in OpenShift.
$ oc new-app jenkins-ephemeral \
-p NAMESPACE=ci \
-p JENKINS_IMAGE_STREAM_TAG=jenkins-blueocean:latest \
-p MEMORY_LIMIT=2Gi
After a few seconds, the customized Jenkins docker image gets deployed in the ci
project.
Click on Jenkins route URL and open it in a new tab. The Jenkin docker image in OpenShift is integrated into OpenShift OAuth authentication and therefore you can simply use your OpenShift credential to login to Jenkins. Clicking on the Open Blue Ocean button on the top, takes you the new Jenkins user experience, Blue Ocean.
Create an OpenShift Pipeline
We will use a Spring Boot application in this blog post which is called Cart Service. Cart Service is a microservice that provides shopping cart services via REST API.
Let’s deploy the Cart Service on OpenShift using Red Hat’s officially supported OpenJDK S2I image:
$ oc create -f https://raw.githubusercontent.com/jboss-openshift/application-templates/master/jboss-image-streams.json
$ oc process -f https://raw.githubusercontent.com/siamaksade/cart-service/master/openshift/cart-template.yaml -v IMAGE_STREAM_NAMESPACE=ci | oc create -f -
The above commands create the build and deployment objects required to build and package the Cart Service as a JAR artifact using OpenShift S2I and build a docker image by layering the JAR file on an OpenJDK docker image. The result is a the Cart Service docker image which is deployed then as a container on OpenShift.
After the build and deployment are complete, you can verify the service is running using curl or pointing your browser to one of the REST API endpoints:
$ curl http://cart-ci.your-openshift-domain/api/cart/FOO
{"cartItemTotal":0.0,"cartItemPromoSavings":0.0,"shippingTotal":0.0,"shippingPromoSavings":0.0,"cartTotal":0.0,"shoppingCartItemList":[]}
The Cart Service GitHub repository also includes a Jenkinsfile which defines a CI/CD pipeline using the Jenkins Pipeline DSL. We create an OpenShift Pipeline that references this Jenkinsfile and uses it as the pipeline definition.
$ oc create -f https://raw.githubusercontent.com/siamaksade/cart-service/master/openshift/cart-pipeline.yaml
We can start the pipeline by clicking on the Start Pipeline button under Builds → Pipelines. OpenShift creates an instance of the pipeline using the Jenkinsfile in the aforementioned GitHub repository and starts running it on Jenkins.
Switch to Jenkins Blue Ocean tab and notice that the pipeline is automatically created on Jenkins by Openshift and is running.
Any change in the pipeline definition in OpenShift automatically updates Jenkins and vice versa. You can also use the Blue Ocean Pipeline Editor, Pull-Request and Branch builds and other goodies that come with Blue Ocean together with OpenShift Pipelines.
Summary
Jenkins Blue Ocean is the new user experience for Jenkins to provide more flexibility for building and interacting with CI/CD pipelines. Using OpenShift certified Jenkins docker image and S2I process for customizing Jenkins, Blue Ocean can easily be enabled on Jenkins on OpenShift. OpenShift Pipeline which allow developers to define a Jenkins pipeline for execution by Jenkins server while it is started, monitored, and managed by OpenShift, work out-of-the-box with Jenkins Blue Ocean and enable developers to combine the new user experience of Blue Ocean with ease-of-use and manageability of OpenShift Pipelines.
About the author
Browse by channel
Automation
The latest on IT automation for tech, teams, and environments
Artificial intelligence
Updates on the platforms that free customers to run AI workloads anywhere
Open hybrid cloud
Explore how we build a more flexible future with hybrid cloud
Security
The latest on how we reduce risks across environments and technologies
Edge computing
Updates on the platforms that simplify operations at the edge
Infrastructure
The latest on the world’s leading enterprise Linux platform
Applications
Inside our solutions to the toughest application challenges
Original shows
Entertaining stories from the makers and leaders in enterprise tech
Products
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Cloud services
- See all products
Tools
- Training and certification
- My account
- Customer support
- Developer resources
- Find a partner
- Red Hat Ecosystem Catalog
- Red Hat value calculator
- Documentation
Try, buy, & sell
Communicate
About Red Hat
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
Select a language
Red Hat legal and privacy links
- About Red Hat
- Jobs
- Events
- Locations
- Contact Red Hat
- Red Hat Blog
- Diversity, equity, and inclusion
- Cool Stuff Store
- Red Hat Summit