1
0
Fork 0

Feature/jenkins pipeline (#3314)

* propagate exit result

* added useDocker

* added missing tests and directories

* show arangosh version
This commit is contained in:
Frank Celler 2017-09-22 11:07:15 +02:00 committed by GitHub
parent 9fe558ed5f
commit 0ab55310c6
1 changed files with 31 additions and 14 deletions

View File

@ -106,6 +106,9 @@ useMaintainer = params.Maintainer
// build user mode // build user mode
useUser = params.User useUser = params.User
// build docker
useDocker = true
// run resilience tests // run resilience tests
//runResilience = params.runResilience //runResilience = params.runResilience
@ -283,6 +286,10 @@ def deleteDirDocker(os) {
deleteDir() deleteDir()
} }
def shellAndPipe(command, logfile) {
sh "(echo 1 > \"${logfile}.result\" ; ${command} ; echo \$? > \"${logfile}.result\") 2>&1 | tee -a \"${logfile}\" ; exit `cat \"${logfile}.result\"`"
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- SCRIPTS SCM // --SECTION-- SCRIPTS SCM
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -462,14 +469,16 @@ def checkCommitMessages() {
] ]
} }
else { else {
echo "build of branch"
useDocker = false
restrictions = [ restrictions = [
// OS EDITION MAINTAINER // OS EDITION MAINTAINER
"build-linux-community-user" : true,
"build-linux-enterprise-maintainer" : true, "build-linux-enterprise-maintainer" : true,
// OS EDITION MAINTAINER MODE ENGINE // OS EDITION MAINTAINER MODE ENGINE
"test-linux-enterprise-maintainer-cluster-rocksdb" : true, "test-linux-enterprise-maintainer-cluster-rocksdb" : true
"test-linux-community-user-singleserver-mmfiles" : true
] ]
} }
} }
@ -511,6 +520,7 @@ Building Community: ${useCommunity}
Building Enterprise: ${useEnterprise} Building Enterprise: ${useEnterprise}
Building Maintainer: ${useMaintainer} Building Maintainer: ${useMaintainer}
Building Non-Maintainer: ${useUser} Building Non-Maintainer: ${useUser}
Building Docker: ${useDocker}
Running Tests: ${runTests} Running Tests: ${runTests}
""" """
} }
@ -584,7 +594,7 @@ def jslint(os, edition, maintainer) {
def logFile = "${arch}/jslint.log" def logFile = "${arch}/jslint.log"
try { try {
sh "./Installation/Pipeline/test_jslint.sh 2>&1 | tee ${logFile}" shellAndPipe("./Installation/Pipeline/test_jslint.sh",logFile)
sh "if grep ERROR ${logFile}; then exit 1; fi" sh "if grep ERROR ${logFile}; then exit 1; fi"
} }
catch (exc) { catch (exc) {
@ -651,6 +661,12 @@ def getTests(os, edition, maintainer, mode, engine) {
} }
} }
if (mode == "cluster") {
tests += [
["resilience", "resilience", ""]
]
}
return tests return tests
} }
@ -659,7 +675,7 @@ def setupTestEnvironment(os, edition, maintainer, logFile, runDir) {
folderCreateOperation("${runDir}/tmp"), folderCreateOperation("${runDir}/tmp"),
]) ])
def subdirs = ['build', 'etc', 'js', 'UnitTests'] def subdirs = ['build', 'etc', 'js', 'scripts', 'UnitTests']
if (edition == "enterprise") { if (edition == "enterprise") {
subdirs << "enterprise" subdirs << "enterprise"
@ -745,14 +761,15 @@ def executeTests(os, edition, maintainer, mode, engine, portInit, archDir, arch,
powershell "cd ${runDir} ; ${command} | Add-Content -PassThru ${logFile}" powershell "cd ${runDir} ; ${command} | Add-Content -PassThru ${logFile}"
} }
else { else {
sh "echo \"Host: `hostname`\" | tee ${logFile}" sh "echo \"Host: `hostname`\" | tee -a ${logFile}"
sh "echo \"PWD: `pwd`\" | tee -a ${logFile}" sh "echo \"PWD: `pwd`\" | tee -a ${logFile}"
sh "echo \"Date: `date`\" | tee -a ${logFile}" sh "echo \"Date: `date`\" | tee -a ${logFile}"
command = "(cd ${runDir} ; echo 1 > result ; ${command} ; echo \$? > result) 2>&1 | " + shellAndPipe("cd ${runDir} ; ./build/bin/arangosh --version", logFile)
"tee -a ${logFile} ; exit `cat ${runDir}/result`"
command = "(cd ${runDir} ; ${command})"
echo "executing ${command}" echo "executing ${command}"
sh command shellAndPipe(command, logFile)
} }
} }
} }
@ -1032,7 +1049,7 @@ def buildEdition(os, edition, maintainer) {
try { try {
if (os == 'linux' || os == 'mac') { if (os == 'linux' || os == 'mac') {
sh "echo \"Host: `hostname`\" | tee ${logFile}" sh "echo \"Host: `hostname`\" | tee -a ${logFile}"
sh "echo \"PWD: `pwd`\" | tee -a ${logFile}" sh "echo \"PWD: `pwd`\" | tee -a ${logFile}"
sh "echo \"Date: `date`\" | tee -a ${logFile}" sh "echo \"Date: `date`\" | tee -a ${logFile}"
@ -1145,9 +1162,9 @@ def createDockerImage(edition, maintainer, stageName) {
withEnv(["DOCKERTAG=${packageName}-${dockerTag}"]) { withEnv(["DOCKERTAG=${packageName}-${dockerTag}"]) {
try { try {
sh "scripts/build-docker.sh 2>&1 | tee ${logFile}" shellAndPipe("./scripts/build-docker.sh", logFile)
sh "docker tag arangodb:${packageName}-${dockerTag} c1.triagens-gmbh.zz:5000/arangodb/${packageName}:${dockerTag} 2>&1 | tee -a ${logFile}" shellAndPipe("docker tag arangodb:${packageName}-${dockerTag} c1.triagens-gmbh.zz:5000/arangodb/${packageName}:${dockerTag}", logFile)
sh "docker push c1.triagens-gmbh.zz:5000/arangodb/${packageName}:${dockerTag} 2>&1 | tee -a ${logFile}" shellAndPipe("docker push c1.triagens-gmbh.zz:5000/arangodb/${packageName}:${dockerTag}", logFile)
} }
catch (exc) { catch (exc) {
renameFolder(arch, archFail) renameFolder(arch, archFail)
@ -1228,7 +1245,7 @@ def runOperatingSystems(osList) {
def stageName = "build-${name}" def stageName = "build-${name}"
branches[stageName] = runEdition(os, edition, maintainer, stageName) branches[stageName] = runEdition(os, edition, maintainer, stageName)
if (os == 'linux') { if (os == 'linux' && useDocker) {
branches["docker-${name}"] = createDockerImage(edition, maintainer, "docker-${name}") branches["docker-${name}"] = createDockerImage(edition, maintainer, "docker-${name}")
} }
} }