8000 Feature/jenkins pipeline by fceller · Pull Request #3338 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Feature/jenkins pipeline #3338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 28, 2017
90 changes: 45 additions & 45 deletions Installation/Pipeline/Jenkinsfile.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def defaultLinux = true
def defaultMac = false
def defaultWindows = false
def defaultBuild = true
def defaultDocker = false
def defaultCleanBuild = false
def defaultCommunity = true
def defaultEnterprise = true
Expand All @@ -36,6 +37,11 @@ properties([
description: 'build and run tests in Windows',
name: 'Windows'
),
booleanParam(
defaultValue: defaultDocker,
description: 'build docker images',
name: 'Docker'
),
booleanParam(
defaultValue: defaultCleanBuild,
description: 'clean build directories',
Expand Down < 10000 tool-tip id="tooltip-d307592f-8882-4690-9295-7cb8aee1e3b7" for="expand-up-link-20-diff-d711bcf6ea5f18781c2840ae189bab926df0f7defd8d92a8304b51c025b046d5" popover="manual" data-direction="ne" data-type="label" data-view-component="true" class="sr-only position-absolute">Expand Up @@ -86,6 +92,9 @@ useMac = params.Mac
// build windows
useWindows = params.Windows

// build docker image
useDocker = params.Docker

// build and test community
useCommunity = params.Community

Expand All @@ -98,9 +107,6 @@ useMaintainer = params.Maintainer
// build user mode
useUser = params.User

// build docker
useDocker = true

// run resilience tests
//runResilience = params.runResilience

Expand Down Expand Up @@ -318,7 +324,10 @@ def deleteDirDocker(os) {
}

def shellAndPipe(command, logfile) {
sh "(echo 1 > \"${logfile}.result\" ; ${command} ; echo \$? > \"${logfile}.result\") 2>&1 | tee -a \"${logfile}\" ; exit `cat \"${logfile}.result\"`"
def cmd = command.replaceAll(/"/, "\\\"")

echo "executing ${cmd}"
sh "(echo 1 > \"${logfile}.result\" ; ${cmd} ; echo \$? > \"${logfile}.result\") 2>&1 | ts '[%Y-%m-%d %H:%M:%S]' | tee -a \"${logfile}\" ; exit `cat \"${logfile}.result\"`"
}

def logStartStage(os, logFile, link) {
Expand All @@ -331,7 +340,7 @@ def logStartStage(os, logFile, link) {
echo "started ${logFile}: ${resultsStart[logFile]}"

if (os == "linux") {
sh "echo 'started ${logFile}: ${resultsStart[logFile]}' | tee -a ${logFile}"
shellAndPipe("echo 'started ${logFile}: ${resultsStart[logFile]}'", logFile)
}

generateResult()
Expand All @@ -344,7 +353,7 @@ def logStopStage(os, logFile) {
echo "finished ${logFile}: ${resultsStop[logFile]}"

if (os == "linux") {
sh "echo 'finished ${logFile}: ${resultsStop[logFile]}' | tee -a ${logFile}"
shellAndPipe("echo 'finished ${logFile}: ${resultsStop[logFile]}'", logFile)
}

generateResult()
Expand All @@ -363,7 +372,7 @@ def logExceptionStage(os, logFile, link, exc) {
echo "failed ${logFile}: ${resultsStop[logFile]} ${msg}"

if (os == "linux") {
sh "echo 'failed ${logFile}: ${resultsStart[logFile]} ${msg}' | tee -a ${logFile}"
shellAndPipe("echo 'failed ${logFile}: ${resultsStart[logFile]} ${msg}'", logFile)
}

generateResult()
Expand All @@ -387,21 +396,21 @@ def generateResult() {
def diff = (start != "" && stop != "") ? groovy.time.TimeCategory.minus(stop, start) : "-"
def startf = start == "" ? "-" : start.format('yyyy/MM/dd HH:mm:ss')
def stopf = stop == "" ? "-" : stop.format('yyyy/MM/dd HH:mm:ss')
def color = 'bgcolor="#FF8080"'
def color = 'bgcolor="#FFA0A0"'

def la = ""
def lb = ""

if (link != null) {
if (link != "") {
la = "<a href=\"$link\">"
lb = "</a>"
}

if (msg == "finished") {
color = 'bgcolor="#80FF80"'
color = 'bgcolor="#A0FFA0"'
}
else if (msg == "started") {
color = 'bgcolor="#8080FF"'
color = 'bgcolor="#A0A0FF"'
la = ""
lb = ""
}
Expand Down Expand Up @@ -444,6 +453,7 @@ def checkoutCommunity(os) {
}
catch (exc) {
echo "GITHUB checkout failed, retrying in 1min"
deleteDir()
sleep 60
throw exc
}
Expand Down Expand Up @@ -608,7 +618,8 @@ def checkCommitMessages() {
"build-linux-enterprise-maintainer" : true,

// OS EDITION MAINTAINER MODE ENGINE
"test-linux-enterprise-maintainer-cluster-rocksdb" : true
"test-linux-enterprise-maintainer-singleserver-rocksdb" : true,
"test-linux-enterprise-maintainer-cluster-mmfiles" : true
]
}
}
Expand Down Expand Up @@ -762,7 +773,7 @@ def jslint(os, edition, maintainer) {
try {
logStartStage(os, logFile, logFile)

shellAndPipe("./Installation/Pipeline/test_jslint.sh",logFile)
shellAndPipe("./Installation/Pipeline/test_jslint.sh", logFile)
sh "if grep ERROR ${logFile}; then exit 1; fi"

logStopStage(os, logFile)
Expand Down Expand Up @@ -918,9 +929,9 @@ def singleTest(os, edition, maintainer, mode, engine, test, testArgs, testIndex,
powershell "cd ${runDir} ; ${command} | Add-Content -PassThru ${logFile}"
}
else {
sh "echo \"Host: `hostname`\" | tee -a ${logFile}"
sh "echo \"PWD: `pwd`\" | tee -a ${logFile}"
sh "echo \"Date: `date`\" | tee -a ${logFile}"
shellAndPipe("echo \"Host: `hostname`\"", logFile)
shellAndPipe("echo \"PWD: `pwd`\"", logFile)
shellAndPipe("echo \"Date: `date`\"", logFile)

shellAndPipe("cd ${runDir} ; ./build/bin/arangosh --version", logFile)

Expand Down Expand Up @@ -1014,7 +1025,9 @@ def executeTests(os, edition, maintainer, mode, engine, stageName) {

testIndex++

testMap["${stageName}-${name}"] = singleTest(os, edition, maintainer, mode, engine, test, testArgs, testIndex, stageName, name, port)
testMap["${stageName}-${name}"] = singleTest(os, edition, maintainer, mode, engine,
test, testArgs, testIndex,
stageName, name, port)

return testMap
}
Expand Down Expand Up @@ -1073,14 +1086,16 @@ def testStepParallel(os, edition, maintainer, modeList) {

def name = "test-${os}-${edition}-${maintainer}"

try {
logStartStage(null, name, null)
parallel branches
logStopStage(null, name)
}
catch (exc) {
logExceptionStage(null, name, null, exc)
throw exc
if (branches) {
try {
logStartStage(null, name, null)
parallel branches
logStopStage(null, name)
}
catch (exc) {
logExceptionStage(null, name, null, exc)
throw exc
}
}
}

Expand Down Expand Up @@ -1234,33 +1249,18 @@ def buildEdition(os, edition, maintainer) {
unstashBuild(os, edition, maintainer)
}

sh "echo \"Host: `hostname`\" | tee -a ${logFile}"
sh "echo \"PWD: `pwd`\" | tee -a ${logFile}"
sh "echo \"Date: `date`\" | tee -a ${logFile}"
shellAndPipe("echo \"Host: `hostname`\"", logFile)
shellAndPipe("echo \"PWD: `pwd`\"", logFile)
shellAndPipe("echo \"Date: `date`\"", logFile)

if (os == 'linux') {
sh "./Installation/Pipeline/build_OS_EDITION_MAINTAINER.sh 64 ${os} ${edition} ${maintainer} ${arch}"
shellAndPipe("./Installation/Pipeline/build_OS_EDITION_MAINTAINER.sh 64 ${os} ${edition} ${maintainer}", logFile)
}
else if (os == 'mac') {
sh "./Installation/Pipeline/build_OS_EDITION_MAINTAINER.sh 16 ${os} ${edition} ${maintainer} ${arch}"
shellAndPipe("./Installation/Pipeline/build_OS_EDITION_MAINTAINER.sh 16 ${os} ${edition} ${maintainer}", logFile)
}
}
else if (os == 'windows') {
// def tmpDir = "${arch}/tmp"

// fileOperations([
// folderCreateOperation(tmpDir)
// ])

// withEnv(["TMPDIR=${tmpDir}", "TEMPDIR=${tmpDir}", "TMP=${tmpDir}",
// "_MSPDBSRV_ENDPOINT_=${edition}-${env.BUILD_TAG}", "GYP_USE_SEPARATE_MSPDBSRV=1"]) {
// powershell ". .\\Installation\\Pipeline\\windows\\build_${os}_${edition}.ps1"
// }

// fileOperations([
// folderDeleteOperation(tmpDir)
// ])

powershell ". .\\Installation\\Pipeline\\windows\\build_${os}_${edition}_${maintainer}.ps1"
}

Expand Down
29 changes: 5 additions & 24 deletions Installation/Pipeline/build_OS_EDITION_MAINTAINER.sh
1E0A
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ concurrency=$1
os=$2
edition=$3
maintainer=$4
logdir=$5

ENTERPRISE=""
type="build"
Expand Down Expand Up @@ -62,17 +61,9 @@ rm -f $GENPATH
ln -s `pwd` $GENPATH
cd $GENPATH

if [ -z "$logdir" ]; then
logdir=log-output
rm -rf $logdir
mkdir -p $logdir
fi

touch $logdir/build.log

echo "CONCURRENY: $concurrency" | tee -a $logdir/build.log
echo "HOST: `hostname`" | tee -a $logdir/build.log
echo "PWD: `pwd`" | tee -a $logdir/build.log
echo "CONCURRENY: $concurrency"
echo "HOST: `hostname`"
echo "PWD: `pwd`"

function configureBuild {
echo "`date +%T` configuring..."
Expand All @@ -85,7 +76,7 @@ function configureBuild {
$ENTERPRISE \
$MAINTAINER \
$PACKAGING \
.. 2>&1 | tee -a ../$logdir/build.log
..
}

(
Expand All @@ -94,18 +85,8 @@ function configureBuild {

configureBuild

if grep -q "Re-run cmake with a different source directory" ../$logdir/build.log; then
cd ..
mv build/location location.$$
rm -rf build
mkdir build
mv location.$$ build
cd build
configureBuild
fi

echo "`date +%T` building..."
make -j $concurrency -l $load 2>&1 | tee -a ../$logdir/build.log
make -j $concurrency -l $load 2>&1
) || exit 1

echo "`date +%T` done..."
0