forked from Cloud-Gen-DevOps-Projects/Rigstration-Form
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile3
54 lines (45 loc) · 1.52 KB
/
Jenkinsfile3
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
pipeline {
agent any
environment {
// Add the path to Maven bin directory to the PATH variable
PATH = "/opt/maven/bin:${env.PATH}"
M2_HOME = tool 'maven'
}
stages {
stage('Checkout') {
steps {
git branch: 'main', url: 'https://github.com/Devops9AM/Rigstration-Form.git'
}
}
stage("SonarQube analysis") {
steps {
withSonarQubeEnv('DevOps-Project-2') {
sh 'mvn clean install sonar:sonar'
}
}
}
stage("SonarQube Code Quality Gates") {
steps {
timeout(time: 2, unit: 'MINUTES') {
withSonarQubeEnv('DevOps-Project-2') {
sh 'mvn clean install sonar:sonar'
}
}
}
}
}
post {
failure {
emailext subject: "Failed: \${JOB_NAME} \${BUILD_NUMBER}",
body: "Hi Your Build was Something went wrong. Check the build at \${BUILD_URL}",
to: "ravindra.devops@gmail.com",
from: "ravindra.devops@gmail.com"
}
success {
emailext subject: "Successful: \${JOB_NAME} \${BUILD_NUMBER}",
body: "Hi Your Build was successful. See details at \${BUILD_URL}",
to: "ravindra.devops@gmail.com",
from: "ravindra.devops@gmail.com"
}
}
}