-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
79 lines (40 loc) · 1.58 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
node('master')
{
stage('SCM Checkout')
{
git 'https://github.com/Chowdeswar777/Parking_app.git'
}
stage('Build')
{
withSonarQubeEnv('sonar')
{
sh '/usr/share/maven/bin/mvn clean verify sonar:sonar -Dsonar.password=sonar -Dsonar.login=admin'
} // SonarQube taskId is automatically attached to the pipeline context
}
stage("QG Check")
{
timeout(time: 1, unit: 'HOURS')
{ // Just in case something goes wrong, pipeline will be killed after a timeout
def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv
if (qg.status != 'OK')
{
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
}
stage('Deploy approval')
{
input "Deploy to prod?"
}
node('master')
{
stage('SIT – Deployment ')
{
sh '/usr/share/maven/bin/mvn clean deploy -DaltDeploymentRepository=internal.repo::default::http://admin:admin123@http://35.173.48.151:8081/nexus/content/repositories/snapshots/'
}
}
stage("Sending the notification to slack")
{
slackSend message: "Job Name:- ${env.JOB_NAME} Job Number:- ${env.BUILD_NUMBER} Build status :- ${currentBuild.currentResult}"
}