From 12a7824b31a710f6057afd2a3433e6cbe804d64e Mon Sep 17 00:00:00 2001 From: ravdy <30906888+ravdy@users.noreply.github.com> Date: Tue, 16 Aug 2022 05:49:53 +0530 Subject: [PATCH 01/53] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c25a886..5ac99db 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,6 @@ Github URL: https://github.com/ravdy/nodejs.git Using simple "hello world" application from the [nodejs.org](https://nodejs.org/en/docs/guides/getting-started-guide/) website - ## On Jenkins GUI 1. Create the new FreeStyle Project From ca58efc1cf616cb412df2604036887f6f96018b5 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 14:59:26 +0530 Subject: [PATCH 02/53] Update Jenkinsfile UPDATE FILE --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 84530c2..4c68bb6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,8 @@ pipeline { stage('Install Dependencies') { steps { - sh 'npm install' + sh 'echo "install Dependencies"' + sh 'echo "${env.BRANCH_NAME}"' } } From 8eafe4c7724ceaed0fbe931b28253b63832b06e2 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:00:46 +0530 Subject: [PATCH 03/53] Update Jenkinsfile UPDATE JENKINS --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4c68bb6..0ec67d5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ pipeline { stage('Install Dependencies') { steps { sh 'echo "install Dependencies"' - sh 'echo "${env.BRANCH_NAME}"' + sh 'echo ${env.BRANCH_NAME}' } } From 9554a76b930b5c22e1d27bffb1e115fc4d6f4ccd Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:02:21 +0530 Subject: [PATCH 04/53] Update Jenkinsfile update jenkins --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 0ec67d5..8dedd58 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,6 +7,7 @@ pipeline { stage('Install Dependencies') { steps { sh 'echo "install Dependencies"' + SH 'echo ${BRANCH_NAME}' sh 'echo ${env.BRANCH_NAME}' } } From f76018e7a08cadd47b43bae834a1afce7f574859 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:03:02 +0530 Subject: [PATCH 05/53] Update Jenkinsfile update --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8dedd58..0f94f6e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ pipeline { stage('Install Dependencies') { steps { sh 'echo "install Dependencies"' - SH 'echo ${BRANCH_NAME}' + sh 'echo ${BRANCH_NAME}' sh 'echo ${env.BRANCH_NAME}' } } From 8479f159de120aec6bb8940329fad23dcb71db52 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:05:07 +0530 Subject: [PATCH 06/53] Update Jenkinsfile update --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0f94f6e..5d365a3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,8 +7,9 @@ pipeline { stage('Install Dependencies') { steps { sh 'echo "install Dependencies"' - sh 'echo ${BRANCH_NAME}' - sh 'echo ${env.BRANCH_NAME}' + script{ + echo "Current branch: ${env.BRANCH_NAME}" + } } } From a88753f2886885b766ef3132952f0032acb66e65 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:11:25 +0530 Subject: [PATCH 07/53] Update Jenkinsfile --- Jenkinsfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 5d365a3..47721ff 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,6 +12,12 @@ pipeline { } } } + // stage('Git Clone') { + // steps { + // // Git clone step + // git branch: '*/stage', credentialsId: 'git-hub', url: 'your-repo-url' + // } + // } stage('Test') { steps { From d1ef82f68c6ae7008c90d45ddd29ee3a7aa69e31 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:22:42 +0530 Subject: [PATCH 08/53] Update Jenkinsfile git url --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 47721ff..e003426 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,6 +9,7 @@ pipeline { sh 'echo "install Dependencies"' script{ echo "Current branch: ${env.BRANCH_NAME}" + echo "Git repo: ${env.GIT_URL}" } } } From e0b93f1918e78c1da2aef82cfebddce8f203fc9d Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:24:58 +0530 Subject: [PATCH 09/53] Update Jenkinsfile clone --- Jenkinsfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e003426..cc72248 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,12 +13,12 @@ pipeline { } } } - // stage('Git Clone') { - // steps { - // // Git clone step - // git branch: '*/stage', credentialsId: 'git-hub', url: 'your-repo-url' - // } - // } + stage('Git Clone') { + steps { + // Git clone step + git branch: '${env.BRANCH_NAME}', credentialsId: 'git-hub', url: '${env.GIT_URL}' + } + } stage('Test') { steps { From 22c504758f77e570f3c28e7d0f9617bfed4692a0 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:26:34 +0530 Subject: [PATCH 10/53] Update Jenkinsfile UPDATE --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index cc72248..2610e81 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { stage('Git Clone') { steps { // Git clone step - git branch: '${env.BRANCH_NAME}', credentialsId: 'git-hub', url: '${env.GIT_URL}' + git branch: ${env.BRANCH_NAME}, credentialsId: 'git-hub', url: ${env.GIT_URL} } } From 33491174d0b9768233fb15c24d3539f0d3f87832 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:28:40 +0530 Subject: [PATCH 11/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2610e81..0d2df31 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { stage('Git Clone') { steps { // Git clone step - git branch: ${env.BRANCH_NAME}, credentialsId: 'git-hub', url: ${env.GIT_URL} + git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" } } From 7c01013601df48a3e49add06b197a7a6cbca56c1 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:29:10 +0530 Subject: [PATCH 12/53] Update Jenkinsfile --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0d2df31..0f17514 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,9 @@ pipeline { stage('Git Clone') { steps { // Git clone step - git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" + script{ + git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" + } } } From 523c8a7aa8700892bf494ba96236c6c475bbb540 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:34:36 +0530 Subject: [PATCH 13/53] Update Jenkinsfile --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0f17514..0dfd46f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,9 @@ pipeline { steps { // Git clone step script{ - git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" + // git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" + git branch: 'dev', credentialsId: 'git-hub', url: 'https://github.com/ashirwad8858/test-nodejs-app-jenkins-pipline.git' + } } } From 7630e9b1f161d1c1bcb89ae3b3307ffff9adf3c9 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:36:52 +0530 Subject: [PATCH 14/53] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ac99db..805cec1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Build and Deploy nodejs application on EC2 instance - Freestyle +# QA Build and Deploy nodejs application on EC2 instance - Freestyle # Pre-requisites From a05dde608bcf31f5cf9c61273ce1f4639ad1eb21 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:38:09 +0530 Subject: [PATCH 15/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0dfd46f..9def1f5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { // Git clone step script{ // git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" - git branch: 'dev', credentialsId: 'git-hub', url: 'https://github.com/ashirwad8858/test-nodejs-app-jenkins-pipline.git' + git branch: '${env.BRANCH_NAME}', credentialsId: 'git-hub', url: 'https://github.com/ashirwad8858/test-nodejs-app-jenkins-pipline.git' } } From 5790b77a10d58eb4be5734f1a62769f47ad923f8 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:39:02 +0530 Subject: [PATCH 16/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9def1f5..48590cb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { // Git clone step script{ // git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" - git branch: '${env.BRANCH_NAME}', credentialsId: 'git-hub', url: 'https://github.com/ashirwad8858/test-nodejs-app-jenkins-pipline.git' + git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', url: 'https://github.com/ashirwad8858/test-nodejs-app-jenkins-pipline.git' } } From 12008720a44eb462d82673b852aa423396d59f6b Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:40:10 +0530 Subject: [PATCH 17/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 48590cb..f34435c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { // Git clone step script{ // git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" - git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', url: 'https://github.com/ashirwad8858/test-nodejs-app-jenkins-pipline.git' + git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" } } From c772f4461ea741bee7437baf97178efdc64763d1 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:47:11 +0530 Subject: [PATCH 18/53] Update Jenkinsfile done --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f34435c..c6897a1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { // Git clone step script{ // git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" - git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" + // git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "https://github.com/ashirwad8858/test-nodejs-app-jenkins-pipline.git" } } From 98f08ddd5393b214b669202b35ed75844effcc98 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:48:04 +0530 Subject: [PATCH 19/53] Update Jenkinsfile dsfsd --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c6897a1..64ec801 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { // Git clone step script{ // git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" - // git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "https://github.com/ashirwad8858/test-nodejs-app-jenkins-pipline.git" + git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: 'https://github.com/ashirwad8858/test-nodejs-app-jenkins-pipline.git' } } From f44467b11d73d2465fe659d4d92ac41106e7f8d4 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:51:31 +0530 Subject: [PATCH 20/53] Update Jenkinsfile ddd --- Jenkinsfile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 64ec801..813af24 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,17 +13,24 @@ pipeline { } } } - stage('Git Clone') { + stage('Checkout') { steps { - // Git clone step - script{ - // git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" - git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: 'https://github.com/ashirwad8858/test-nodejs-app-jenkins-pipline.git' - - } + // Automatically checks out the source code for the branch that triggered the build + checkout scm } } + // stage('Git Clone') { + // steps { + // // Git clone step + // script{ + // // git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: "${env.GIT_URL}" + // git branch: "${env.BRANCH_NAME}", credentialsId: 'git-hub', URL: 'https://github.com/ashirwad8858/test-nodejs-app-jenkins-pipline.git' + + // } + // } + // } + stage('Test') { steps { sh 'echo "testing application..."' From 8996b82db1488aed37e0f8b60a17595263574ff9 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:58:13 +0530 Subject: [PATCH 21/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 813af24..fe412c3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { } } - // stage('Git Clone') { + // stage('Git Clone') { // steps { // // Git clone step // script{ From ccc9635555cb83cf5829f4a8b8af39a406edfe12 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 18:06:43 +0530 Subject: [PATCH 22/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index fe412c3..79269af 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ pipeline { steps { sh 'echo "install Dependencies"' script{ - echo "Current branch: ${env.BRANCH_NAME}" + echo "Current branch: ${env.JOB_BASE_NAME}_${env.BRANCH_NAME}" echo "Git repo: ${env.GIT_URL}" } } From ef9ea5da317dbb91add3fad37192331ff264a59d Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 18:08:28 +0530 Subject: [PATCH 23/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 79269af..65eec52 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ pipeline { steps { sh 'echo "install Dependencies"' script{ - echo "Current branch: ${env.JOB_BASE_NAME}_${env.BRANCH_NAME}" + echo "Current branch: ${env.JOB_NAME}_${env.BRANCH_NAME}" echo "Git repo: ${env.GIT_URL}" } } From b38c8023b62a54211f7bd96c9755e27fd35c8959 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 18:12:50 +0530 Subject: [PATCH 24/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 65eec52..b8c2d12 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ pipeline { steps { sh 'echo "install Dependencies"' script{ - echo "Current branch: ${env.JOB_NAME}_${env.BRANCH_NAME}" + echo "Current branch: Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" } } From f2c1be0550a640dbc72946d820880780db2dcf23 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Wed, 21 Feb 2024 18:14:29 +0530 Subject: [PATCH 25/53] Create deploy.sh --- deploy.sh | 1 + 1 file changed, 1 insertion(+) create mode 100644 deploy.sh diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/deploy.sh @@ -0,0 +1 @@ + From 4724707020848abe473b02abd0dc8d0ec2f91c15 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:03:52 +0530 Subject: [PATCH 26/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b8c2d12..2152479 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { stage('Install Dependencies') { steps { - sh 'echo "install Dependencies"' + sh 'echo "install Dependencies ${env.GIT_URL} "' script{ echo "Current branch: Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" From d4bdba6c7fa321bce2dcf73600a453229ac9771c Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:08:04 +0530 Subject: [PATCH 27/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2152479..55bcc09 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { stage('Install Dependencies') { steps { - sh 'echo "install Dependencies ${env.GIT_URL} "' + sh 'echo ${env.GIT_URL} "install Dependencies ${env.GIT_URL} "' script{ echo "Current branch: Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" From e0970db93396ab8d65dc7f111f6c0402176fcf74 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:10:32 +0530 Subject: [PATCH 28/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 55bcc09..a956e7e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { stage('Install Dependencies') { steps { - sh 'echo ${env.GIT_URL} "install Dependencies ${env.GIT_URL} "' + sh 'echo "install Dependencies ${env.GIT_URL} "' script{ echo "Current branch: Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" From dec2aefcdb245c35707a46bba6132925842111f3 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:11:38 +0530 Subject: [PATCH 29/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a956e7e..3e5fd90 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { stage('Install Dependencies') { steps { - sh 'echo "install Dependencies ${env.GIT_URL} "' + sh 'echo "Install Dependencies ${GIT_URL}"' script{ echo "Current branch: Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" From 4dcfb6c905217fe640d8ec85bb11b5b7cdb4bea7 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:13:49 +0530 Subject: [PATCH 30/53] Update Jenkinsfile --- Jenkinsfile | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3e5fd90..fb82906 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,9 +38,21 @@ pipeline { } stage("Deploy application") { - steps { - sh 'echo "deploying application..."' - } + steps { + // Deploy step + script { + if (env.BRANCH_NAME == 'dev') { + // Deploy to dev server + sh 'echo "dev deploymebnt"' + } else if (env.BRANCH_NAME == 'qa') { + // Deploy to qa server + sh 'echo "qa deploymebnt"' + } else if (env.BRANCH_NAME == 'stage') { + // Deploy to stage server + sh 'echo "stage deploymebnt"' + } + } + } } From 6ac6cc9bb787085e3860626052acccd7b007d95f Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:17:50 +0530 Subject: [PATCH 31/53] Update Jenkinsfile --- Jenkinsfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index fb82906..1236a4c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,6 +36,14 @@ pipeline { sh 'echo "testing application..."' } } + stage('Docker Build') { + steps { + // Docker build step + script { + docker.build("your-image-name:${env.BRANCH_NAME}") + } + } + } stage("Deploy application") { steps { From f1f62d1a3d398b297b838a1f798def241624bc42 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:54:28 +0530 Subject: [PATCH 32/53] Update Jenkinsfile --- Jenkinsfile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1236a4c..b93607e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,22 @@ pipeline { agent any + environment{ + script { + if (env.BRANCH_NAME == 'dev') { + // Deploy to dev server + sh 'echo "dev deploymebnt"' + DEV_ENV = 'devserver_ip' + + } + } + } stages { stage('Install Dependencies') { steps { - sh 'echo "Install Dependencies ${GIT_URL}"' + sh 'echo "Install Dependencies ${DEV_ENV} ${GIT_URL}"' script{ echo "Current branch: Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" From 13d157c406787bacec4ec5ef97dd2ea93597f46b Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 12:31:48 +0530 Subject: [PATCH 33/53] Update Jenkinsfile --- Jenkinsfile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index b93607e..faa7768 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,6 +42,17 @@ pipeline { // } stage('Test') { + when { + branch 'dev' + } + steps { + sh 'echo "testing application..."' + } + } + stage('Test') { + when { + branch 'qa' + } steps { sh 'echo "testing application..."' } From 1415fdf288b02dedeac00660be1f2e95a306c4a5 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 12:33:05 +0530 Subject: [PATCH 34/53] Update Jenkinsfile --- Jenkinsfile | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index faa7768..c3cb636 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,14 +2,7 @@ pipeline { agent any environment{ - script { - if (env.BRANCH_NAME == 'dev') { - // Deploy to dev server - sh 'echo "dev deploymebnt"' - DEV_ENV = 'devserver_ip' - - } - } + DEV_ENV = 'devserver_ip' } stages { From 8b715663919b6469650de73f8fee4ae3541af075 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 12:33:49 +0530 Subject: [PATCH 35/53] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c3cb636..5f6fd14 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -34,7 +34,7 @@ pipeline { // } // } - stage('Test') { + stage('Test DEV') { when { branch 'dev' } @@ -42,7 +42,7 @@ pipeline { sh 'echo "testing application..."' } } - stage('Test') { + stage('Test QA') { when { branch 'qa' } From 1960a454897e36de8657cd66d727ae489bbf5d70 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:29:18 +0530 Subject: [PATCH 36/53] Update Jenkinsfile --- Jenkinsfile | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5f6fd14..4110f71 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,13 +3,14 @@ pipeline { agent any environment{ DEV_ENV = 'devserver_ip' + VAR = null } stages { stage('Install Dependencies') { steps { - sh 'echo "Install Dependencies ${DEV_ENV} ${GIT_URL}"' + sh 'echo "Install Dependencies ${VAR} ==>> ${DEV_ENV} ${GIT_URL}"' script{ echo "Current branch: Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" @@ -80,4 +81,31 @@ pipeline { } + options { + skipDefaultCheckout(true) + } + + stages { + stage('Set Environment') { + steps { + script { + def branchName = env.BRANCH_NAME + + if (branchName == 'dev') { + VAR = 'development' + //ENV = credentials('DEV_ENV') + } else if (branchName == 'qa') { + VAR = 'quality analyst' + //ENV = credentials('QA_ENV') + } else { + error "Branch not supported" + } + } + } + } + } + + + + } From 5a203719302babeea61ec634199addb9eeaaf950 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:31:34 +0530 Subject: [PATCH 37/53] Update Jenkinsfile --- Jenkinsfile | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4110f71..e71fa3c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,8 +5,28 @@ pipeline { DEV_ENV = 'devserver_ip' VAR = null } + options { + skipDefaultCheckout(true) + } stages { + stage('Set Environment') { + steps { + script { + def branchName = env.BRANCH_NAME + + if (branchName == 'dev') { + VAR = 'development' + //ENV = credentials('DEV_ENV') + } else if (branchName == 'qa') { + VAR = 'quality analyst' + //ENV = credentials('QA_ENV') + } else { + error "Branch not supported" + } + } + } + } stage('Install Dependencies') { steps { @@ -81,29 +101,9 @@ pipeline { } - options { - skipDefaultCheckout(true) - } - - stages { - stage('Set Environment') { - steps { - script { - def branchName = env.BRANCH_NAME + - if (branchName == 'dev') { - VAR = 'development' - //ENV = credentials('DEV_ENV') - } else if (branchName == 'qa') { - VAR = 'quality analyst' - //ENV = credentials('QA_ENV') - } else { - error "Branch not supported" - } - } - } - } - } + From 7b7815aa6d213c38e441541f343ba49e1fcc4518 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:34:54 +0530 Subject: [PATCH 38/53] Update Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e71fa3c..421e4eb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,8 +14,9 @@ pipeline { steps { script { def branchName = env.BRANCH_NAME - + sh "echo '${env.BRANCH_NAME}'" if (branchName == 'dev') { + sh "echo 'DEV==>'" VAR = 'development' //ENV = credentials('DEV_ENV') } else if (branchName == 'qa') { From 203049104f59e8b86cb1e201be314f2f5f78930d Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:36:28 +0530 Subject: [PATCH 39/53] Update Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 421e4eb..3e51b6c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,8 @@ pipeline { sh "echo '${env.BRANCH_NAME}'" if (branchName == 'dev') { sh "echo 'DEV==>'" - VAR = 'development' + VAR = 'development' + echo "var======> ${VAR} ${env.VAR}" //ENV = credentials('DEV_ENV') } else if (branchName == 'qa') { VAR = 'quality analyst' From a831c51af1d7ea197f6911446616e03302853b86 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:39:09 +0530 Subject: [PATCH 40/53] Update Jenkinsfile --- Jenkinsfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3e51b6c..2661cc0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,11 +18,13 @@ pipeline { if (branchName == 'dev') { sh "echo 'DEV==>'" VAR = 'development' - echo "var======> ${VAR} ${env.VAR}" + echo "var======> ${VAR}" //ENV = credentials('DEV_ENV') } else if (branchName == 'qa') { + sh "echo 'QA==>'" VAR = 'quality analyst' //ENV = credentials('QA_ENV') + echo "var======> ${VAR}" } else { error "Branch not supported" } @@ -32,7 +34,7 @@ pipeline { stage('Install Dependencies') { steps { - sh 'echo "Install Dependencies ${VAR} ==>> ${DEV_ENV} ${GIT_URL}"' + sh 'echo "Install Dependencies ${VAR} ${env.VAR} ==>> ${DEV_ENV} ${GIT_URL}"' script{ echo "Current branch: Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" From 46ec7b87fba12a294f0ef29b6f86cc171e1f7c25 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:40:02 +0530 Subject: [PATCH 41/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2661cc0..acc0cf4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -34,7 +34,7 @@ pipeline { stage('Install Dependencies') { steps { - sh 'echo "Install Dependencies ${VAR} ${env.VAR} ==>> ${DEV_ENV} ${GIT_URL}"' + sh 'echo "Install Dependencies ${VAR} ==>> ${DEV_ENV} ${GIT_URL}"' script{ echo "Current branch: Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" From 0e03c893f6896a200047dc80a313bd1bdac26617 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:45:01 +0530 Subject: [PATCH 42/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index acc0cf4..9ff6803 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,7 +36,7 @@ pipeline { steps { sh 'echo "Install Dependencies ${VAR} ==>> ${DEV_ENV} ${GIT_URL}"' script{ - echo "Current branch: Dunkins_${env.BRANCH_NAME}_env" + echo "Current branch: ${env.VAR} Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" } } From d1b89a5220eafb1a096e31f660da62eabc2c9981 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:51:44 +0530 Subject: [PATCH 43/53] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9ff6803..03f709c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,12 +17,12 @@ pipeline { sh "echo '${env.BRANCH_NAME}'" if (branchName == 'dev') { sh "echo 'DEV==>'" - VAR = 'development' + env.VAR = 'development' echo "var======> ${VAR}" //ENV = credentials('DEV_ENV') } else if (branchName == 'qa') { sh "echo 'QA==>'" - VAR = 'quality analyst' + env.VAR = 'quality analyst' //ENV = credentials('QA_ENV') echo "var======> ${VAR}" } else { From bbf86616b3e41f82cb1c3e7683c55d89c3ba7230 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:01:25 +0530 Subject: [PATCH 44/53] Update Jenkinsfile --- Jenkinsfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 03f709c..fdbe20d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,9 +1,10 @@ +def VAR = null pipeline { agent any environment{ DEV_ENV = 'devserver_ip' - VAR = null + // VAR = null } options { skipDefaultCheckout(true) @@ -17,12 +18,12 @@ pipeline { sh "echo '${env.BRANCH_NAME}'" if (branchName == 'dev') { sh "echo 'DEV==>'" - env.VAR = 'development' + VAR = 'development' echo "var======> ${VAR}" //ENV = credentials('DEV_ENV') } else if (branchName == 'qa') { sh "echo 'QA==>'" - env.VAR = 'quality analyst' + VAR = 'quality analyst' //ENV = credentials('QA_ENV') echo "var======> ${VAR}" } else { @@ -36,7 +37,7 @@ pipeline { steps { sh 'echo "Install Dependencies ${VAR} ==>> ${DEV_ENV} ${GIT_URL}"' script{ - echo "Current branch: ${env.VAR} Dunkins_${env.BRANCH_NAME}_env" + echo "Current branch: ${VAR} Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" } } From 09c5ab9adbea847a5a3c78881c388e13b09891e9 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:12:38 +0530 Subject: [PATCH 45/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index fdbe20d..4dd9bba 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,7 +35,7 @@ pipeline { stage('Install Dependencies') { steps { - sh 'echo "Install Dependencies ${VAR} ==>> ${DEV_ENV} ${GIT_URL}"' + sh 'echo "Install Dependencies ${env.VAR} ==>> ${DEV_ENV} ${GIT_URL}"' script{ echo "Current branch: ${VAR} Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" From 47d34d20ef878008f66d5734a9010ce21d03893c Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:13:49 +0530 Subject: [PATCH 46/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4dd9bba..9f72bd5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,7 +35,7 @@ pipeline { stage('Install Dependencies') { steps { - sh 'echo "Install Dependencies ${env.VAR} ==>> ${DEV_ENV} ${GIT_URL}"' + sh 'echo "Install Dependencies ${VAR} '${VAR}' ==>> ${DEV_ENV} ${GIT_URL}"' script{ echo "Current branch: ${VAR} Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" From a30cfcf6812f62aece14e1313e717580a089257e Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:14:32 +0530 Subject: [PATCH 47/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9f72bd5..fdbe20d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,7 +35,7 @@ pipeline { stage('Install Dependencies') { steps { - sh 'echo "Install Dependencies ${VAR} '${VAR}' ==>> ${DEV_ENV} ${GIT_URL}"' + sh 'echo "Install Dependencies ${VAR} ==>> ${DEV_ENV} ${GIT_URL}"' script{ echo "Current branch: ${VAR} Dunkins_${env.BRANCH_NAME}_env" echo "Git repo: ${env.GIT_URL}" From dd489af7c237651ad3f8ba1ae34cdab5fa2330fe Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:20:57 +0530 Subject: [PATCH 48/53] Update Jenkinsfile --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fdbe20d..28bdccf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,9 +6,9 @@ pipeline { DEV_ENV = 'devserver_ip' // VAR = null } - options { - skipDefaultCheckout(true) - } + // options { + // skipDefaultCheckout(true) + // } stages { stage('Set Environment') { From 0f7d1574003d1ec696025b495bf78689d9ec3521 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 16:07:36 +0530 Subject: [PATCH 49/53] Create dunkins-jenkinsfile --- dunkins-jenkinsfile | 67 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 dunkins-jenkinsfile diff --git a/dunkins-jenkinsfile b/dunkins-jenkinsfile new file mode 100644 index 0000000..17a3ef1 --- /dev/null +++ b/dunkins-jenkinsfile @@ -0,0 +1,67 @@ +pipeline { + agent any + environment { + ENV = credentials("300Moves_${env.BRANCH_NAME}_env") + Server_ip = credentials("300Moves_${env.BRANCH_NAME}_server_ip") + } + stages{ + stage("cleanup"){ + steps { + deleteDir() + } + } + stage ('Git clone'){ + steps{ + checkout scm + } + + } + stage('SonarQube Analysis') { + when { + branch 'dev' + } + steps { + script { + scannerHome = tool 'Zapbuildsonarqube' + } + withSonarQubeEnv('sonar-global') { + sh "${scannerHome}/bin/sonar-scanner \ + -D sonar.token=${SONAR_TOKEN} \ + -D sonar.projectKey=300moves-dev \ + -D sonar.sources=. \ + -D sonar.host.url=http://sonarqube.zapbuild.in:9000/" + } + } + post { + always { + script { + def sonarqubeUrl = env.getProperty('sonarqube_url_id') + + emailext subject: '[${JOB_NAME}] - Sonarqube Scanning', + body: "Sonarqube scanning has been completed successfully. Click [here](${sonarqubeUrl}=300moves-dev) to check status", + to: 'lalitmohan@zapbuild.com', + replyTo: 'pc@zapbuild.com', + from: "sonarqube@zapbuild.com" + } + } + } + } + + + + stage ("Build"){ + steps { + sh 'cp $ENV .' + sh 'zip -r website.zip .' + } + } + stage ("Deploy on DevServer"){ + steps{ + sh 'echo "Deployment"' + // sh 'scp website.zip deploy.sh jenkins@$Server_ip:/var/www/jenkindeploy/300moves/$ENV' + // sh 'ssh jenkins@$Server_ip "cd /var/www/jenkindeploy/300moves/$ENV && chmod 755 deploy.sh && sh deploy.sh"' + } + } + } + +} From 0f9da57c1f2c9097fcba48a44a72aaf25af5e0a7 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 18:23:29 +0530 Subject: [PATCH 50/53] Create Dockerfile --- Dockerfile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8bbc4e5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Use an official Node.js runtime as the base image +FROM node:14 + +# Set the working directory in the container +WORKDIR /usr/src/app + +# Copy package.json and package-lock.json (if available) to the working directory +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application code to the working directory +COPY . . + +# Expose the port the app runs on +EXPOSE 3000 + +# Command to run the application +CMD ["node", "server.js"] From 1ab5bdcbf90fdf4491f64c11f4a68782a9fd31c1 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 18:26:15 +0530 Subject: [PATCH 51/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 28bdccf..09a7c06 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -80,7 +80,7 @@ pipeline { steps { // Docker build step script { - docker.build("your-image-name:${env.BRANCH_NAME}") + app = docker.build("myapp:${env.BRANCH_NAME}") } } } From d69a00658002357323944b14d605e9d451c9ab63 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Fri, 23 Feb 2024 18:27:15 +0530 Subject: [PATCH 52/53] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 09a7c06..2909977 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -80,7 +80,7 @@ pipeline { steps { // Docker build step script { - app = docker.build("myapp:${env.BRANCH_NAME}") + app = docker.build("myapp:1") } } } From 27098c74968fa16ad5232a0ff82e466bfa90a341 Mon Sep 17 00:00:00 2001 From: ashirwad8858 <30556645+ashirwad8858@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:44:32 +0530 Subject: [PATCH 53/53] Create 300moves-jenkinsfile --- 300moves-jenkinsfile | 92 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 300moves-jenkinsfile diff --git a/300moves-jenkinsfile b/300moves-jenkinsfile new file mode 100644 index 0000000..b1cd8c1 --- /dev/null +++ b/300moves-jenkinsfile @@ -0,0 +1,92 @@ +pipeline { + agent any + environment { + ENV = credentials("300Moves_${env.BRANCH_NAME}_env") + Server_ip = credentials("300Moves_${env.BRANCH_NAME}_server_ip") + CREDENTIALS = credentials("gitlab-token") + } + stages{ + stage("cleanup"){ + steps { + deleteDir() + } + } + stage ('Git clone'){ + steps{ + checkout scm + } + + } + stage('SonarQube Analysis') { + when { + branch 'dev' + } + steps { + script { + scannerHome = tool 'Zapbuildsonarqube' + } + withSonarQubeEnv('sonar-global') { + sh "${scannerHome}/bin/sonar-scanner \ + -D sonar.token=${SONAR_TOKEN} \ + -D sonar.projectKey=300moves-dev \ + -D sonar.sources=. \ + -D sonar.host.url=http://sonarqube.zapbuild.in:9000/" + } + } + post { + always { + script { + def sonarqubeUrl = env.getProperty('sonarqube_url_id') + + emailext subject: '[${JOB_NAME}] - Sonarqube Scanning', + body: "Sonarqube scanning has been completed successfully. Click [here](${sonarqubeUrl}=300moves-dev) to check status", + to: 'lalitmohan@zapbuild.com', + replyTo: 'pc@zapbuild.com', + from: "sonarqube@zapbuild.com" + } + } + } + } + + + + stage ("Build"){ + when { + not { + branch 'master' + } + } + steps { + sh 'echo "300Moves_${BRANCH_NAME}_env"' + sh 'cp $ENV .' + sh 'zip -r website.zip .' + } + } + stage ("Deploy on DevServer"){ + steps{ + script{ + if (env.BRANCH_NAME == 'dev'){ + sh 'echo "dev server"' + sh 'scp website.zip deploy.sh jenkins@$Server_ip:/var/www/html/jenkindeploy/300moves/${BRANCH_NAME}' + sh 'ssh jenkins@$Server_ip "cd /var/www/html/jenkindeploy/300moves/${BRANCH_NAME} && chmod 755 deploy.sh && sh deploy.sh"' + } else if (env.BRANCH_NAME == 'qa') { + // Deploy to qa server + sh 'echo "qa deployment"' + sh 'scp website.zip deploy.sh jenkins@$Server_ip:/var/www/html/jenkindeploy/300moves/${BRANCH_NAME}' + sh 'ssh jenkins@$Server_ip "cd /var/www/html/jenkindeploy/300moves/${BRANCH_NAME} && chmod 755 deploy.sh && sh deploy.sh"' + } else if (env.BRANCH_NAME == 'master') { + // Deploy to stage server + sh 'echo "Live deploymebnt"' + sh 'ssh ubuntu@$Server_ip "cd /var/www/html/300moves/public_html/ && git pull https://${CREDENTIALS_USR}:${CREDENTIALS_PSW}@gitlab.zapbuild.com/zapbuild/cwvr.git master"' + sh 'scp ${ENV} ubuntu@$Server_ip:/var/www/html/300moves/public_html/' + sh 'ssh ubuntu@$Server_ip "cd /var/www/html/300moves/public_html/ && docker-compose up --build -d"' + } + } + //sh 'echo "Deployment"' + //sh 'scp website.zip deploy.sh jenkins@$Server_ip:/var/www/html/jenkindeploy/300moves/${BRANCH_NAME}' + //sh 'ssh jenkins@$Server_ip "cd /var/www/html/jenkindeploy/300moves/${BRANCH_NAME} && chmod 755 deploy.sh && sh deploy.sh"' + } + } + } + +}