-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
37 lines (33 loc) · 1.12 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
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'echo "Building..."'
sh 'npm run build'
}
}
stage('Test') {
steps {
sh 'echo "Running tests..."'
sh 'npm run test:unit'
}
}
stage('Deploy') {
steps {
sh 'echo "Deploying..."'
// Insert your own deployment procedure
}
}
// The interesting part happens here. We use the after_deploy phase to trigger Checkly and either pass or fail the build.
stage('Trigger Checkly') {
steps {
sh 'echo "Deployment finished."'
// Call Checkly trigger
sh 'curl "https://api-test.checklyhq.com/check-groups/4/trigger/${CHECKLY_TOKEN}" > ${PWD}/checkly.json'
// Exit with an error status if we find more than 0 "hasFailures: true" in the output
sh 'if [ $(grep -c \'"hasFailures":true\' $PWD/checkly.json) -ne 0 ]; then exit 1; fi'
}
}
}
}