Day 24 Task: Complete Jenkins CI/CD Project

Table of contents

🔹Task-01

  • Fork this repository:

  • Create a connection to your Jenkins job and your GitHub Repository via GitHub Integration.

    1. login into the Jenkins dashboard and click on "create new job" Enter the job/item name and select "freestyle project"

    2. Under Source Code Management, select Git and Added the repository URL (my forked repository).

    3. Enabled GitHub hook trigger for GITScm polling.

GitHub WebHooks and CI/CD Setup:

  1. Accessed my repository on GitHub.

  2. Went to "Settings" > "Webhooks".

  3. Added a new webhook with my Jenkins job's URL Selected events to trigger (e.g., push, pull request).

  4. Saved the webhook.

🔹Task 02:

Running the Application:

  1. Add the current user to the docker group:

     sudo usermod -aG docker $USER
     sudo reboot
    
  2. Add the Jenkins user to the docker group:

     sudo usermod -aG docker jenkins
     sudo systemctl restart jenkins
    
  3. Within the Jenkins job's "Execute shell" build step, navigated to the project's directory using cd.

  4. Ran the application using Docker Compose: docker-compose up -d.

    Saved the changes.

  5. do some changes in the project and commit changes.

  6. the pipeline is automatically triggered.

  7. I can access the application in my browser at the defined port (e.g., PublicIP:8000).