-
Notifications
You must be signed in to change notification settings - Fork 48
/
Jenkinsfile
35 lines (30 loc) · 1.26 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'GIT CLONE'
checkout scm
echo 'SONARQUBE'
script {
def workspace = pwd()
def extraParameter = ""
try {
if (CHANGE_ID) {
extraParameter = " -Dsonar.github.pullRequest=${CHANGE_ID} -Dsonar.analysis.mode=preview"
} else {
extraParameter = ""
}
} catch (exception) {
echo 'Kein PR'
}
withSonarQubeEnv('Sonar') {
withCredentials([string(credentialsId: 'LssmBotAuthKey', variable: 'TOKEN')]) {
sh "/var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarqubeScanner/bin/sonar-scanner -Dproject.settings=sonar.properties -Dsonar.branch=$BRANCH_NAME -Dsonar.projectBaseDir=$WORKSPACE -Dsonar.login=$SONAR_AUTH_TOKEN -Dsonar.github.oauth=$TOKEN $extraParameter"
}
}
}
}
}
}
}