1
1
// -*- mode: groovy-mode
2
2
3
- properties(
4
- [[
5
- $class : ' BuildDiscarderProperty' ,
6
- strategy : [$class : ' LogRotator' ,
7
- artifactDaysToKeepStr : ' 3' ,
8
- artifactNumToKeepStr : ' 5' ,
9
- daysToKeepStr : ' 3' ,
10
- numToKeepStr : ' 5' ]
11
- ]]
12
- )
3
+ properties([buildDiscarder(logRotator(artifactDaysToKeepStr : ' 3' , artifactNumToKeepStr : ' 5
10000
' , daysToKeepStr : ' 3' , numToKeepStr : ' 5' ))])
4
+
13
5
14
6
// -----------------------------------------------------------------------------
15
7
// --SECTION-- SELECTABLE PARAMETERS
@@ -121,6 +113,12 @@ restrictions = [:]
121
113
// overview of configured builds and tests
122
114
overview = " "
123
115
116
+ // results
117
+ resultsKeys = []
118
+ resultsStart = [:]
119
+ resultsStop = [:]
120
+ resultsStatus = [:]
121
+
124
122
// -----------------------------------------------------------------------------
125
123
// --SECTION-- CONSTANTS AND HELPERS
126
124
// -----------------------------------------------------------------------------
@@ -226,7 +224,24 @@ def checkEnabledMaintainer(maintainer, os, text) {
226
224
return true
227
225
}
228
226
229
- def checkCoresAndSave (os , runDir , name , archRun ) {
227
+ def checkCores (os , runDir ) {
228
+ if (os == ' windows' ) {
229
+ def files = findFiles(glob : " ${ runDir} /*.dmp" )
230
+
231
+ if (files. length > 0 ) {
232
+ error(" found windows core file" )
233
+ }
234
+ }
235
+ else {
236
+ def files = findFiles(glob : " ${ runDir} /core*" )
237
+
238
+ if (files. length > 0 ) {
239
+ error(" found linux core file" )
240
+ }
241
+ }
242
+ }
243
+
244
+ def saveCores (os , runDir , name , archRun ) {
230
245
if (os == ' windows' ) {
231
246
powershell " move-item -Force -ErrorAction Ignore ${ runDir} /logs ${ archRun} /${ name} .logs"
232
247
powershell " move-item -Force -ErrorAction Ignore ${ runDir} /out ${ archRun} /${ name} .logs"
@@ -241,7 +256,7 @@ def checkCoresAndSave(os, runDir, name, archRun) {
241
256
242
257
powershell " copy-item .\\ build\\ bin\\ * -Include *.exe,*.pdb,*.ilk ${ archRun} "
243
258
244
- error( " found dmp file " )
259
+ return true
245
260
}
246
261
}
247
262
else {
@@ -256,9 +271,11 @@ def checkCoresAndSave(os, runDir, name, archRun) {
256
271
257
272
sh " cp -a build/bin/* ${ archRun} "
258
273
259
- error( " found core file " )
274
+ return true
260
275
}
261
276
}
277
+
278
+ return false
262
279
}
263
280
264
281
def getStartPort (os ) {
@@ -290,6 +307,31 @@ def shellAndPipe(command, logfile) {
290
307
sh " (echo 1 > \" ${ logfile} .result\" ; ${ command} ; echo \$ ? > \" ${ logfile} .result\" ) 2>&1 | tee -a \" ${ logfile} \" ; exit `cat \" ${ logfile} .result\" `"
291
308
}
292
309
310
+ def logStartStage (logFile ) {
311
+ resultsKeys << logFile
312
+
313
+ resultsStart[logFile] = new Date ()
314
+ resultsStatus[logFile] = " started"
315
+
316
+ echo " started ${ logFile} : ${ resultsStart[logFile]} "
317
+ }
318
+
319
+ def logStopStage (logFile ) {
320
+ resultsStop[logFile] = new Date ()
321
+ resultsStatus[logFile] = " finished"
322
+
323
+ echo " finished ${ logFile} : ${ resultsStop[logFile]} "
324
+ }
325
+
326
+ def logExceptionStage (logFile , exc ) {
327
+ def msg = exc. toString()
328
+
329
+ resultsStop[logFile] = new Date ()
330
+ resultsStatus[logFile] = " failed ${ msg} "
331
+
332
+ echo " failed ${ logFile} : ${ resultsStop[logFile]} ${ msg} "
333
+ }
334
+
293
335
// -----------------------------------------------------------------------------
294
336
// --SECTION-- SCRIPTS SCM
295
337
// -----------------------------------------------------------------------------
@@ -594,10 +636,16 @@ def jslint(os, edition, maintainer) {
594
636
def logFile = " ${ arch} /jslint.log"
595
637
596
638
try {
639
+ logStartStage(logFile)
640
+
597
641
shellAndPipe(" ./Installation/Pipeline/test_jslint.sh" ,logFile)
598
642
sh " if grep ERROR ${ logFile} ; then exit 1; fi"
643
+
644
+ logStopStage(logFile)
599
645
}
600
646
catch (exc) {
647
+ logExceptionStage(logFile, exc)
648
+
601
649
renameFolder(arch, archFail)
602
650
fileOperations([fileCreateOperation(fileContent : ' JSLINT FAILED' , fileName : " ${ archDir} -FAIL.txt" )])
603
651
throw exc
@@ -696,7 +744,7 @@ def setupTestEnvironment(os, edition, maintainer, logFile, runDir) {
696
744
}
697
745
698
746
def executeTests (os , edition , maintainer , mode , engine , portInit , archDir , arch , stageName ) {
699
- def parallelity = 4
747
+ def parallelity = (mode == " cluster " ) ? ((os == " linux " ) ? 5 : 2 ) : ((os == " linux " ) ? 10 : 4 )
700
748
def testIndex = 0
701
749
def tests = getTests(os, edition, maintainer, mode, engine)
702
750
@@ -725,6 +773,7 @@ def executeTests(os, edition, maintainer, mode, engine, portInit, archDir, arch,
725
773
726
774
testMap[" ${ stageName} -${ name} " ] = {
727
775
def logFile = pwd() + " /" + " ${ arch} /${ name} .log"
776
+ def logFileRel = " ${ arch} /${ name} .log"
728
777
def logFileFailed = pwd() + " /" + " ${ arch} -FAIL/${ name} .log"
729
778
def archRun = pwd() + " /" + " ${ arch} -RUN"
730
779
@@ -745,6 +794,8 @@ def executeTests(os, edition, maintainer, mode, engine, portInit, archDir, arch,
745
794
setupTestEnvironment(os, edition, maintainer, logFile, runDir)
746
795
747
796
try {
797
+ logStartStage(logFileRel)
798
+
748
799
// seriously...30 minutes is the super absolute max max max.
749
800
// even in the worst situations ArangoDB MUST be able to finish within 60 minutes
750
801
// even if the features are green this is completely broken performance wise..
@@ -773,8 +824,13 @@ def executeTests(os, edition, maintainer, mode, engine, portInit, archDir, arch,
773
824
}
774
825
}
775
826
}
827
+
828
+ checkCores(os, runDir)
829
+ logStopStage(logFileRel)
776
830
}
777
831
catch (exc) {
832
+ logExceptionStage(logFileRel, exc)
833
+
778
834
def msg = exc. toString()
779
835
780
836
echo " caught error, copying log to ${ logFileFailed} : ${ msg} "
@@ -794,10 +850,9 @@ def executeTests(os, edition, maintainer, mode, engine, portInit, archDir, arch,
794
850
throw exc
795
851
}
796
852
finally {
797
- def logFileRel = " ${ arch} /${ name} .log"
798
853
def logFileFailedRel = " ${ arch} -FAIL/${ name} .log"
799
854
800
- checkCoresAndSave (os, runDir, name, archRun)
855
+ saveCores (os, runDir, name, archRun)
801
856
802
857
archiveArtifacts allowEmptyArchive : true ,
803
858
artifacts : " ${ archDir} -FAIL.txt, ${ logFileRel} , ${ logFileFailedRel} " ,
@@ -902,7 +957,17 @@ def testStepParallel(os, edition, maintainer, modeList) {
902
957
}
903
958
}
904
959
905
- parallel branches
960
+ def name = " test-${ os} -${ edition} -${ maintainer} "
961
+
962
+ try {
963
+ logStartStage(name)
964
+ parallel branches
965
+ logStopStage(name)
966
+ }
967
+ catch (exc) {
968
+ logExceptionStage(name, exc)
969
+ throw exc
970
+ }
906
971
}
907
972
908
973
// -----------------------------------------------------------------------------
@@ -1048,6 +1113,8 @@ def buildEdition(os, edition, maintainer) {
1048
1113
def logFile = " ${ arch} /build.log"
1049
1114
1050
1115
try {
1116
+ logStartStage(logFile)
1117
+
1051
1118
if (os == ' linux' || os == ' mac' ) {
1052
1119
sh " echo \" Host: `hostname`\" | tee -a ${ logFile} "
1053
1120
sh " echo \" PWD: `pwd`\" | tee -a ${ logFile} "
@@ -1078,8 +1145,12 @@ def buildEdition(os, edition, maintainer) {
1078
1145
1079
1146
powershell " . .\\ Installation\\ Pipeline\\ windows\\ build_${ os} _${ edition} _${ maintainer} .ps1"
1080
1147
}
1148
+
1149
+ logStopStage(logFile)
1081
1150
}
1082
1151
catch (exc) {
1152
+ logExceptionStage(logFile, exc)
1153
+
1083
1154
def msg = exc. toString()
1084
1155
1085
1156
fileOperations([
@@ -1162,11 +1233,17 @@ def createDockerImage(edition, maintainer, stageName) {
1162
1233
1163
1234
withEnv([" DOCKERTAG=${ packageName} -${ dockerTag} " ]) {
1164
1235
try {
1236
+ logStartStage(logFile)
1237
+
1165
1238
shellAndPipe(" ./scripts/build-docker.sh" , logFile)
1166
1239
shellAndPipe(" docker tag arangodb:${ packageName} -${ dockerTag} c1.triagens-gmbh.zz:5000/arangodb/${ packageName} :${ dockerTag} " , logFile)
1167
1240
shellAndPipe(" docker push c1.triagens-gmbh.zz:5000/arangodb/${ packageName} :${ dockerTag} " , logFile)
1241
+
1242
+ logStopStage(logFile)
1168
1243
}
1169
1244
catch (exc) {
1245
+ logExceptionStage(logFile, exc)
1246
+
1170
1247
renameFolder(arch, archFail)
1171
1248
fileOperations([fileCreateOperation(fileContent : ' DOCKER FAILED' , fileName : " ${ archDir} -FAIL.txt" )])
1172
1249
throw exc
@@ -1256,16 +1333,49 @@ def runOperatingSystems(osList) {
1256
1333
}
1257
1334
1258
1335
timestamps {
1259
- node(" master" ) {
1260
- echo sh(returnStdout : true , script : ' env' )
1261
- }
1336
+ try {
1337
+ node(" master" ) {
1338
+ echo sh(returnStdout : true , script : ' env' )
1339
+ }
1340
+
1341
+ checkCommitMessages()
1262
1342
1263
- checkCommitMessages()
1343
+ node(" master" ) {
1344
+ fileOperations([fileCreateOperation(fileContent : overview, fileName : " overview.txt" )])
1345
+ archiveArtifacts(allowEmptyArchive : true , artifacts : " overview.txt" )
1346
+ }
1264
1347
1265
- node(" master" ) {
1266
- fileOperations([fileCreateOperation(fileContent : overview, fileName : " overview.txt" )])
1267
- archiveArtifacts(allowEmptyArchive : true , artifacts : " overview.txt" )
1348
+ runOperatingSystems([' linux' , ' mac' , ' windows' ])
1268
1349
}
1350
+ finally {
1351
+ results = " "
1352
+ html = " <html><body><table>\n "
1353
+ html + = " <tr><th>Name</th><th>Start</th><th>Stop</th><th>Duration</th><th>Message</th></tr>\n "
1354
+
1355
+ for (key in resultsKeys) {
1356
+ def start = resultsStart[key] ?: " "
1357
+ def stop = resultsStop[key] ?: " "
1358
+ def msg = resultsStatus[key] ?: " "
1359
+ def diff = (start != " " && stop != " " ) ? groovy.time.TimeCategory . minus(stop, start) : " -"
1360
+ def startf = start. format(' yyyy/MM/dd HH:mm:ss' )
1361
+ def stopf = stop. format(' yyyy/MM/dd HH:mm:ss' )
1362
+ def color = ' bgcolor="#FF8080"'
1363
+
1364
+ if (msg == " finished" ) {
1365
+ color = ' bgcolor="#80FF80"'
1366
+ }
1367
+
1368
+ results + = " ${ key} : ${ startf} - ${ stopf} (${ diff} ) ${ msg} \n "
1369
+ html + = " <tr ${ color} ><td>${ key} </td><td>${ startf} </td><td>${ stopf} </td><td align=\" right\" >${ diff} </td><td align=\" right\" >${ msg} </td></tr>\n "
1370
+ }
1371
+
1372
+ html + = " </table></body></html>\n "
1269
1373
1270
- runOperatingSystems([' linux' , ' mac' , ' windows' ])
1374
+ node(" master" ) {
1375
+ fileOperations([fileCreateOperation(fileContent : results, fileName : " results.txt" )])
1376
+ fileOperations([fileCreateOperation(fileContent : html, fileName : " results.html" )])
1377
+ archiveArtifacts(allowEmptyArchive : true , artifacts : " results.*" )
1378
+ }
1379
+ }
1271
1380
}
1381
+
0 commit comments