forked from DOI-USGS/ISIS3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroovy_utilities.groovy
32 lines (27 loc) · 1.05 KB
/
groovy_utilities.groovy
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
// vim: ft=groovy
// Helpers for setting commit status
def getRepoUrl() {
return sh(script: "git config --get remote.origin.url", returnStdout: true).trim()
}
def getCommitSha() {
return sh(script: "git rev-parse HEAD", returnStdout: true).trim()
}
def setGitHubBuildStatus(status) {
def repoUrl = getRepoUrl()
def commitSha = getCommitSha()
step([
$class: 'GitHubCommitStatusSetter',
reposSource: [$class: "ManuallyEnteredRepositorySource", url: repoUrl],
commitShaSource: [$class: "ManuallyEnteredShaSource", sha: commitSha],
errorHandlers: [[$class: 'ShallowAnyErrorHandler']],
statusResultSource: [
$class: 'ConditionalStatusResultSource',
results: [
[$class: 'BetterThanOrEqualBuildResult', result: 'SUCCESS', state: 'SUCCESS', message: status],
[$class: 'BetterThanOrEqualBuildResult', result: 'FAILURE', state: 'FAILURE', message: status],
[$class: 'AnyBuildResult', state: 'FAILURE', message: 'Loophole']
]
]
])
}
return this