CI/CD Pipeline for Node JS Application

Task - 01

Step-1 Fork this repository:

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

    Step-2

    Adding Jenkins Webhook in Github

    1. Open Github repository.

    2. Go to “settings” and then to “hooks”.

    3. Click the “Add webhook” button.

    4. Fill in the form, as shown in the image below. For the payload URL, provide your Jenkins URL and the GitHub webhook path at the end of the URL — https://${jenkins_url}/github-webhook/. You can disable SSL verifications if you don’t have a valid SSL cert for your Jenkins server. Finally, choose the option “Calling the webhook only for push events.” (This actually depends on what you are trying to do. You can change this by selecting other options).

Step-3

  • Create AWS EC2 instance

    Jenkins Installation

    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 https://pkg.jenkins.io/debian/jenkins.io.key | sudo tee \   /usr/share/keyrings/jenkins-keyring.asc > /dev/null echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \   https://pkg.jenkins.io/debian binary/ | sudo tee \   /etc/apt/sources.list.d/jenkins.list > /dev/nullsudo apt-get update sudo apt-get install jenkins
    

    Step -3 Start jenkins

      sudo systemctl enable jenkins
    
      sudo systemctl start jenkins
    
      sudo systemctl status jenkins
    
      sudo cat /var/lib/jenkins/secrets/initialAdminPassword
    

    and copy your password

  • Open Jenkins in your browser through your local ip with port no. 8080 or if you are using AWS, use your AWS instance public ip with 8080 port no.

  • paste your pass in Administrator password

  • Click on Install Suggested Plugins

  • Create First Admin User

    Now your Jenkins is Ready to build your job

  • Step-3

    Copy your github repository url (code)

  • Now click on New Item and Create a job