# Part 4: Create CI CD Jobs in Jenkins

### **Create a <mark class="bg-yellow-200 dark:bg-yellow-500/30">fullstack CI</mark> pipeline**

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/842054ff-b285-4154-a8d6-c37d9e2dadc7.png align="center")

> ***The Jenkins Pipeline script you will get in my*** [***GitHub***](https://github.com/abhinandan-chougule/fullstack-gitops-project.git) ***—>*** [Jenkinsfile](https://github.com/abhinandan-chougule/fullstack-gitops-project/blob/main/Jenkinsfile)***, before putting the pipeline script in Jenkins, do the below steps:***

*   **Fork the** [**Repository**](https://github.com/abhinandan-chougule/fullstack-gitops-project.git)
    
*   **Go to** `Jenkinsfile`
    
*   **Make Sure you have forked and configured the shared library repository for** `jenkinsfile` **which uses** `groovy` **syntax.**
    
*   **Name the Jenkins slave node by** `Node` **only.**
    
*   **The SonarQube tool, which Jenkins will install, should be named as** `Sonar` **as per the pipeline script.**
    
*   **Make Sure you change the repository URL and branch as per your GitHub URL.**
    
*   **Change the image name and username.**
    

> Note- In terms of sucessful pipleine run we need to setup all customized parameters as per our environment variables

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/b0dfb8c9-a023-4506-983e-97493071ebbb.png align="center")

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/8c81e593-2dd1-4278-a71b-11c14ffc7171.png align="center")

*   In place of `fullstack-backend-beta`, Put the name of docker image that you want, and in place of `abhic25,` put your Dockerhub username so that it gets tagged with it.
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/c0a046b3-3021-46b6-baa9-22fff7644434.png align="center")

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/4a02f6f2-4e37-47cf-adc9-4a6323cb972e.png align="center")

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/ec53f169-e2ae-4d09-aa46-e12b5e2ac4fd.png align="center")

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/289b7036-6f5a-4cd4-84a8-01247b0ff80d.png align="center")

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/284beaf0-bf40-4031-94a6-2eb3d7379b3d.png align="center")

* * *

### Create one more pipeline <mark class="bg-yellow-200 dark:bg-yellow-500/30">fullstack-cd</mark>

*   The Jenkins Pipeline script you will get in my [GitHub](https://github.com/abhinandan-chougule/fullstack-gitops-project/tree/main/GitOps) —> GitOps → [Jenkinsfile](https://github.com/abhinandan-chougule/fullstack-gitops-project/blob/main/GitOps/Jenkinsfile), before putting the pipeline script in Jenkins, change all the customized parameters with respect to environments
    

Ex. What we did for the CI Job earlier

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/7d3170e2-f698-4757-8509-61af6b32e823.png align="center")

*   **Go to** `Kubernetes` **→ Change the username in** `backend.yaml` **and** `frontend.yaml` **as per your Dockerhub username.**
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/a53302f6-0861-4c35-aa4b-19a9dab2436e.png align="center")

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/7ffa00d5-f9a5-45ae-9cdb-b776a7bd0069.png align="center")

After all of this, Our Jobs are now ready **create one more pipeline, <mark class="bg-yellow-200 dark:bg-yellow-500/30">fullstack-CD</mark>**

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/486f1aa0-d3a8-4d57-8d9c-1dfd43fc5de0.png align="center")

*   Provide permission to docker socket so that Docker build and push commands do not fail (On the Jenkins Slave)
    
*   ```shell
    Sudo chmod 777 /var/run/docker.sock
    ```
    
*   ### Now Click on **<mark class="bg-yellow-200 dark:bg-yellow-500/30">fullstack</mark>**\-ci and build, and then when it gets completed, **<mark class="bg-yellow-200 dark:bg-yellow-500/30">fullstack</mark>**\-cd will automatically trigger and get built.
    
*   > Note- We have provide new Tag in ci job each time so CD will detect cahnge in Image and copletes job sucessfully
    
*   ![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/2fb98bf4-1b3e-4e80-bbbf-635b586e219f.png align="center")
    
*   **CI Job**
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/bed94f22-20b2-4e8d-8692-b92123031b28.png align="center")

*   **CD Job**
    

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/6478ac67-175d-4305-9eea-37e484567619.png align="center")

![](https://cdn.hashnode.com/uploads/covers/6997142f587b14d25b5231b7/2a7c7e65-0c74-4366-804c-922411e40ea1.png align="center")

Next...

* * *

<div data-node-type="callout">
<div data-node-type="callout-emoji">💡</div>
<div data-node-type="callout-text"><a target="_blank" rel="noopener noreferrer nofollow" class="text-primary underline underline-offset-2 hover:text-primary/80 cursor-pointer" href="https://hashnode.com/edit/cmmbuom77004x2eoacxwh32cn" style="pointer-events: none;">Part 5: Set up ArgoCD</a></div>
</div>
