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
cito deploy the Jenkins service to,Click the
+ Create Projectbutton,For
Nameenterci,For
DesriptionenterProject 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 Projectselectci,

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

Click
Closewhile 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
Logstab,
Or go to
Monitoringto 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,
$ git clone https://github.com/remkohdev/springclient.gitRun the Spring Client application,
$ cd springclient $ mvn clean install $ mvn spring-boot:runOpen a new console window, and test your application,
$ curl -X GET 'http://localhost:8080/api/hello?name=pluto'
Configure Jenkins
Add Maven,
Go to Jenkins > Manage Jenkins > Global Tools Configuration,
In the
Mavensection, clickMaven Installations,If no Maven installer is configured, click
Add Maven,Configure the
Nameto beM3, check the optionInstall automaticallyand 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
Generaltab, selectGithub Project,In the
Project urlenterhttps://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 scriptbox, paste the content of theJenkinsfileincluded in thespring-clientrepository, usingscripted pipelinesyntax, or select the ... option.Click
Save,Click
Build Now,
Last updated
Was this helpful?