Skip to content

CICD demo using OpenShift PipeLine(CI) and ArgoCD(CD) in Red Hat OpenShift(RHOCP)

Notifications You must be signed in to change notification settings

anilabhabaral/hello-cicd-argocd-jboss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build and Deploy maven application into JBoss EAP 7.4 using Openshift PipeLine(CI) and ArgoCD(CD) in Red Hat OpenShift(RHOCP)

In this project i used Openshift pipeline as a CI tool to build the maven project and image and used ArgoCD as a CD tool to deploy this "Hello World" maven application into JBoss EAP 7.4.

Note: The helloworld maven project is taken from the jboss-eap-quickstart project- https://github.com/jboss-developer/jboss-eap-quickstarts/tree/7.4.x

Pipeline (CI)

To create and run the openshift pipeline follow the below mentioned steps:

  1. Clone this repo $ git clone https://github.com/anilabhabaral/hello-cicd-argocd-jboss.git
  2. Login to Openshift cluster $ oc login --token=<TOKEN> --server=<SERVER_URL>
  3. Create new project/namespace in Openshift cluster $ oc new-project testpipeline
  4. Install Red Hat OpenShift Pipelines from Operators --> Operator Hub
  5. Run the following command to see the pipeline service account $ oc get serviceaccount pipeline
  6. Create the tasks $ oc apply -f .infra/tasks/.
  7. List the tasks $ tkn task ls
  8. Create pipeline $ oc apply -f .infra/pipeline/pipeline.yaml
  9. List the available pipeline $ oc get pipeline
  10. Run Pipeline $ tkn pipeline start new-pipeline -w name=workspace-test,volumeClaimTemplateFile=https://raw.githubusercontent.com/anilabhabaral/hello-cicd-argocd-jboss/main/.infra/pipeline/pvc-anil.yaml --use-param-defaults
  11. Check pipelinerun result $ tkn pipelinerun ls
  12. Check whether the image of the new pipelinerun is pushed into internal image registry $ oc get is

ArgoCD(CD)

To deploy the the image build by the above pipeline i used Openshift GitOps operator(GitOps). Steps:

  1. Login to Openshift web console
  2. Go to Operators --> Operator Hub
  3. Search GitOps operator
  4. Install Openshift GitOps operator fig-1
  5. Click on the Red Hat OpenShift GitOps. It will show the below page: fig-2
  6. Click on + Create instance in ACD Argo CD
  7. It will open a Form view like below. In the Form view enter a Name and leave the other input box as default. fig-3
  8. After creating the instance, it can be viewed as below: fig-4
  9. Run $ oc get pod to see all the agrocd pods are ready or not:
$ oc get pod
NAME                                       READY   STATUS    RESTARTS   AGE
argocd-anil-application-controller-0       1/1     Running   0          9m35s
argocd-anil-dex-server-764d564bc8-8jx4f    1/1     Running   0          12m
argocd-anil-redis-59cf94479-mrnq2          1/1     Running   0          2m41s
argocd-anil-repo-server-58f84645b5-g94xz   1/1     Running   0          12m
argocd-anil-server-6c67d9659d-l4gkv        1/1     Running   0          12m
  1. Check the argocd route using $ oc get route:
$ oc get route
NAME                 HOST/PORT                                                                       PATH   SERVICES             PORT    TERMINATION            WILDCARD
argocd-anil-server   argocd-anil-server-testpipeline.apps.xxxxx.xxxxx.xxxx.xxxxxx.xxxxx.xxxx.xxxxx.com          argocd-anil-server   https   passthrough/Redirect   None
  1. Copy and past the route url of argocd in a browser, it will show the login page of argocd: fig-5
  2. Click on LOG IN VIA OPENSHIFT. It will redirect to the openshift login page. Use the required username and password to login to argocd using openshift login.
  3. ArgoCD home page: fig-6
  4. Click on + NEW APP
  5. It will open a Form view like below: fig-7
  6. Enter the details as below and click Create: fig-8 fig-9
  7. After creating all the deployment,service and route the argocd app will look: fig-11 fig-12
  8. Check the deployment created by argocd:
$ oc get deploy -n <NAMESPACE_NAME>
NAME                      READY   UP-TO-DATE   AVAILABLE   AGE
helloworld-deployment     1/1     1            1           47m 
  1. Check the service created by argocd:
$ oc get svc -n <NAMESPACE_NAME>
NAME                         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)             AGE
jboss-helloworld-service     ClusterIP   xxx.xx.xx.xx      <none>        8080/TCP            49m

  1. Check the route created by argocd:
$ oc get route  -n <NAMESPACE_NAME>
NAME                             HOST/PORT                                                                            PATH   SERVICES                   PORT    TERMINATION            WILDCARD
jboss-helloworld-service-route   jboss-helloworld-service-eap-test-02.apps.xxxx.xxxx.xxxx.xxxxx.xxxx.xxxx.xxxx.com          jboss-helloworld-service   8080                           None

  1. Access the application using following URL <ROUTE_URL>/helloworld in a browser: fig-13

About

CICD demo using OpenShift PipeLine(CI) and ArgoCD(CD) in Red Hat OpenShift(RHOCP)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published