Prerequisite for CICD Implementation For Oracle Integrations Cloud (OIC)

Richard Poon from Oracle gives an excellent article on setting up CICD in Oracle Integration Cloud Environment , however newbies like me may struggle to jump start with the blog. Hence I have tried compiling this pre-requisite to setup CICD. Once these steps are done we can use the scripts and Jenkins jobs from Richard.

Step 1:- Create Github account

Create a github account and create a repo in it.
copy the repo name featuring the ssh one, not the http one.
The Repo name shall look like :-
Will be used in Step 8.

Step 2:- Create an OCI (Oracle cloud) account or login to the existing one.

Step 3:- Spin up Source and Target Integration Instances

a) First go to :- Identity and Federation

  • Create a compartment :- oicCompartment
  • Create a group :- oci-integration-admins
  • Add user to the group.
  • Create a policy :- IntegrationGroupPolicy

allow group oci-integration-admins to manage integration-instance in compartment oicCompartment

b) Now go to :- Developer Services

  • Go to Integrations
  • Create Integration Instance.
  • Put a Display name :-
  • Choose Standard (For Demo Purpose) / Enterprise for Professional Purpose.
  • Anytime Standard can be made enterprise, so no worries.

Repeat the above process at least twice to create source and target OIC nodes.
Copy OIC Source Instance URL and paste in notepad++ or some editor.
Copy OIC Target Instance URL and paste in notepad++ or some editor.

You will need this during configuring jenkins jobs.

Step 4:- Creating VM for CICD :-

  • Go to Compute
  • Hit Create Instance.
  • Enter Name :- Example : devops001 | Choose Compartment
  • Save SSH Private Key to Login to the console.
  • Save the Public Key too.
  • Copy Public IP Address.
  • Login to terminal using : PuTTy / Mobaxterm
  • Use the SSH Key and user : opc

Once Logged in Linux Console :-
Open .bash_profile
add :-
export PS1='$(whoami)@$(hostname):$(pwd)>' to fix the prompt view
Now Login to root user using
sudo su -

Step 5:- Install Java in VM

execute : java -version
If -bash: java: command not found
This means Java is not present.

execute :-
yum -y update
This Update process may take some time. Around 10/15 minutes to complete may be.
Execute :- yum install java-1.8.0-openjdk
Verify using :- java -version
Get the java path :-
find /usr/lib/jvm/java-1.8* | head -n 3

Add JAVA_HOME to .bash_profile
export JAVA_HOME

exit and login again. Now
it will show the path

Step 6:- Install Jenkins

wget -O /etc/yum.repos.d/jenkins.repo
rpm --import
yum -y install jenkins
if you encounter slowness in this process you may do :-
ps -ef|grep yum and kill the process by kill -9 <PID>
then retry yum -y install jenkins command again.

Now start Jenkins :-
service jenkins start

Once started in Web browser open Jenkins.
URL :- http://<PUBLIC_IP_OF_INSTANCE&gt;:8080

However it wont start because the VM is not allowing traffic from 8080.
We need to open it.

Open firewall:-
sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp
sudo firewall-cmd --reload

Also we should add ingress rule in Default Security List for VCN:-

get initial jenkins password :-
cat /var/lib/jenkins/secrets/initialAdminPassword

go to admin user and setup the new password in Jenkins Web Console which is running on
http://<COMPUTE’s PUBLIC_IP>:8080.

now we will configure the jenkins user. The user details is in below file :-
grep jenkins /etc/passwd
jenkins:x:993:992:Jenkins Automation Server:/var/lib/jenkins:/bin/false
We will change the ‘/bin/false’ to ‘/bin/bash’ for this file.

Execute :
passwd jenkins
and enter password.

Lets login using jenkins user in linux.

Execute :
su -l jenkins
Execute :
vi .bash_profile
export PS1='$(whoami)@$(hostname):$(pwd)>'
save and exit the vi Editor.

Exit the jenkins linux user. We will comeback later.

Step 7:- Install / Update the git version

Enter the root user :-
sudo su -

Execute :
git --version
if version is not new then :-
Remove old version :-
yum remove git*

Else start installing git
Install new:-
yum -y install ttps://

Now check git --version

Step 8:- Connect Local repository to Remote Git Repository (Password less)

Login to jenkins user :-
su -l jenkins
Create SSH Key :-
ssh-keygen -t ed25519 -C "ENTER YOUR EMAIL HERE INSIDE QUOTES"
Start SSH Agent :-
eval ssh-agent -s
Add Key :-
ssh-add ~/.ssh/id_ed25519

Copy the Key to Notepad.

cd .ssh

Looks like :-
ssh-ed25519 <key> <email_id>

Login to Web account.

Go to Settings > SSH and GPG Keys >
Click New SSH Keys
Give a name. Ex: DevOps_Entry_Pass
Paste the key which you copied in Notepad.
Click Add Key.

Go Back to the Linux Console and Create two directory using Jenkins user.

mkdir cicd_demo cicd_scripts

full path : /var/lib/jenkins/cicd_demo
full path : /var/lib/jenkins/cicd_scripts

cicd_demo will be our local code repository.
cicd_scripts will be the directory where we will store the shell scripts which are to be used in Jenkins jobs.

now Execute :-
cd /var/lib/jenkins/cicd_demo

Initiate the Git repository:-

git init

connect remote repository (This you created in Step 1)to git repository.

git remote add origin<yourGitUserName>/<YourGitRepoName>

[Example : git remote add origin]

** Ensure your remote git repository branch name is master not main.

Copy your remote repo into the local directory.

git pull origin master
(press y)

Test Git push now :-

echo "Hello from server" > newfile.txt

git add .

git status

git commit -m "commiting from new server"

git push origin master

Now check your remote repoisitory in to see if the file you created is added or not.

Your local repo is ready.

Step 9:- Now lets get the scripts :-

cd /var/lib/jenkins/cicd_scripts




cd /var/lib/jenkins/jobs




Go to root user and restart jenkins.

service jenkins restart

Then login to the jenkins web console again. You will be able to see the jobs.

Install Jenkins Plugins :-

Manage Jenkins > Manage Plugins > Available
Search and Install without restart:-

Parameterized Trigger plugin
Delivery Pipeline plugin (version 1.3.2)
HTML Publisher plugin

Step 10:- Now You can Configure The Scripts , Jobs and Pipelines reading Richard’s awesome Blog.

How Jenkins Look After Implementing

CI Pipeline
CD Pipeline
Source Server
Target Server

Bonus Tips :-

Content of jenkins directory can be migrated from One VM to Another.
Turn off Jenkins in Source and Destination VM.
In Source VM:-
cd /var/lib/jenkins
zip -r . [-r zips the hidden too]
Switch to root user.
vi /etc/ssh/sshd_config
Make PasswordAuthentication yes
ChallengeResponseAuthentication yes
systemctl restart sshd

In Destination VM:-
cd /var/lib/jenkins
zip -r .
copy it in some directory for future reference.
Switch to root user.
vi /etc/ssh/sshd_config
Make PasswordAuthentication yes
ChallengeResponseAuthentication yes
systemctl restart sshd

Now Copy from Source to Destination VM:-

scp jenkins@<DESTINATION_PUBLIC IP>:/var/lib/jenkins/

Go to destination VM and unzip the file. Restart Jenkins in both the server and see.

Jenkins hosted from Source
Cloned Jenkins

Thanks for Reading.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.