From f63247069004cf81807b4eea4d78747be79ad290 Mon Sep 17 00:00:00 2001 From: ganesh Date: Fri, 30 Aug 2024 11:10:36 +0530 Subject: [PATCH 1/7] added jenkins file --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d9ad9d4..3ce8097 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,5 @@ pipeline { - agent any + agent { label 'nop' } stages { stage('vcs') { steps { @@ -13,7 +13,7 @@ pipeline { sh 'dotnet test SampleMVC.sln' sh 'dotnet publish -c Release StudentsWeb/StudentsWeb.csproj -o published/' - } + } } From 4fab121cb5ccfa791c0f79146d9602783b99a7a0 Mon Sep 17 00:00:00 2001 From: ganesh Date: Fri, 30 Aug 2024 14:19:24 +0530 Subject: [PATCH 2/7] added changes --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3ce8097..d6b22ce 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,12 +9,13 @@ pipeline { } stage('build and analysis') { steps { + withSonarQubeEnv(credentialsId: 'SONAR_CLOUD', installationName: 'sonarcloud') { + sh 'dotnet sonarscanner begin /k:"nop-sample" /o:"august24" /d:sonar.host.url="https://sonarcloud.io"' sh 'dotnet build SampleMVC.sln --no-incremental' sh 'dotnet test SampleMVC.sln' sh 'dotnet publish -c Release StudentsWeb/StudentsWeb.csproj -o published/' - - - + sh 'dotnet sonarscanner end' + } } } } From 0d9338c42f2c2da4d0707cca41ee28e22a9db53b Mon Sep 17 00:00:00 2001 From: ganesh Date: Fri, 30 Aug 2024 14:21:10 +0530 Subject: [PATCH 3/7] added changes --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d6b22ce..fe5d348 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,8 +3,8 @@ pipeline { stages { stage('vcs') { steps { - git branch: 'main', - url: 'https://github.com/dummyrepos/SampleWeb.git' + git branch: 'dev', + url: 'https://github.com/sivaganesh2312/SampleWebnop.git' } } stage('build and analysis') { From c64f8deb78234542f5349e2c799b687975696783 Mon Sep 17 00:00:00 2001 From: ganesh Date: Fri, 30 Aug 2024 14:46:40 +0530 Subject: [PATCH 4/7] adeed changes --- Jenkinsfile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fe5d348..0354645 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,18 +3,17 @@ pipeline { stages { stage('vcs') { steps { - git branch: 'dev', + git branch: 'main', url: 'https://github.com/sivaganesh2312/SampleWebnop.git' } } stage('build and analysis') { steps { withSonarQubeEnv(credentialsId: 'SONAR_CLOUD', installationName: 'sonarcloud') { - sh 'dotnet sonarscanner begin /k:"nop-sample" /o:"august24" /d:sonar.host.url="https://sonarcloud.io"' - sh 'dotnet build SampleMVC.sln --no-incremental' - sh 'dotnet test SampleMVC.sln' - sh 'dotnet publish -c Release StudentsWeb/StudentsWeb.csproj -o published/' - sh 'dotnet sonarscanner end' + sh 'dotnet tool install --global dotnet-sonarscanner || exit 0' + sh 'dotnet sonarscanner begin /k:"nop-sample" /d:sonar.token="$SONAR_CLOUD" /d:sonar.host.url="https://sonarcloud.io"' + sh 'dotnet build SampleMVC.sln --no-incremental' + sh 'dotnet sonarscanner end /d:sonar.token="$SONAR_CLOUD"' } } } From 1fe0ee3166d5397e074aded7d21103c756105097 Mon Sep 17 00:00:00 2001 From: ganesh Date: Fri, 30 Aug 2024 14:50:57 +0530 Subject: [PATCH 5/7] adeed changes --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0354645..0a922b9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { stages { stage('vcs') { steps { - git branch: 'main', + git branch: 'dev', url: 'https://github.com/sivaganesh2312/SampleWebnop.git' } } From 1bde452f4583b784a4a6265164c233907677a787 Mon Sep 17 00:00:00 2001 From: ganesh Date: Fri, 30 Aug 2024 14:58:51 +0530 Subject: [PATCH 6/7] adeed changes --- Jenkinsfile | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0a922b9..a602b79 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,21 +1,27 @@ pipeline { agent { label 'nop' } stages { + stage('Setup') { + steps { + sh 'export PATH="$PATH:$HOME/.dotnet/tools"' // Ensure PATH includes the tool location + sh 'dotnet tool install --global dotnet-sonarscanner || true' // Install if not already installed + } + } stage('vcs') { steps { - git branch: 'dev', - url: 'https://github.com/sivaganesh2312/SampleWebnop.git' + git branch: 'dev', url: 'https://github.com/sivaganesh2312/SampleWebnop.git' } } stage('build and analysis') { steps { - withSonarQubeEnv(credentialsId: 'SONAR_CLOUD', installationName: 'sonarcloud') { - sh 'dotnet tool install --global dotnet-sonarscanner || exit 0' - sh 'dotnet sonarscanner begin /k:"nop-sample" /d:sonar.token="$SONAR_CLOUD" /d:sonar.host.url="https://sonarcloud.io"' - sh 'dotnet build SampleMVC.sln --no-incremental' - sh 'dotnet sonarscanner end /d:sonar.token="$SONAR_CLOUD"' + withSonarQubeEnv('sonarcloud') { + sh 'dotnet sonarscanner begin /k:"nop-sample" /d:sonar.token="${SONAR_CLOUD}" /d:sonar.host.url="https://sonarcloud.io"' + sh 'dotnet build SampleMVC.sln --no-incremental' + sh 'dotnet test SampleMVC.sln' + sh 'dotnet publish -c Release StudentsWeb/StudentsWeb.csproj -o published/' + sh 'dotnet sonarscanner end /d:sonar.token="${SONAR_CLOUD}"' } } } } -} \ No newline at end of file +} From b4924b6770c53245ae468ce7188bd40db0bf5e20 Mon Sep 17 00:00:00 2001 From: ganesh Date: Thu, 5 Sep 2024 16:49:21 +0530 Subject: [PATCH 7/7] added changes --- Jenkinsfile | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a602b79..c461f86 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,27 +1,29 @@ pipeline { - agent { label 'nop' } + agent { label 'sonar'} + // Make sure this is correctly defined + stages { - stage('Setup') { - steps { - sh 'export PATH="$PATH:$HOME/.dotnet/tools"' // Ensure PATH includes the tool location - sh 'dotnet tool install --global dotnet-sonarscanner || true' // Install if not already installed - } - } stage('vcs') { steps { - git branch: 'dev', url: 'https://github.com/sivaganesh2312/SampleWebnop.git' + git branch: 'master', + url: 'https://github.com/sivaganesh2312/SampleWebnop.git' } } - stage('build and analysis') { + stage('SonarQube Analysis') { steps { - withSonarQubeEnv('sonarcloud') { - sh 'dotnet sonarscanner begin /k:"nop-sample" /d:sonar.token="${SONAR_CLOUD}" /d:sonar.host.url="https://sonarcloud.io"' + + + withSonarQubeEnv(credentialsId: 'SONAR_CLOUD', installationName: 'sonarcloud') { + sh 'dotnet sonarscanner begin /k:"sivaganesh2312_SampleWebnop" /o:sivaganesh2312' sh 'dotnet build SampleMVC.sln --no-incremental' sh 'dotnet test SampleMVC.sln' sh 'dotnet publish -c Release StudentsWeb/StudentsWeb.csproj -o published/' - sh 'dotnet sonarscanner end /d:sonar.token="${SONAR_CLOUD}"' + sh 'dotnet sonarscanner end' + } } } } } -} + +================================================== +