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.
Sull'autore
Ricerca per canale
Automazione
Novità sull'automazione IT di tecnologie, team e ambienti
Intelligenza artificiale
Aggiornamenti sulle piattaforme che consentono alle aziende di eseguire carichi di lavoro IA ovunque
Hybrid cloud open source
Scopri come affrontare il futuro in modo più agile grazie al cloud ibrido
Sicurezza
Le ultime novità sulle nostre soluzioni per ridurre i rischi nelle tecnologie e negli ambienti
Edge computing
Aggiornamenti sulle piattaforme che semplificano l'operatività edge
Infrastruttura
Le ultime novità sulla piattaforma Linux aziendale leader a livello mondiale
Applicazioni
Approfondimenti sulle nostre soluzioni alle sfide applicative più difficili
Serie originali
Raccontiamo le interessanti storie di leader e creatori di tecnologie pensate per le aziende
Prodotti
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Servizi cloud
- Scopri tutti i prodotti
Strumenti
- Formazione e certificazioni
- Il mio account
- Supporto clienti
- Risorse per sviluppatori
- Trova un partner
- Red Hat Ecosystem Catalog
- Calcola il valore delle soluzioni Red Hat
- Documentazione
Prova, acquista, vendi
Comunica
- Contatta l'ufficio vendite
- Contatta l'assistenza clienti
- Contatta un esperto della formazione
- Social media
Informazioni su Red Hat
Red Hat è leader mondiale nella fornitura di soluzioni open source per le aziende, tra cui Linux, Kubernetes, container e soluzioni cloud. Le nostre soluzioni open source, rese sicure per un uso aziendale, consentono di operare su più piattaforme e ambienti, dal datacenter centrale all'edge della rete.
Seleziona la tua lingua
Red Hat legal and privacy links
- Informazioni su Red Hat
- Opportunità di lavoro
- Eventi
- Sedi
- Contattaci
- Blog di Red Hat
- Diversità, equità e inclusione
- Cool Stuff Store
- Red Hat Summit