Skip to content

Commit

Permalink
add pr check
Browse files Browse the repository at this point in the history
  • Loading branch information
ulyasaur committed Sep 24, 2024
1 parent 1b90a58 commit 2e5d9d9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
26 changes: 21 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,27 @@ pipeline {
}
steps {
echo "SonarQube Scanner installation directory: ${scannerHome}"

sh '''
${scannerHome}/bin/sonar-scanner \
-Dsonar.login=$SONAR
'''

script {
withEnv([
"PR_KEY=${env.CHANGE_ID}",
"PR_BRANCH=${env.CHANGE_BRANCH}",
"PR_BASE=${env.CHANGE_TARGET}",
]) {
if (env.PR_KEY != "null") {
sh '''
${scannerHome}/bin/sonar-scanner \
-Dsonar.pullrequest.key=$PR_KEY \
-Dsonar.pullrequest.branch=$PR_BRANCH \
-Dsonar.pullrequest.base=$PR_BASE \
-Dsonar.login=$SONAR
'''
} else {
sh '''
${scannerHome}/bin/sonar-scanner \
-Dsonar.login=$SONAR
'''
}
}
}
stage('Build image') {
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sonar.projectKey=ita-social-projects_StreetCode_Client
sonar.organization=ita-social-projects
sonar.projectName=StreetCode_Client
sonar.projectDescription=Fronted app of Street Code project
sonar.projectDescription=Frontend app of Street Code project
sonar.host.url=https://sonarcloud.io
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.sources=src/
Expand Down

0 comments on commit 2e5d9d9

Please sign in to comment.