-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathdeclarative_pipeline
35 lines (31 loc) · 995 Bytes
/
declarative_pipeline
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
pipeline {
agent any
stages {
stage ('Stage 1') {
steps {
echo "First stage OK"
}
}
stage('Wait on Webhook') {
options {
timeout(time: 2, unit: "MINUTES")
}
steps {
script {
hook = registerWebhook()
callbackURL = hook.url
// Call a remote system to start execution, passing the callback url
//sh "curl -X POST -H 'Content-Type: application/json' -d '{\"callback\":\"${callbackURL}"}' http://httpbin.org/post"
echo "Waiting for POST to ${callbackURL}"
data = waitForWebhook hook
echo "Webhook called with data: ${data}"
}
}
}
stage('last stage') {
steps {
echo "Done!"
}
}
}
}