DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
11 Monitoring and Observability Tools for 2023
Learn more
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. DevOps and CI/CD
  4. OpenShift Pipelines with Jenkins Blue Ocean

OpenShift Pipelines with Jenkins Blue Ocean

The Blue Ocean project was conceived to revisit the Jenkins user experience and redesign it to follow new trends of interacting with pipelines.

Siamak Sadeghianfar user avatar by
Siamak Sadeghianfar
·
Apr. 14, 17 · Tutorial
Like (4)
Save
Tweet
Share
8.75K Views

Join the DZone community and get the full member experience.

Join For Free

This article was originally posted on the OpenShift Blog at https://blog.openshift.com/openshift-pipelines-jenkins-blue-ocean.

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 have 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 the 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.

Jenkins Blue Ocean

The waiting is over and Jenkins Blue Ocean 1.0 has finally been released. Like you, we couldn’t wait to get our hands on it and in this blog, we show you 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 with 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

Build Configs

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.

Image title

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 credentials to log in to Jenkins. Clicking on the Open Blue Ocean button on the top takes you the new Jenkins user experience, Blue Ocean.

Image title

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 Cart Service docker image which is then deployed 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.

OpenShift Pipelines


Switch to the Jenkins Blue Ocean tab and notice that the pipeline is automatically created on Jenkins by OpenShift and is running.
Blue OceanBlue Ocean
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.

Jenkins Blue Ocean is the new user experience for Jenkins to provide more flexibility for building and interacting with CI/CD pipelines. Using an OpenShift certified Jenkins Docker image and S2I process for customizing Jenkins, Blue Ocean can easily be enabled in Jenkins on OpenShift. OpenShift Pipeline, which allows developers to define a Jenkins pipeline for execution by Jenkins server while it is started, monitored, and managed by OpenShift, works out-of-the-box with Jenkins Blue Ocean and enables developers to combine the new user experience of Blue Ocean with ease-of-use and manageability of OpenShift Pipelines.


Jenkins (software) Pipeline (software) OpenShift Continuous Integration/Deployment Docker (software)

Published at DZone with permission of Siamak Sadeghianfar, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • 11 Observability Tools You Should Know
  • DZone's Article Submission Guidelines
  • Unlocking the Power of Elasticsearch: A Comprehensive Guide to Complex Search Use Cases
  • OWASP Kubernetes Top 10

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: