피드 구독

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.


저자 소개

UI_Icon-Red_Hat-Close-A-Black-RGB

채널별 검색

automation icon

오토메이션

기술, 팀, 인프라를 위한 IT 자동화 최신 동향

AI icon

인공지능

고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트

open hybrid cloud icon

오픈 하이브리드 클라우드

하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요

security icon

보안

환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보

edge icon

엣지 컴퓨팅

엣지에서의 운영을 단순화하는 플랫폼 업데이트

Infrastructure icon

인프라

세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보

application development icon

애플리케이션

복잡한 애플리케이션에 대한 솔루션 더 보기

Original series icon

오리지널 쇼

엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리