Introduction to OpenShift Applications — Updating an Application Using OpenShift CLI and Using GitHub WebHooks

Adil Shehzad
4 min readJan 17, 2021

--

OpenShift Client Installation

Windows

  1. First Download the Following Client https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/
  2. UnZip it and placed the OC.exe file inside the folder
  3. Now we need to edit the Environment Variables

4. Open the CMD and check OpenShift CLI is installed or not. You can also Check using this command

"C:\OpenShift OC\oc.exe"OpenShift OC is my folder when i paste my oc.exe file

OpenShift Login

After Successfully Installation we need to Login into our Account

oc login <API LINK>

Creating Project Using OpenShift CLI

Make Sure you have Knowledge of git and GitHub because for Openshift Blogs i am skipping git and Github and more focusing on RedHat OpenShift

oc new-project <projectname>

Let's Check on OpenShift Console

Deploying Application Using GitHub

I created a branch name Update and merge the update branch to my main branch. So when I deploy my application to OpenShift I can see my changes.

This is the GitHub Repo I am using to update my OpenShift https://github.com/adilshehzad786/django-update

oc new-app version https://github.com/adilshehzad786/django-update.git --allow-missing-images

On OpenShift console

Still !! We have one Issue Our Routes are not available yet for this resource which means we cannot have a link to see that our application is deployed and access everyone via the link.

Get Service

oc get svc

Exposing Services

oc expose svc/django-update

Finally !!!

From GitHub Webhooks to OpenShift

Go to Your Repository Settings and after this go to webhooks

Click on Add WebHook

Go back to your OpenShift Console and then go to Builts Scroll down you will found your webhook GitHub Secret Codes

Finally !!!! We have another Version

Our Changes are updates lets have a look

Removing Lab

Go back to your OpenShift Console from where you can remove your project so Redhat Openshift will not charge you

Wrapping Up

In the blog, we successfully learn how to work with open shift Clients and also how to Deploy the application on Openshift and adding a workflow on open shift.

i hope you enjoy my blog please feel free to connect with me on

Linkedin

--

--

Adil Shehzad

DevOps Engineer - Author