CICD pipeline using Jenkins

































A typical CI/CD pipeline is linear and one-directional . It is composed of a few stages, or phases. The first phase is CI  [ Continuous Integration] . takes a commit from  SCM like GIT  and trigger  the build.

CI  consist of .  { Checkout , Compile , UNIT TEST , Package}
in case of containerized app  docker image creation , docker push  and docker tag also appended.

When all these steps are successful, a unique artifact is built, packaged, and published to a repository. This can be a JAR, .tar.gz file, a container image, or whatever is applicable to the chosen language and platform.

 CD part has 2 meanings  :- Continuous Delivery and Continuous Deployment

Continuous Delivery  :-  When and what to promote is a choice. Promotion typically happens when a build is considered to be “good enough”. QA has run their tests, the Product Owner has signed off, etc. This means that not all artifacts make it to production!

Continuous Deployment :-  Continuous Deployment gets rid of the manual gate and fully relies on automatic verification of the acceptance environment to determine whether the pipeline can continue on to production. 

Lets Set up CICD using GIT/Maven/Jenkins/docker

1. Set up environment :-
                  a. Install docker

for ubuntu use below link :-
         https://github.com/pardeep-virdi/docker-training/blob/master/docker-install-ubuntu.sh


                  b. install jenkins
       use below link for jenkins installations
            https://github.com/pardeep-virdi/CICD-demo/tree/master/demo-commands


2. CI
                  a.  Integrate docker with jenkins
                  b.  add docker credential in Jenkins










                  c. Create a groovy script for CICD maven build:-
  below is the sample groovy  file:-
  you need to change your  source code   git url in maven.  and  your dockerfile path  according to your  code
              https://github.com/pardeep-virdi/CICD-demo/blob/pipeline/groovy-code/mavenbuild.groovy



                  d.   Call that groovy script for jenkins pipeline job





add  your git branch where pipeline code exist.



enable    auto trigger of job on commit


                 e .    build the code , create a docker image and push to registry





                  








Comments