forked from SaiDevOpsFaculty/SaiJavaCode
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jenkinsfile
35 lines (32 loc) · 1.11 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
node {
def mvnHome = tool 'maven'
stage ("checkout") {
checkout([
$class: 'GitSCM',
branches: [[name: '']],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [[
credentialsId: ' jenkins-ssh',
url: '[email protected]:vaibhav7797/SaiJavaCode.git'
]]
])
}
stage ("Build") {
sh "${mvnHome}/bin/mvn compile"
}
stage("Code Quality Scan") {
withSonarQubeEnv("sonarserver") {
sh "${mvnHome}/bin/mvn test"
}
}
stage('SonarQube analysis') {
def scannerHome = tool 'sonarserver';
withSonarQubeEnv('sonarserver') { // If you have configured more than one global server connection, you can specify its name
sh "${scannerHome}/bin/sonar-scanner \
-D sonar.projectKey=project-test \
-D sonar.exclusions=vendor/**,resources/**,**/*.java \
-D sonar.host.url=http://ad7e8bf0d41e84904a318acbead9b963-1949465915.us-east-1.elb.amazonaws.com \
-D sonar.login=sqp_262b1909f8c9ef1e58b98cc462b92a2dee76842a"
}