-
Notifications
You must be signed in to change notification settings - Fork 25
/
PullrequestsRoottest.groovy
69 lines (56 loc) · 2.89 KB
/
PullrequestsRoottest.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!groovy
@Library('root-pipelines')
import cern.root.pipeline.*
properties([
parameters([
string(name: 'ghprbPullId', defaultValue: '516'),
string(name: 'ghprbGhRepository', defaultValue: 'root-project/roottest'),
string(name: 'ghprbCommentBody', defaultValue: '@phsft-bot build'),
string(name: 'ghprbTargetBranch', defaultValue: 'master'),
string(name: 'ghprbActualCommit', defaultValue: ''),
string(name: 'ghprbPullAuthorLogin', defaultValue: ''),
string(name: 'ghprbSourceBranch', defaultValue: ''),
string(name: 'ghprbAuthorRepoGitUrl', defaultValue: ''),
string(name: 'sha1', defaultValue: ''),
string(name: 'VERSION', defaultValue: 'master', description: 'Branch to be built'),
string(name: 'EXTERNALS', defaultValue: 'ROOT-latest', description: ''),
string(name: 'EMPTY_BINARY', defaultValue: 'true', description: 'Boolean to empty the binary directory (i.e. to force a full re-build)'),
string(name: 'ExtraCMakeOptions', defaultValue: '', description: 'Additional CMake configuration options of the form "-Doption1=value1 -Doption2=value2"'),
string(name: 'MODE', defaultValue: 'pullrequests', description: 'The build mode'),
string(name: 'PARENT', defaultValue: 'roottest-pullrequests-trigger', description: 'Trigger job name')
])
])
timestamps {
GitHub gitHub = new GitHub(this, PARENT, ghprbGhRepository, ghprbPullId, params.ghprbActualCommit)
BotParser parser = new BotParser(this, params.ExtraCMakeOptions)
GenericBuild build = new GenericBuild(this, 'roottest-pullrequests-build', params.MODE)
build.addBuildParameter('ROOTTEST_REFSPEC', '+refs/pull/*:refs/remotes/origin/pr/*')
build.addBuildParameter('ROOTTEST_BRANCH', "origin/pr/${ghprbPullId}/head")
build.addBuildParameter('ROOT_BRANCH', "${params.ghprbTargetBranch}")
build.addBuildParameter('GIT_COMMIT', "${params.sha1}")
build.addBuildParameter('BUILD_NOTE', "$ghprbPullAuthorLogin PR #$ghprbPullId")
currentBuild.setDisplayName("#$BUILD_NUMBER $ghprbPullAuthorLogin PR #$ghprbPullId")
build.cancelBuilds('.*PR #' + ghprbPullId + '$')
build.afterBuild({buildWrapper ->
if (buildWrapper.result.result != 'SUCCESS' && currentBuild.result != 'ABORTED') {
gitHub.postResultComment(buildWrapper)
}
})
if (parser.isParsableComment(ghprbCommentBody.trim())) {
parser.parse()
}
parser.postStatusComment(gitHub)
parser.configure(build)
gitHub.setPendingCommitStatus('Building')
build.build()
stage('Publish reports') {
if (currentBuild.result == 'SUCCESS') {
gitHub.setSucceedCommitStatus('Build passed')
} else if (currentBuild.result != 'ABORTED') {
gitHub.setFailedCommitStatus('Build failed')
}
if (currentBuild.result != null) {
build.sendEmails()
}
}
}