-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathJenkinsfile
26 lines (26 loc) · 949 Bytes
/
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
/**
* Track a test suite for a GitHub repository. Set the job results according to the README badge.
* Input - BADGE_LINK - Link to the README badge, for example:
* https://badgen.net/github/status/jfrog/jfrog-cli/v2?label=JFrog%20Pipelines.
* Output - Set this job status SUCCESS, FAILURE, or NOT_BUILT.
*/
properties([
buildDiscarder(logRotator(numToKeepStr: '5'))
])
timeout(time: 45, unit: 'SECONDS') {
node {
response = httpRequest(consoleLogResponseBody: true,
contentType: 'APPLICATION_JSON',
httpMode: 'GET',
url: BADGE_LINK,
validResponseCodes: '200')
body = response.content.toLowerCase()
if (body.contains('failing')) {
currentBuild.result = 'FAILURE'
} else if (body.contains('passing')) {
currentBuild.result = 'SUCCESS'
} else {
currentBuild.result = 'NOT_BUILT'
}
}
}