blob: 424f9a3710995c424eff77074aa451668f9c6647 [file] [log] [blame]
#!groovy
fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )
fileRelated.init()
branches = params.ONOSbranch
hours = params.hours
branchList = branches.tokenize( "\n;, " )
script_file = fileRelated.trendCHO
saving_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric5/"
scriptDir = fileRelated.CHOScriptDir
graphScript = generateGraphScript( branchList )
stage( 'Generating-Graph' ){
node( "TestStation-Fabric5s" ){
runScript( graphScript )
}
}
stage( 'posting-result' ){
postJob()
}
def generateGraphScript( branchList ){
graphScript = ''''''
for( branch in branchList ){
branchDir = scriptDir + branch + "/"
graphScript += '''export BRANCH=''' + branchDir + '''
mkdir ''' + branchDir + ''';
if [ ! -f ''' + branchDir + '''existing.txt ]; then
cp *.csv ''' + branchDir + ''';
echo "1" > ''' + branchDir + '''existing.txt;
fi;
bash log-summary;''' + '''
Rscript ''' + script_file + ' ' + branchDir + 'event.csv ' +
branchDir + 'failure.csv ' + branchDir + 'error.csv ' +
branch + ' 60 ' + hours + ' ' + saving_directory + ''';
'''
print( graphScript )
}
return graphScript
}
def runScript( graphScript ){
sh '''#!/bin/bash -l
set -i
set +e
export PYTHONPATH=/home/sdn/TestON:/home/sdn/sts
cd ''' + scriptDir + ''';
''' + graphScript
}
def postJob(){
jobToRun = "postjob-Fabric5"
build job: jobToRun, propagate: false
}