forked from Sonal0409/DevOps_ClassNotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJobApprovalScript.txt
More file actions
60 lines (47 loc) · 1.19 KB
/
JobApprovalScript.txt
File metadata and controls
60 lines (47 loc) · 1.19 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
node
{
def jobName = currentBuild.fullDisplayName
def mailToRecipients = 'myemailtestjenkinsjune@gmail.com'
def useremail='myemailtestjenkinsjune@gmail.com'
stage('Build')
{
def userAborted = false
emailext body: '''
Please go to console output of ${BUILD_URL}input to approve or Reject.<br>
''',
mimeType: 'text/html',
subject: "[Jenkins] ${jobName} Build Approval Request",
from: "${useremail}",
to: "${mailToRecipients}",
recipientProviders: [[$class: 'CulpritsRecipientProvider']]
echo "Building1"
try {
userInput = input submitter: 'vagrant', message: 'Do you approve?'
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
cause = e.causes.get(0)
echo "Aborted by " + cause.getUser().toString()
userAborted = true
echo "SYSTEM aborted, but looks like timeout period didn't complete. Aborting."
}
if (userAborted) {
currentBuild.result = 'ABORTED'
} else {
echo "Building2"
}
}
stage('Distribution')
{
parallel 'Test':
{
echo "Testing"
},
'Deploy':
{
echo "Deploying"
}
}
stage('Finish')
{
echo "Successfully Completed"
}
}