Day 25 Task: Complete Jenkins CI/CD Project - Continued with Documentation

Day 25 Task: Complete Jenkins CI/CD Project - Continued with Documentation

A document for Setting Up a Jenkins Job for Your CI/CD Pipeline

🔶 Task-01: Complete the Jenkins CI/CD project from Day 24 and add documentation.

  • Document the process from cloning the repository to adding webhooks, Deployment, etc. as a README, go through this example

  • A well-written readme file will help others to understand your project and you will understand how to use the project again without any problems.

🔸 Creating a complete Jenkins CI/CD project with documentation is an extensive process that requires several steps:

  1. Introduction: Overview of the project and purpose of the documentation.
  • The project "node-todo-cicd" available on GitHub at the repository URL https://github.com/LondheShubham153/node-todo-cicd.git is a demonstration of a Node.js web application integrated with a CI/CD (Continuous Integration/Continuous Deployment) pipeline. The project showcases the automation of building, testing, and deploying a Node.js application using CI/CD principles.
  1. Prerequisites: List of prerequisites, including Jenkins installation and repository setup.
  • Open AWS Account and launch an instance.

  • Shh, it's in your terminal and installs Jenkins.

  • Install and configure Jenkins on your server or cloud platform by using the below steps.

    ```python #Step - 1 Install Java #Update your system sudo apt update

    #Install java sudo apt install openjdk-11-jre

    #Validate Installation java -version #It should look something like this #openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2) OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2, mixed mode, sharing)

    #Step - 2 Install Jenkins #Just copy these commands and paste them onto your terminal. curl -fsSL pkg.jenkins.io/debian-stable/jenkins.io-202.. | sudo tee \ /usr/share/keyrings/jenkins-keyring.asc > /dev/null echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \ pkg.jenkins.io/debian-stable binary/ | sudo tee \ /etc/apt/sources.list.d/jenkins.list > /dev/null

    sudo apt-get update sudo apt-get install jenkins

#Step -3 Start jenkins sudo systemctl enable jenkins sudo systemctl start jenkins sudo systemctl status jenkins

#Step - 4 Unlock jenkins

sudo cat /var/lib/jenkins/secrets/initialAdminPassword ```

  1. Jenkins Job Configuration: Step-by-step guide to creating the Jenkins job.
  • Create a new Jenkins job for your CI/CD pipeline.

  • Enter the name of the job and select the Jenkins Freestyle project for your app.

  • I Forked this https://github.com/LondheShubham153/node-todo-cicd.git repository.

  • Add the above repo to GitHub projects.

  • Install necessary plugins to install GitHub integration.

  • Add branch name.

  1. Source Code Integration: Explanation of how the repository is connected to Jenkins.
  • Connect Jenkins to your version control system (e.g., GitHub, GitLab).

  • GitHub repo navigates to settings > webhooks.

  • Click "Add Webhook"
    Enter the payload URL, followed by '/GitHub-webhook/'.
    Select the 'application/JSON'.
    Select the event that should trigger the webhook.

  • Save the webhook configuration.

  • where ever we change and commit the repo it gets a green tick on the webhook configuration.

  1. Build Stage Configuration: Details on setting up the build stage with the required tools.
  • Set up the build stage in your Jenkins job to compile and package your application.

  • In Execute shell add a command where Groovy syntax while writing the build script.

  • Ensure that the builds worked successfully.

  • Where ever we change the code from Git Hub, the webhook will trigger the Jenkins job and starts building automatically.

  1. Test Stage Configuration: Description of integrating automated tests.
  • Integrate automated testing in the Jenkins pipeline to ensure code quality.
  1. Deployment Configuration: Explanation of deploying the application.
  • Set up deployment to your target environment (e.g., staging, production).
  1. Troubleshooting: Common issues and solutions.

    Make sure in your security group inbound rule add Jenkins default port no. 8080 and application port no. 8000

  2. Conclusion: Wrap-up of the documentation and future improvements.

    By creating a new Jenkins job for your CI/CD pipeline, you automate the entire process from source code management to deployment, ensuring consistent and reliable software delivery. Jenkins orchestrates these steps based on triggers you define, providing a streamlined and efficient workflow for development and deployment.


Happy Learning:)

Stay in the loop with my latest insights and articles on cloud ☁️ and DevOps ♾️ by following me on Hashnode, LinkedIn (https://www.linkedin.com/in/chandreshpatle28/), and GitHub (https://github.com/Chandreshpatle28).

Thank you for reading! Your support means the world to me. Let's keep learning, growing, and making a positive impact in the tech world together.

#Git #Linux Devops #Devopscommunity #90daysofdevopschallenge #python #docker #Jenkins

Did you find this article valuable?

Support Chandresh Patle's Blog by becoming a sponsor. Any amount is appreciated!