-
Notifications
You must be signed in to change notification settings - Fork 267
Expand file tree
/
Copy pathJenkinsfile
More file actions
38 lines (32 loc) · 1.17 KB
/
Jenkinsfile
File metadata and controls
38 lines (32 loc) · 1.17 KB
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
36
37
38
node(){
def mvnHome = tool 'MavenBuildTool'
def sonarScannerHome = tool 'Scanner'
try {
stage('Checkout Code'){
checkout scm
}
stage('Maven Build'){
sh "${mvnHome}/bin/mvn clean install"
}
stage('Test Cases Execution'){
sh "${mvnHome}/bin/mvn test"
}
stage('SonarQube Analysis'){
/*withCredentials([string(credentialsId: 'SonarQubeToken', variable: 'SONARQUBE_TOKEN')]) {
//sh "${sonarScannerHome}/bin/sonar-scanner -Dsonar.host.url=http://35.172.192.145:9000/ -Dsonar.login=${SONARQUBE_TOKEN} -Dsonar.projectKey=com.example:java-example-project"
}*/
}
stage('Archive Artifacts'){
archiveArtifacts artifacts: 'target/*.jar', followSymlinks: false
}
}
catch (Exception e){
currentBuild.result = 'FAILURE'
echo currentBuild.currentResult
}finally{
emailext attachLog: true, attachmentsPattern: 'target/surefire-reports/*.xml',
body: '''$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
Check console output at $BUILD_URL to view the results.''',
compressLog: true, recipientProviders: [buildUser(), requestor()], subject: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!', to: 'anuj_sharma401@yahoo.com'
}
}