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 CICD setup

I have forked the repository, Let's start

Step1:

Step:2 Create a connection to our Jenkins job and our GitHub Repository via GitHub Integration

Step3:

Adding Jenkins Webhook in Github

  1. Open Github repository.

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

  3. Click the “Add webhook” button

Task-02

In the Execute shell run the application using Docker compose

Pipeline Script:

pipeline {
    agent any

    stages{
        stage('Code'){
            steps {
                git url: 'https://github.com/irfan7862000/node-todo-cicd.git', branch: 'master'
            }
        }
        stage('Build and Test'){
            steps {
                sh 'docker build . -t node-todo-app-cicd:latest' 
            }
        }


        stage('Deploy'){
            steps {
                sh 'docker-compose down && docker-compose up -d'
            }
        }

        stage('Successfully Deployed'){
            steps {
                echo "node-to-do app has been successfully deployed"
            }
        }   
    }
}

Now we will click on build now button and the result is Below

Output :

Output :

Thank you for Today!

Connect with me over linkedin:

https://www.linkedin.com/in/irfan-ansari-2934731a2/