forked from root-project/jenkins-pipelines
-
Notifications
You must be signed in to change notification settings - Fork 1
/
GenericBuild.groovy
107 lines (94 loc) · 4.67 KB
/
GenericBuild.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!groovy
properties([
parameters([
string(name: 'PODIO_REFSPEC', defaultValue: '', description: 'Refspec for PODIO repository'),
string(name: 'PODIOTEST_REFSPEC', defaultValue: '', description: 'Refspec for PODIOtest repository'),
string(name: 'PODIOTEST_BRANCH', defaultValue: 'master', description: 'Name of the PODIO branch to work with'),
string(name: 'PODIO_BRANCH', defaultValue: 'master', description: 'Name of the podiotest branch to work with'),
string(name: 'BUILD_NOTE', defaultValue: '', description: 'Note to add after label/compiler in job name'),
string(name: 'BUILD_DESCRIPTION', defaultValue: '', description: 'Build description')
])
])
// Treat parameters as environment variables
for (ParameterValue p in params) {
env[p.key] = p.value
}
// TODO: This should be avoided
env.GIT_URL = 'https://github.com/HEP-FCC/podio.git'
currentBuild.setDisplayName("#$BUILD_NUMBER $LABEL/$COMPILER $BUILD_NOTE")
currentBuild.setDescription("$BUILD_DESCRIPTION")
node(LABEL) {
timestamps {
stage('Checkout') {
dir('podio') {
retry(3) {
// TODO: Use the git step when it has implemented specifying refspecs
checkout([$class: 'GitSCM', branches: [[name: PODIO_BRANCH]], doGenerateSubmoduleConfigurations: false, extensions: [],
submoduleCfg: [], userRemoteConfigs: [[refspec: PODIO_REFSPEC, url: env.GIT_URL]]])
}
}
// if (LABEL != 'windows10') {
// dir('roottest') {
// retry(3) {
// def rootTestUrl = 'https://github.com/root-project/roottest.git';
// // TODO: Use the git step when it has implemented specifying refspecs
// checkout([$class: 'GitSCM', branches: [[name: PODIOTEST_BRANCH]], doGenerateSubmoduleConfigurations: false, extensions: [],
// submoduleCfg: [], userRemoteConfigs: [[refspec: PODIOTEST_REFSPEC, url: rootTestUrl]]])
// }
// }
// }
dir('fcc-spi') {
retry(3) {
checkout([$class: 'GitSCM', branches: [[name: 'build-scripts']], doGenerateSubmoduleConfigurations: false, extensions: [],
submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/HEP-FCC/fcc-spi.git']]])
}
}
}
try {
stage('Build') {
if (LABEL == 'windows10') {
bat 'rootspi/jenkins/jk-all.bat'
} else {
sh 'fcc-spi/builds/podio-build.sh'
}
}
// if (LABEL != 'windows10') {
// stage('Test') {
// sh 'rootspi/jenkins/jk-all test'
//
// def testThreshold = [[$class: 'FailedThreshold',
// failureNewThreshold: '0', failureThreshold: '0', unstableNewThreshold: '0',
// unstableThreshold: '0'], [$class: 'SkippedThreshold', failureNewThreshold: '',
// failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']]
//
// step([$class: 'XUnitBuilder',
// testTimeMargin: '3000', thresholdMode: 1, thresholds: testThreshold,
// tools: [[$class: 'CTestType',
// deleteOutputFiles: true, failIfNotNew: false, pattern: 'build/Testing/*/Test.xml',
// skipNoTestFiles: false, stopProcessingIfError: true]]])
//
// if (currentBuild.result == 'FAILURE') {
// throw new Exception("Test result caused build to fail")
// }
// }
// }
} catch (err) {
println 'Build failed because:'
println err
currentBuild.result = 'FAILURE'
}
stage('Clean up') {
sh 'rm -r $WORKSPACE/podio/build'
}
//stash includes: 'rootspi/jenkins/logparser-rules/*', name: 'logparser-rules'
}
}
// Log-parser-plugin will look for rules on master node. Unstash the rules and parse the rules. (JENKINS-38840)
// node('master') {
// stage('Generate reports') {
// unstash 'logparser-rules'
// step([$class: 'LogParserPublisher',
// parsingRulesPath: "${pwd()}/rootspi/jenkins/logparser-rules/ROOT-incremental-LogParserRules.txt",
// useProjectRule: false, unstableOnWarning: false, failBuildOnError: true])
// }
// }