Setup Jenkins on Openshift
Setup Jenkins on Openshift
From the IBM Cloud cluster dashboard, open the
OpenShift web console
,

Go to the
Service Catalog
,First we need to create a project named
ci
to deploy the Jenkins service to,Click the
+ Create Project
button,For
Name
enterci
,For
Desription
enterProject for Jenkins
,Click
Create
,

Go back to the
Service Catalog
,Search the catalog for
Jenkins (Ephemeral)
,Click the
Jenkins (Ephemeral)
service,

Note that the ephemeral version does not include persistent storage, so your data will be lost if the pod goes down, but for this tutorial it is easier to setup,
Click
Next
,

For
Add to Project
selectci
,

Click
Next
,Check the option
Do not bind at this time
,Click
Create
,

Click
Close
while Jenkins is being provisioned in ci,
Go to your project
ci
,Go to
Overview
, and wait until Jenkins has been provisioned,If provisioning fails the first time because of a timeout during pulling of images, simply deploy the service again,
To see the log for a deployment #1, go to Applicaitons > Deployments > Jenkins > #1,
Click the
Logs
tab,
Or go to
Monitoring
to see a detailed status,Open Jenkins in a new tab by clicking the Jenkins deployment URL, e.g. https://jenkins-ci1.cda-openshift-cluster-1c0e8bfb1c68214cf875a9ca7dd1e060-0001.us-south.containers.appdomain.cloud,
Click
Log in with OpenShift
,Clock
Allow selected permissions
,
Jenkins web will open,
[Optional] Run the Spring Boot Application on localhost,
Clone the source code of the Spring Client example,
Run the Spring Client application,
Open a new console window, and test your application,
Configure Jenkins
Add Maven,
Go to Jenkins > Manage Jenkins > Global Tools Configuration,
In the
Maven
section, clickMaven Installations
,If no Maven installer is configured, click
Add Maven
,Configure the
Name
to beM3
, check the optionInstall automatically
and select version3.6.2
,Click
Save
,
Note to Lab
In the Lab you will create a Multibranch Pipeline using the Blue Ocean editor. Alternatively, instead of using the Blue Ocean editor, you can create a pipeline using the regular Jenkins editor, here are the instructions:
Go to the Jenkins Dashboard,
Click
New Item
,Enter an item name:
spring-client
,Select
Pipeline
,Click
OK
,In the
General
tab, selectGithub Project
,In the
Project url
enterhttps://github.com/<username>/spring-client.git
,Under
Build Triggers
, select the option forGitHub hook trigger for GITScm polling
,Jenkins Pipeline supports two syntaxes, Declarative (introduced in Pipeline 2.5) and Scripted Pipeline,
Under
Pipeline
, in thePipeline script
box, paste the content of theJenkinsfile
included in thespring-client
repository, usingscripted pipeline
syntax, or select the ... option.Click
Save
,Click
Build Now
,
Last updated
Was this helpful?