Complete Jenkins CI/CD Project

Complete Jenkins CI/CD Project

Task-01

  • Fork this repository.

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

    Read About GitHub WebHooks and make sure you have a CICD setup

    Refer to this video for the entire project

  1. Fork the repository:

  2. Login to Jenkins & click on create an item for a new job.

  3. Provide GitHub URL.

  4. Create ssh-keygen to connect Jenkins with GitHub.

    Create the SSH key & add rsa public key here as shown below:

    Configure the project: Add Jenkins credentials while adding Git URL like this (Jenkins privately connected with GitHub via SSH-key)

  5. Add Build Triggers for WebHook integration.

  6. Add Build Steps & select execute shell.

    Then apply & save the project.

  7. Also, install nodejs and npm as per the developer's guidelines in the README file:

    sudo apt install nodejs : as the project is for nodejs application.

    sudo apt install npm : npm is a package manager for nodejs.

    sudo npm install : install the nodejs app on the current server only.

    node app.js : shows the app running on which port mapping only for the current server.

  8. Now to automate this project via WebHook integration, download the GitHub integration plugin from manage plugins(available plugins).

    Add WebHook from the GitHub repository settings as shown below.

  9. WebHook is added to trigger the execution of Jenkins jobs based on GitHub events. If anyone in the developer team changes the code, it will automate the build now process like this.

    We can view the automated execution of Jenkins Job success.

  10. We can also see the docker container running in the command line at /var/lib/jenkins/workspace location.

Task-02

  • In the Execute shell run the application using Docker compose

    You will have to make a Docker Compose file for this Project (Can be a good open-source contribution)

    Run the project and give yourself a treat:)

Here with the continuation of the above task, we can run the same project using the docker-compose command.

  1. Uncheck the GitHub trigger for Gitscm polling in the Build trigger & save.

    Modify the forked GitHub repo's docker-compose.yaml file by changing the port mapping say 8001 for an external host

  2. Now again tick the GitHub trigger for GitScm polling &

    Put the docker compose commands in the execute shell as below

    Save the project.

  3. Now change the GitHub repository code, it will automatically trigger the Jenkins job to get the project functioning.

    Here at last we can view running the same project in different tasks.

For Reference and entire hands-on Project: check this Video


Thank you for your valuable time .

Keep upskilling yourself & Keep learning.