From 1f11b52cd74a133af1796679535f85edd8a937f5 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 11:52:37 +0530 Subject: [PATCH 01/57] Create sonar.sh --- jenkins/sonar.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 jenkins/sonar.sh diff --git a/jenkins/sonar.sh b/jenkins/sonar.sh new file mode 100644 index 0000000..f60766d --- /dev/null +++ b/jenkins/sonar.sh @@ -0,0 +1,7 @@ +export SONAR_TOKEN=sqp_7c6df26ff26031fa62f4c57849b23896bb7291cc +export SONAR_SCANNER_VERSION=4.7.0.2747 +export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux +curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip +unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ +export PATH=$SONAR_SCANNER_HOME/bin:$PATH +export SONAR_SCANNER_OPTS="-server" From 49cfab12e5f2d6ffb1cd9eac3a92190894a43126 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 12:14:16 +0530 Subject: [PATCH 02/57] Update sonar.sh --- jenkins/sonar.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/jenkins/sonar.sh b/jenkins/sonar.sh index f60766d..50d577d 100644 --- a/jenkins/sonar.sh +++ b/jenkins/sonar.sh @@ -5,3 +5,4 @@ curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarso unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ export PATH=$SONAR_SCANNER_HOME/bin:$PATH export SONAR_SCANNER_OPTS="-server" +echo "sonar variables been set" From d5ac31a008eeffe04956951fa080f94b69dc29f6 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 12:28:57 +0530 Subject: [PATCH 03/57] Create sonar.js --- sonar.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 sonar.js diff --git a/sonar.js b/sonar.js new file mode 100644 index 0000000..10e4867 --- /dev/null +++ b/sonar.js @@ -0,0 +1,15 @@ +const scanner = require('sonarqube-scanner'); + +scanner( + { + serverUrl : 'http://localhost:9000/', + token : "sqp_7c6df26ff26031fa62f4c57849b23896bb7291cc", + options: { + 'sonar.projectName': 'TestProject', + 'sonar.projectDescription': 'Description for "My App" project...', + 'sonar.sources': '.', + 'sonar.tests': 'test' + } + }, + () => process.exit() +) From 2f500f0f510b32a080a13d838597ef2b9a44f96a Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 12:29:59 +0530 Subject: [PATCH 04/57] Update sonar.js --- sonar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar.js b/sonar.js index 10e4867..3250d86 100644 --- a/sonar.js +++ b/sonar.js @@ -8,7 +8,7 @@ scanner( 'sonar.projectName': 'TestProject', 'sonar.projectDescription': 'Description for "My App" project...', 'sonar.sources': '.', - 'sonar.tests': 'test' + 'sonar.language': 'js' } }, () => process.exit() From 93c3681de060acf1b282172075ce779d1db4ae04 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 12:35:06 +0530 Subject: [PATCH 05/57] Update package.json --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index ccd8219..34d336a 100644 --- a/package.json +++ b/package.json @@ -13,5 +13,8 @@ "dotenv": "^14.1.0", "ejs": "^3.1.6", "express": "^4.17.2" + }, + "devDependencies": { + "sonarqube-scanner": "^3.0.1" } } From 93b05ca6ac0fde22eecd0d7bade391a203aadd68 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 12:47:42 +0530 Subject: [PATCH 06/57] Delete sonar.js --- sonar.js | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 sonar.js diff --git a/sonar.js b/sonar.js deleted file mode 100644 index 3250d86..0000000 --- a/sonar.js +++ /dev/null @@ -1,15 +0,0 @@ -const scanner = require('sonarqube-scanner'); - -scanner( - { - serverUrl : 'http://localhost:9000/', - token : "sqp_7c6df26ff26031fa62f4c57849b23896bb7291cc", - options: { - 'sonar.projectName': 'TestProject', - 'sonar.projectDescription': 'Description for "My App" project...', - 'sonar.sources': '.', - 'sonar.language': 'js' - } - }, - () => process.exit() -) From ff977c921b9b7390c00813b5a8d8bd27baf0c323 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 12:48:17 +0530 Subject: [PATCH 07/57] Create sonar-project.js --- sonar-project.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 sonar-project.js diff --git a/sonar-project.js b/sonar-project.js new file mode 100644 index 0000000..3250d86 --- /dev/null +++ b/sonar-project.js @@ -0,0 +1,15 @@ +const scanner = require('sonarqube-scanner'); + +scanner( + { + serverUrl : 'http://localhost:9000/', + token : "sqp_7c6df26ff26031fa62f4c57849b23896bb7291cc", + options: { + 'sonar.projectName': 'TestProject', + 'sonar.projectDescription': 'Description for "My App" project...', + 'sonar.sources': '.', + 'sonar.language': 'js' + } + }, + () => process.exit() +) From ad1b85542e2375982fa74ca1fb67262ed1fe7aa4 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 12:49:05 +0530 Subject: [PATCH 08/57] Update sonar-project.js --- sonar-project.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.js b/sonar-project.js index 3250d86..51a401d 100644 --- a/sonar-project.js +++ b/sonar-project.js @@ -5,7 +5,7 @@ scanner( serverUrl : 'http://localhost:9000/', token : "sqp_7c6df26ff26031fa62f4c57849b23896bb7291cc", options: { - 'sonar.projectName': 'TestProject', + 'sonar.projectName': 'SonarProject', 'sonar.projectDescription': 'Description for "My App" project...', 'sonar.sources': '.', 'sonar.language': 'js' From cafe89424f3da90f137760b7174a407a7a665a2a Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 12:56:58 +0530 Subject: [PATCH 09/57] Update sonar-project.js --- sonar-project.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.js b/sonar-project.js index 51a401d..65d27e2 100644 --- a/sonar-project.js +++ b/sonar-project.js @@ -11,5 +11,5 @@ scanner( 'sonar.language': 'js' } }, - () => process.exit() + () => {} ) From 42b3dcfa17c3a8efaa09656d20a5658b389062c7 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 15:02:28 +0530 Subject: [PATCH 10/57] Update package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 34d336a..193789f 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "index.js", "scripts": { "start": "node index.js", + "sonar": "node sonar-project.js", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", From 26fea8e6ccba885b252779276ec9791cd9cb252a Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 15:26:38 +0530 Subject: [PATCH 11/57] Update sonar-project.js --- sonar-project.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.js b/sonar-project.js index 65d27e2..69710c5 100644 --- a/sonar-project.js +++ b/sonar-project.js @@ -5,7 +5,7 @@ scanner( serverUrl : 'http://localhost:9000/', token : "sqp_7c6df26ff26031fa62f4c57849b23896bb7291cc", options: { - 'sonar.projectName': 'SonarProject', + 'sonar.projectName': 'TestProject', 'sonar.projectDescription': 'Description for "My App" project...', 'sonar.sources': '.', 'sonar.language': 'js' From d831a46a726367d2e01967be2c46914071e73e9e Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 17:25:29 +0530 Subject: [PATCH 12/57] Added Jenkinsfile --- Jenkinsfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..26812d8 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,22 @@ +pipeline { + agent { + node { + label 'Node' + } + + } + stages { + stage('build') { + steps { + git(url: 'https://github.com/ecomlisters/nodejsSample/', branch: 'main') + } + } + + stage('install') { + steps { + npm 'npm install' + } + } + + } +} \ No newline at end of file From 5883e726ed0ac8036099652504e8da4ff72214fa Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 17:26:45 +0530 Subject: [PATCH 13/57] Added Jenkinsfile --- Jenkinsfile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 26812d8..e439f50 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,5 @@ pipeline { - agent { - node { - label 'Node' - } - - } + agent none stages { stage('build') { steps { From 7dec13a3e17ba5634a0236df24b28722d48652b2 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 17:42:36 +0530 Subject: [PATCH 14/57] Added Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e439f50..8f97b3e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,5 @@ pipeline { - agent none + agent any stages { stage('build') { steps { From 00fcaea704d08d9cd636bc963ad604b947bee1ce Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 17:52:19 +0530 Subject: [PATCH 15/57] Added Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8f97b3e..b798cb8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,9 +7,9 @@ pipeline { } } - stage('install') { + stage('inst') { steps { - npm 'npm install' + npm 'install' } } From c4333ab196f459c5b247855d8b2624254050d910 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sat, 29 Jul 2023 17:58:43 +0530 Subject: [PATCH 16/57] Update README.md From 06d330aabe60174404dc2e68f2563ece166dc192 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sun, 30 Jul 2023 13:20:48 +0530 Subject: [PATCH 17/57] Update Jenkinsfile --- Jenkinsfile | 51 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b798cb8..caaf052 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,17 +1,38 @@ -pipeline { - agent any - stages { - stage('build') { - steps { - git(url: 'https://github.com/ecomlisters/nodejsSample/', branch: 'main') - } - } - - stage('inst') { - steps { - npm 'install' - } - } +pipeline{ + agent any + environment { + BRANCH_NAME = "${GIT_BRANCH.split("/")[1]}" } -} \ No newline at end of file + + stages { + stage('Build') { + steps { + echo BRANCH_NAME + git branch: BRANCH_NAME, url: 'https://github.com/ecomlisters/nodejsSample' + } + } + stage('Install') { + steps { + npm 'install' + } + } + stage('Sonar'){ + when { + expression { + BRANCH_NAME == 'main' + } + } + steps{ + script{ + echo 'running Sonar stage ...' + } + } + } + stage('Deploy') { + steps { + echo 'Deploying....' + } + } + } +} From 7f3ac4d6e5629ce266197b61e54a25335f53de0b Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sun, 30 Jul 2023 13:27:19 +0530 Subject: [PATCH 18/57] Update Jenkinsfile --- Jenkinsfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index caaf052..b531b19 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,7 @@ pipeline{ environment { BRANCH_NAME = "${GIT_BRANCH.split("/")[1]}" - } + } stages { stage('Build') { @@ -34,5 +34,9 @@ pipeline{ echo 'Deploying....' } } + stage('Report'){ + publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: '', reportFiles: 'index.html', reportName: 'HTML Report', reportTitles: '', useWrapperFileDirectly: true]) + } + } } From 8a89fabd0b30191bc9fa0beba4a44b34514f1601 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sun, 30 Jul 2023 13:30:24 +0530 Subject: [PATCH 19/57] Update Jenkinsfile --- Jenkinsfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b531b19..472dc5a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,8 +35,16 @@ pipeline{ } } stage('Report'){ - publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: '', reportFiles: 'index.html', reportName: 'HTML Report', reportTitles: '', useWrapperFileDirectly: true]) + steps{ + publishHTML([allowMissing: false, + alwaysLinkToLastBuild: false, + keepAll: false, + reportDir: '', + reportFiles: 'index.html', + reportName: 'HTML Report', + reportTitles: '', + useWrapperFileDirectly: true]) + } } - } } From 16e7178037219f7aa8f8b86456b0123ce0fc6123 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sun, 30 Jul 2023 13:40:36 +0530 Subject: [PATCH 20/57] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 472dc5a..28e9cb3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,7 @@ pipeline{ stage('Report'){ steps{ publishHTML([allowMissing: false, - alwaysLinkToLastBuild: false, + alwaysLinkToLastBuild: true, keepAll: false, reportDir: '', reportFiles: 'index.html', From 7a149f609255bfd264f652c9d4e5958624268f78 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sun, 30 Jul 2023 13:49:36 +0530 Subject: [PATCH 21/57] Update Jenkinsfile --- Jenkinsfile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 28e9cb3..edf07a5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,14 +36,13 @@ pipeline{ } stage('Report'){ steps{ - publishHTML([allowMissing: false, - alwaysLinkToLastBuild: true, - keepAll: false, - reportDir: '', - reportFiles: 'index.html', - reportName: 'HTML Report', - reportTitles: '', - useWrapperFileDirectly: true]) + publishHTML (target : [allowMissing: false, + alwaysLinkToLastBuild: true, + keepAll: true, + reportDir: 'reports', + reportFiles: 'myreport.html', + reportName: 'My Reports', + reportTitles: 'The Report']) } } } From 021342411268834429579db90bbd7f5efc0ecaae Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sun, 30 Jul 2023 13:58:57 +0530 Subject: [PATCH 22/57] Update Jenkinsfile --- Jenkinsfile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index edf07a5..48baea1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,13 +36,7 @@ pipeline{ } stage('Report'){ steps{ - publishHTML (target : [allowMissing: false, - alwaysLinkToLastBuild: true, - keepAll: true, - reportDir: 'reports', - reportFiles: 'myreport.html', - reportName: 'My Reports', - reportTitles: 'The Report']) + cucumber buildStatus: 'null', customCssFiles: '', customJsFiles: '', failedFeaturesNumber: -1, failedScenariosNumber: -1, failedStepsNumber: -1, fileIncludePattern: '**/*.json', pendingStepsNumber: -1, reportTitle: 'App Report', skippedStepsNumber: -1, sortingMethod: 'ALPHABETICAL', undefinedStepsNumber: -1 } } } From a1e53dd1486338a36b98b0dccdb8ab671884b6ff Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sun, 30 Jul 2023 21:34:32 +0530 Subject: [PATCH 23/57] Update index.js --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 880e2a0..7ba00da 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,4 @@ +//entry point const express = require("express"); require("dotenv").config(); const app = express(); From ca7e81da0f397f2e19fca2a952c681d67be4ff8f Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Sun, 30 Jul 2023 21:35:23 +0530 Subject: [PATCH 24/57] Update index.js - testing --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 7ba00da..c521005 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -//entry point +//entry point for the app const express = require("express"); require("dotenv").config(); const app = express(); From 93a94ea150fef88145a54975cbee98c7ea11494d Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Mon, 31 Jul 2023 09:02:14 +0530 Subject: [PATCH 25/57] Create Jenkinsfile --- Jenkins/Jenkinsfile | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Jenkins/Jenkinsfile diff --git a/Jenkins/Jenkinsfile b/Jenkins/Jenkinsfile new file mode 100644 index 0000000..adad7f3 --- /dev/null +++ b/Jenkins/Jenkinsfile @@ -0,0 +1,10 @@ +node { + stage("Build"){ + def nodeContainer = docker.image('node:16') + nodeContainer.pull() + nodeContainer.inside{ + sh: 'npm install' + } + } + +} From 0a689a19d07ae32ed10adf3e417e6937a543190e Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Mon, 31 Jul 2023 09:08:53 +0530 Subject: [PATCH 26/57] Update Jenkinsfile - pipeline --- Jenkins/Jenkinsfile | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Jenkins/Jenkinsfile b/Jenkins/Jenkinsfile index adad7f3..576e865 100644 --- a/Jenkins/Jenkinsfile +++ b/Jenkins/Jenkinsfile @@ -1,10 +1,12 @@ -node { - stage("Build"){ - def nodeContainer = docker.image('node:16') - nodeContainer.pull() - nodeContainer.inside{ - sh: 'npm install' - } - } - +pipeline { + agent { + docker { image 'node:18.16.0-alpine' } + } + stages { + stage('Test') { + steps { + sh 'node --version' + } + } + } } From 55b26ad548a1f674a4338f5e941872ed4ab612ae Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Mon, 31 Jul 2023 09:10:18 +0530 Subject: [PATCH 27/57] Update Jenkinsfile --- Jenkins/Jenkinsfile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Jenkins/Jenkinsfile b/Jenkins/Jenkinsfile index 576e865..d6b77f9 100644 --- a/Jenkins/Jenkinsfile +++ b/Jenkins/Jenkinsfile @@ -1,11 +1,18 @@ pipeline { - agent { - docker { image 'node:18.16.0-alpine' } - } + agent any stages { - stage('Test') { + stage('Build') { + agent { + docker { + image 'gradle:8.2.0-jdk17-alpine' + // Run the container on the node specified at the + // top-level of the Pipeline, in the same workspace, + // rather than on a new node entirely: + reuseNode true + } + } steps { - sh 'node --version' + sh 'gradle --version' } } } From d7da8a9ff71bfe8a55ce6eabe848071d5a3a74be Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Mon, 31 Jul 2023 17:50:19 +0530 Subject: [PATCH 28/57] Update Jenkinsfile --- Jenkins/Jenkinsfile | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/Jenkins/Jenkinsfile b/Jenkins/Jenkinsfile index d6b77f9..5cb8c05 100644 --- a/Jenkins/Jenkinsfile +++ b/Jenkins/Jenkinsfile @@ -1,19 +1,16 @@ -pipeline { - agent any - stages { - stage('Build') { - agent { - docker { - image 'gradle:8.2.0-jdk17-alpine' - // Run the container on the node specified at the - // top-level of the Pipeline, in the same workspace, - // rather than on a new node entirely: - reuseNode true - } - } - steps { - sh 'gradle --version' - } - } - } -} +node { + def commit_id + stage('Preparation') { + checkout scm + sh "git rev-parse --short HEAD > .git/commit-id" + commit_id = readFile('.git/commit-id').trim() + } + stage('test') { + def myTestContainer = docker.image('node:16') + myTestContainer.pull() + myTestContainer.inside { + sh 'npm install' + sh 'npm test' + } + } +} From ce7a263a71e1865a1eb27df7d11e795d08318c1d Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Mon, 31 Jul 2023 18:36:12 +0530 Subject: [PATCH 29/57] Update Jenkinsfile --- Jenkins/Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkins/Jenkinsfile b/Jenkins/Jenkinsfile index 5cb8c05..f6dc7d4 100644 --- a/Jenkins/Jenkinsfile +++ b/Jenkins/Jenkinsfile @@ -12,5 +12,6 @@ node { sh 'npm install' sh 'npm test' } - } + } + } From 7f161e0fb6e7e67df4ad503a62bbf90145bd2db4 Mon Sep 17 00:00:00 2001 From: ecomlisters <105581856+ecomlisters@users.noreply.github.com> Date: Mon, 31 Jul 2023 18:59:57 +0530 Subject: [PATCH 30/57] Update Jenkinsfile --- Jenkins/Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkins/Jenkinsfile b/Jenkins/Jenkinsfile index f6dc7d4..d701b31 100644 --- a/Jenkins/Jenkinsfile +++ b/Jenkins/Jenkinsfile @@ -10,8 +10,10 @@ node { myTestContainer.pull() myTestContainer.inside { sh 'npm install' - sh 'npm test' } } + stage('Final'){ + echo 'Pipeline complete' + } } From 3f078d4ecf2a52b8c7935b717c583d0cb05d88f8 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 12:33:58 +0530 Subject: [PATCH 31/57] jenkins update --- Jenkinsfile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 48baea1..07c2af8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -34,10 +34,6 @@ pipeline{ echo 'Deploying....' } } - stage('Report'){ - steps{ - cucumber buildStatus: 'null', customCssFiles: '', customJsFiles: '', failedFeaturesNumber: -1, failedScenariosNumber: -1, failedStepsNumber: -1, fileIncludePattern: '**/*.json', pendingStepsNumber: -1, reportTitle: 'App Report', skippedStepsNumber: -1, sortingMethod: 'ALPHABETICAL', undefinedStepsNumber: -1 - } - } + } } From a8bbbd38c9fa33deae1e234ee2cceefd65d9a2b4 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 12:39:53 +0530 Subject: [PATCH 32/57] jenkins update --- Jenkinsfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 07c2af8..9825400 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,6 +13,9 @@ pipeline{ } } stage('Install') { + tools { + nodejs 'node16' + } steps { npm 'install' } From 22bda9ef66680b0c77aeaf9c1db661dba065d97c Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 12:42:44 +0530 Subject: [PATCH 33/57] jenkins update --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9825400..76ae7ec 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline{ nodejs 'node16' } steps { - npm 'install' + sh: 'npm install' } } stage('Sonar'){ From 7d972b3499de5290ddd9db20329f87ed068916e6 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 12:43:15 +0530 Subject: [PATCH 34/57] jenkins update --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 76ae7ec..d4f5767 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline{ nodejs 'node16' } steps { - sh: 'npm install' + sh 'npm install' } } stage('Sonar'){ From 3b89320d451d86729766ede1951bd17e86ccdd43 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 12:52:20 +0530 Subject: [PATCH 35/57] jenkins update --- Jenkinsfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index d4f5767..d97dd9c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,6 +30,15 @@ pipeline{ script{ echo 'running Sonar stage ...' } + + script { + // requires SonarQube Scanner 2.8+ + sonarqubeScannerHome = tool 'SonarQube Scanner 5.0' + + withCredentials([string(credentialsId: 'sonar', variable: 'sonarLogin')]) { + sh "${sonarqubeScannerHome}/bin/sonar-scanner -e -Dsonar.host.url=http://sonarqube:9000 -Dsonar.login=${sonarLogin} -Dsonar.projectName=gs-gradle -Dsonar.projectVersion=${env.BUILD_NUMBER} -Dsonar.projectKey=GS -Dsonar.sources=complete/src/main/ -Dsonar.tests=complete/src/test/ -Dsonar.language=java -Dsonar.java.binaries=." + } + } } stage('Deploy') { From 2b0971a642b05fd861c3cdb287f95a71879c5cf2 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 12:53:11 +0530 Subject: [PATCH 36/57] jenkins update --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d97dd9c..5452d0a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -34,7 +34,7 @@ pipeline{ script { // requires SonarQube Scanner 2.8+ sonarqubeScannerHome = tool 'SonarQube Scanner 5.0' - + } withCredentials([string(credentialsId: 'sonar', variable: 'sonarLogin')]) { sh "${sonarqubeScannerHome}/bin/sonar-scanner -e -Dsonar.host.url=http://sonarqube:9000 -Dsonar.login=${sonarLogin} -Dsonar.projectName=gs-gradle -Dsonar.projectVersion=${env.BUILD_NUMBER} -Dsonar.projectKey=GS -Dsonar.sources=complete/src/main/ -Dsonar.tests=complete/src/test/ -Dsonar.language=java -Dsonar.java.binaries=." } From c44244653109d14083923e80a2d69a4f268f4d06 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 12:54:12 +0530 Subject: [PATCH 37/57] sonar --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5452d0a..02123b0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,7 +33,7 @@ pipeline{ script { // requires SonarQube Scanner 2.8+ - sonarqubeScannerHome = tool 'SonarQube Scanner 5.0' + sonarqubeScannerHome = tool 'sonar' } withCredentials([string(credentialsId: 'sonar', variable: 'sonarLogin')]) { sh "${sonarqubeScannerHome}/bin/sonar-scanner -e -Dsonar.host.url=http://sonarqube:9000 -Dsonar.login=${sonarLogin} -Dsonar.projectName=gs-gradle -Dsonar.projectVersion=${env.BUILD_NUMBER} -Dsonar.projectKey=GS -Dsonar.sources=complete/src/main/ -Dsonar.tests=complete/src/test/ -Dsonar.language=java -Dsonar.java.binaries=." From b2bf0270fa0931a5f6f69e532a5866bf0aba9fdf Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 13:02:22 +0530 Subject: [PATCH 38/57] sonar --- Jenkinsfile | 17 ++++++++++------- sonar-project.properties | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 sonar-project.properties diff --git a/Jenkinsfile b/Jenkinsfile index 02123b0..13fe4e4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,14 +31,17 @@ pipeline{ echo 'running Sonar stage ...' } - script { - // requires SonarQube Scanner 2.8+ - sonarqubeScannerHome = tool 'sonar' - } - withCredentials([string(credentialsId: 'sonar', variable: 'sonarLogin')]) { - sh "${sonarqubeScannerHome}/bin/sonar-scanner -e -Dsonar.host.url=http://sonarqube:9000 -Dsonar.login=${sonarLogin} -Dsonar.projectName=gs-gradle -Dsonar.projectVersion=${env.BUILD_NUMBER} -Dsonar.projectKey=GS -Dsonar.sources=complete/src/main/ -Dsonar.tests=complete/src/test/ -Dsonar.language=java -Dsonar.java.binaries=." + script { + // requires SonarQube Scanner 2.8+ + sonarqubeScannerHome = tool 'sonar' + } + withSonarQubeEnv() { + sh "${sonarqubeScannerHome}/bin/sonar-scanner" } - + // withCredentials([string(credentialsId: 'sonar', variable: 'sonarLogin')]) { + // sh "${sonarqubeScannerHome}/bin/sonar-scanner -e -Dsonar.host.url=http://sonarqube:9000 -Dsonar.login=${sonarLogin} -Dsonar.projectName=gs-gradle -Dsonar.projectVersion=${env.BUILD_NUMBER} -Dsonar.projectKey=GS -Dsonar.sources=complete/src/main/ -Dsonar.tests=complete/src/test/ -Dsonar.language=java -Dsonar.java.binaries=." + // } + } } stage('Deploy') { diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..5aeeea7 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1 @@ +sonar.projectKey=nodejs \ No newline at end of file From 5272c0906c56c18eac27e6ce18862118d9dacf5f Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 13:03:10 +0530 Subject: [PATCH 39/57] sonar --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 13fe4e4..e01a5e9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,7 +35,7 @@ pipeline{ // requires SonarQube Scanner 2.8+ sonarqubeScannerHome = tool 'sonar' } - withSonarQubeEnv() { + withSonarQubeEnv('sonar') { sh "${sonarqubeScannerHome}/bin/sonar-scanner" } // withCredentials([string(credentialsId: 'sonar', variable: 'sonarLogin')]) { From 76cdd949042b44807ab26cef8916c6d586002f61 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 13:18:55 +0530 Subject: [PATCH 40/57] sonar --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e01a5e9..7a7899f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,7 +36,7 @@ pipeline{ sonarqubeScannerHome = tool 'sonar' } withSonarQubeEnv('sonar') { - sh "${sonarqubeScannerHome}/bin/sonar-scanner" + sh "${sonarqubeScannerHome}/bin/sonar-scanner -e -Dsonar.host.url=http://sonarqube:9000" } // withCredentials([string(credentialsId: 'sonar', variable: 'sonarLogin')]) { // sh "${sonarqubeScannerHome}/bin/sonar-scanner -e -Dsonar.host.url=http://sonarqube:9000 -Dsonar.login=${sonarLogin} -Dsonar.projectName=gs-gradle -Dsonar.projectVersion=${env.BUILD_NUMBER} -Dsonar.projectKey=GS -Dsonar.sources=complete/src/main/ -Dsonar.tests=complete/src/test/ -Dsonar.language=java -Dsonar.java.binaries=." From e8c33acf385a2cab5c8df9b8f22ef51e71bb676d Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 13:22:06 +0530 Subject: [PATCH 41/57] sonar nodejs --- Jenkinsfile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7a7899f..15a13d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,20 +29,18 @@ pipeline{ steps{ script{ echo 'running Sonar stage ...' - } - + } + tools { + nodejs 'node16' + } script { - // requires SonarQube Scanner 2.8+ - sonarqubeScannerHome = tool 'sonar' + sonarqubeScannerHome = tool 'sonar' } withSonarQubeEnv('sonar') { - sh "${sonarqubeScannerHome}/bin/sonar-scanner -e -Dsonar.host.url=http://sonarqube:9000" - } - // withCredentials([string(credentialsId: 'sonar', variable: 'sonarLogin')]) { - // sh "${sonarqubeScannerHome}/bin/sonar-scanner -e -Dsonar.host.url=http://sonarqube:9000 -Dsonar.login=${sonarLogin} -Dsonar.projectName=gs-gradle -Dsonar.projectVersion=${env.BUILD_NUMBER} -Dsonar.projectKey=GS -Dsonar.sources=complete/src/main/ -Dsonar.tests=complete/src/test/ -Dsonar.language=java -Dsonar.java.binaries=." - // } + sh "${sonarqubeScannerHome}/bin/sonar-scanner -e -Dsonar.host.url=http://sonarqube:9000" + } - } + } } stage('Deploy') { steps { From ecf927790137f3d6f97629a083632430d2294972 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 13:23:25 +0530 Subject: [PATCH 42/57] sonar nodejs --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 15a13d9..a78a611 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,13 +26,14 @@ pipeline{ BRANCH_NAME == 'main' } } + tools { + nodejs 'node16' + } steps{ script{ echo 'running Sonar stage ...' } - tools { - nodejs 'node16' - } + script { sonarqubeScannerHome = tool 'sonar' } From dae0ececd70c44664d461893d8259fb98ba6ef1a Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 13:31:28 +0530 Subject: [PATCH 43/57] sonar nodejs --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a78a611..18d6f54 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,7 +38,7 @@ pipeline{ sonarqubeScannerHome = tool 'sonar' } withSonarQubeEnv('sonar') { - sh "${sonarqubeScannerHome}/bin/sonar-scanner -e -Dsonar.host.url=http://sonarqube:9000" + sh "${sonarqubeScannerHome}/bin/sonar-scanner -e -Dsonar.host.url=http://sonarqube:9000 -Dsonar.qualitygate.wait=true" } } From 83cb7ed5151c16b61c931eb8ca5cfba4246079e0 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 13:43:23 +0530 Subject: [PATCH 44/57] sonar nodejs --- sonar-project.properties | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 5aeeea7..16bcc8e 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1 +1,12 @@ -sonar.projectKey=nodejs \ No newline at end of file +sonar.projectKey=nodejs +sonar.projectName=nodejsSample + +# we keep tests in magic directories within the main source tree +sonar.sources=. +sonar.tests=. +sonar.exclusions=**/__tests__/**,**/__fixtures__/**,*.properties +sonar.test.inclusions=**/__tests__/**,**/__fixtures__/** + +# restrict allowed global variables to only those we use +sonar.javascript.environments=node,jest + From 26a37236cb18bbdaaf916edb1bb766aed783bf37 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 13:58:19 +0530 Subject: [PATCH 45/57] project update --- sonar-project.js | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 sonar-project.js diff --git a/sonar-project.js b/sonar-project.js deleted file mode 100644 index 69710c5..0000000 --- a/sonar-project.js +++ /dev/null @@ -1,15 +0,0 @@ -const scanner = require('sonarqube-scanner'); - -scanner( - { - serverUrl : 'http://localhost:9000/', - token : "sqp_7c6df26ff26031fa62f4c57849b23896bb7291cc", - options: { - 'sonar.projectName': 'TestProject', - 'sonar.projectDescription': 'Description for "My App" project...', - 'sonar.sources': '.', - 'sonar.language': 'js' - } - }, - () => {} -) From c8c7e97c193a125152a82b9ca84fdd7b6a72a704 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 13:58:54 +0530 Subject: [PATCH 46/57] project update --- sonar-project.properties | 2 -- 1 file changed, 2 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index 16bcc8e..2c5060f 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,8 +2,6 @@ sonar.projectKey=nodejs sonar.projectName=nodejsSample # we keep tests in magic directories within the main source tree -sonar.sources=. -sonar.tests=. sonar.exclusions=**/__tests__/**,**/__fixtures__/**,*.properties sonar.test.inclusions=**/__tests__/**,**/__fixtures__/** From 4a884d048235bfa2e04d2f2068f8999fc91dec71 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 14:05:06 +0530 Subject: [PATCH 47/57] project update --- sonar-project.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sonar-project.properties b/sonar-project.properties index 2c5060f..ef4b048 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,6 +1,9 @@ sonar.projectKey=nodejs sonar.projectName=nodejsSample +sonar.scm.exclusions.disabled=true +sonar.sources=./ + # we keep tests in magic directories within the main source tree sonar.exclusions=**/__tests__/**,**/__fixtures__/**,*.properties sonar.test.inclusions=**/__tests__/**,**/__fixtures__/** From ce3d346d58a9bfd9ddae3b6dc7e339ffc4811153 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 15:26:25 +0530 Subject: [PATCH 48/57] project update --- sonar-project.properties | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index ef4b048..ca8cb2f 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,13 +1,10 @@ sonar.projectKey=nodejs sonar.projectName=nodejsSample -sonar.scm.exclusions.disabled=true -sonar.sources=./ - # we keep tests in magic directories within the main source tree sonar.exclusions=**/__tests__/**,**/__fixtures__/**,*.properties -sonar.test.inclusions=**/__tests__/**,**/__fixtures__/** +sonar.inclusions=public/** # restrict allowed global variables to only those we use -sonar.javascript.environments=node,jest +sonar.javascript.environments=node,jest,html From 41785f3afa7c3c535276452f4d4ebdbe717feee8 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 15:32:48 +0530 Subject: [PATCH 49/57] project update --- Jenkinsfile | 2 +- sonar-project.properties | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 18d6f54..167633c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,7 +38,7 @@ pipeline{ sonarqubeScannerHome = tool 'sonar' } withSonarQubeEnv('sonar') { - sh "${sonarqubeScannerHome}/bin/sonar-scanner -e -Dsonar.host.url=http://sonarqube:9000 -Dsonar.qualitygate.wait=true" + sh "${sonarqubeScannerHome}/bin/sonar-scanner -Dsonar.host.url=http://sonarqube:9000 -Dsonar.qualitygate.wait=true" } } diff --git a/sonar-project.properties b/sonar-project.properties index ca8cb2f..10b8ba5 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,9 +2,7 @@ sonar.projectKey=nodejs sonar.projectName=nodejsSample # we keep tests in magic directories within the main source tree -sonar.exclusions=**/__tests__/**,**/__fixtures__/**,*.properties -sonar.inclusions=public/** - +sonar.exclusions=*.properties # restrict allowed global variables to only those we use -sonar.javascript.environments=node,jest,html - +sonar.javascript.environments=node +sonar.javascript.file.suffixes=.js,.html From afa311478e8a0ed185e9266e2c1a363e192d8e81 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 15:35:01 +0530 Subject: [PATCH 50/57] project update --- sonar-project.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 10b8ba5..663039d 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -5,4 +5,3 @@ sonar.projectName=nodejsSample sonar.exclusions=*.properties # restrict allowed global variables to only those we use sonar.javascript.environments=node -sonar.javascript.file.suffixes=.js,.html From 9c926b3af43f76ec786a968d386648e6c9b4fe21 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 15:38:39 +0530 Subject: [PATCH 51/57] : From 9f75bc2a92f591fe9eba388658e5ccc6262e105e Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 15:40:38 +0530 Subject: [PATCH 52/57] fixing jenkins file --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 167633c..13c05c1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline{ agent any environment { - BRANCH_NAME = "${GIT_BRANCH.split("/")[1]}" + BRANCH_NAME = "${GIT_BRANCH}" } stages { From 1e413b5c26648922c657960710ca6fd0b0f7c51b Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 15:44:51 +0530 Subject: [PATCH 53/57] fixing jenkins file --- Jenkinsfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 13c05c1..ca1ecae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,17 +1,17 @@ pipeline{ agent any - environment { - BRANCH_NAME = "${GIT_BRANCH}" - } +// environment { +// BRANCH_NAME = "${GIT_BRANCH}" +// } stages { - stage('Build') { - steps { - echo BRANCH_NAME - git branch: BRANCH_NAME, url: 'https://github.com/ecomlisters/nodejsSample' - } - } + // stage('Build') { + // steps { + // echo BRANCH_NAME + // git branch: BRANCH_NAME, url: 'https://github.com/ecomlisters/nodejsSample' + // } + // } stage('Install') { tools { nodejs 'node16' From 7b46daa0518e934d90a91f9d7e1c802411485131 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 15:46:51 +0530 Subject: [PATCH 54/57] fixing jenkins file 1 --- Jenkinsfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ca1ecae..167633c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,17 +1,17 @@ pipeline{ agent any -// environment { -// BRANCH_NAME = "${GIT_BRANCH}" -// } + environment { + BRANCH_NAME = "${GIT_BRANCH.split("/")[1]}" + } stages { - // stage('Build') { - // steps { - // echo BRANCH_NAME - // git branch: BRANCH_NAME, url: 'https://github.com/ecomlisters/nodejsSample' - // } - // } + stage('Build') { + steps { + echo BRANCH_NAME + git branch: BRANCH_NAME, url: 'https://github.com/ecomlisters/nodejsSample' + } + } stage('Install') { tools { nodejs 'node16' From ee59132094ec63e0de1041bf7946fbc365cc63c7 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 15:50:04 +0530 Subject: [PATCH 55/57] env --- Jenkinsfile | 61 +++++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 167633c..0f64af0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,15 +1,20 @@ pipeline{ agent any - environment { - BRANCH_NAME = "${GIT_BRANCH.split("/")[1]}" - } +// environment { +// BRANCH_NAME = "${GIT_BRANCH.split("origin/")[1]}" +// } stages { - stage('Build') { - steps { - echo BRANCH_NAME - git branch: BRANCH_NAME, url: 'https://github.com/ecomlisters/nodejsSample' + // stage('Build') { + // steps { + // echo BRANCH_NAME + // git branch: BRANCH_NAME, url: 'https://github.com/ecomlisters/nodejsSample' + // } + // } + stage("environments"){ + steps{ + sh 'printenv' } } stage('Install') { @@ -20,29 +25,29 @@ pipeline{ sh 'npm install' } } - stage('Sonar'){ - when { - expression { - BRANCH_NAME == 'main' - } - } - tools { - nodejs 'node16' - } - steps{ - script{ - echo 'running Sonar stage ...' - } + // stage('Sonar'){ + // when { + // expression { + // BRANCH_NAME == 'main' + // } + // } + // tools { + // nodejs 'node16' + // } + // steps{ + // script{ + // echo 'running Sonar stage ...' + // } - script { - sonarqubeScannerHome = tool 'sonar' - } - withSonarQubeEnv('sonar') { - sh "${sonarqubeScannerHome}/bin/sonar-scanner -Dsonar.host.url=http://sonarqube:9000 -Dsonar.qualitygate.wait=true" - } + // script { + // sonarqubeScannerHome = tool 'sonar' + // } + // withSonarQubeEnv('sonar') { + // sh "${sonarqubeScannerHome}/bin/sonar-scanner -Dsonar.host.url=http://sonarqube:9000 -Dsonar.qualitygate.wait=true" + // } - } - } + // } + // } stage('Deploy') { steps { echo 'Deploying....' From 693e6599ed9a9a05b5a047fb656d1013260734d5 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 15:54:14 +0530 Subject: [PATCH 56/57] changs in jenkins file --- Jenkinsfile | 59 ++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0f64af0..19ddadc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,22 +1,22 @@ pipeline{ agent any -// environment { -// BRANCH_NAME = "${GIT_BRANCH.split("origin/")[1]}" -// } + environment { + BRANCH_NAME = "${GIT_BRANCH.split("origin/")[1]}" + } stages { + // stage("environments"){ + // steps{ + // sh 'printenv' + // } + // } // stage('Build') { // steps { // echo BRANCH_NAME // git branch: BRANCH_NAME, url: 'https://github.com/ecomlisters/nodejsSample' // } // } - stage("environments"){ - steps{ - sh 'printenv' - } - } stage('Install') { tools { nodejs 'node16' @@ -25,29 +25,28 @@ pipeline{ sh 'npm install' } } - // stage('Sonar'){ - // when { - // expression { - // BRANCH_NAME == 'main' - // } - // } - // tools { - // nodejs 'node16' - // } - // steps{ - // script{ - // echo 'running Sonar stage ...' - // } - - // script { - // sonarqubeScannerHome = tool 'sonar' - // } - // withSonarQubeEnv('sonar') { - // sh "${sonarqubeScannerHome}/bin/sonar-scanner -Dsonar.host.url=http://sonarqube:9000 -Dsonar.qualitygate.wait=true" - // } + stage('Sonar'){ + when { + expression { + BRANCH_NAME == 'main' + } + } + tools { + nodejs 'node16' + } + steps{ + script{ + echo 'running Sonar stage ...' + } + script { + sonarqubeScannerHome = tool 'sonar' + } + withSonarQubeEnv('sonar') { + sh "${sonarqubeScannerHome}/bin/sonar-scanner -Dsonar.host.url=http://sonarqube:9000 -Dsonar.qualitygate.wait=true" + } - // } - // } + } + } stage('Deploy') { steps { echo 'Deploying....' From 13019b335836ba2dec138ae0af0df47d8869dfc0 Mon Sep 17 00:00:00 2001 From: ankur Date: Sat, 5 Aug 2023 16:17:00 +0530 Subject: [PATCH 57/57] push new changes --- Jenkinsfile | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 19ddadc..64a8314 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,21 +2,10 @@ pipeline{ agent any environment { - BRANCH_NAME = "${GIT_BRANCH.split("origin/")[1]}" + BRANCH_NAME = "${GIT_BRANCH}" } stages { - // stage("environments"){ - // steps{ - // sh 'printenv' - // } - // } - // stage('Build') { - // steps { - // echo BRANCH_NAME - // git branch: BRANCH_NAME, url: 'https://github.com/ecomlisters/nodejsSample' - // } - // } stage('Install') { tools { nodejs 'node16' @@ -34,7 +23,7 @@ pipeline{ tools { nodejs 'node16' } - steps{ + steps{ script{ echo 'running Sonar stage ...' } @@ -44,7 +33,6 @@ pipeline{ withSonarQubeEnv('sonar') { sh "${sonarqubeScannerHome}/bin/sonar-scanner -Dsonar.host.url=http://sonarqube:9000 -Dsonar.qualitygate.wait=true" } - } } stage('Deploy') {