Skip to content

Commit bc28e06

Browse files
authored
Add files via upload
1 parent 6a6c24c commit bc28e06

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

JENKINS/JobApprovalScript.txt

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
node
2+
{
3+
4+
def jobName = currentBuild.fullDisplayName
5+
def mailToRecipients = 'myemailtestjenkinsjune@gmail.com'
6+
def useremail='myemailtestjenkinsjune@gmail.com'
7+
8+
stage('Build')
9+
{
10+
def userAborted = false
11+
12+
emailext body: '''
13+
Please go to console output of ${BUILD_URL}input to approve or Reject.<br>
14+
''',
15+
mimeType: 'text/html',
16+
subject: "[Jenkins] ${jobName} Build Approval Request",
17+
from: "${useremail}",
18+
to: "${mailToRecipients}",
19+
recipientProviders: [[$class: 'CulpritsRecipientProvider']]
20+
21+
echo "Building1"
22+
try {
23+
userInput = input submitter: 'vagrant', message: 'Do you approve?'
24+
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
25+
cause = e.causes.get(0)
26+
echo "Aborted by " + cause.getUser().toString()
27+
userAborted = true
28+
echo "SYSTEM aborted, but looks like timeout period didn't complete. Aborting."
29+
}
30+
if (userAborted) {
31+
currentBuild.result = 'ABORTED'
32+
} else {
33+
echo "Building2"
34+
}
35+
36+
37+
38+
39+
}
40+
stage('Distribution')
41+
{
42+
parallel 'Test':
43+
{
44+
45+
echo "Testing"
46+
47+
},
48+
'Deploy':
49+
{
50+
51+
echo "Deploying"
52+
53+
}
54+
}
55+
stage('Finish')
56+
{
57+
echo "Successfully Completed"
58+
}
59+
60+
}

0 commit comments

Comments
 (0)