blob: 5f45c32b2592773b1202ebef0e3fe625414518fd [file] [log] [blame]
Devin Lim64a2eca2018-05-10 18:44:52 -07001#!groovy
2
3branches = params.ONOSbranch
4branchList = branches.tokenize( "\n;, " )
5script_file = "TestON/JenkinsFile/wikiGraphRScripts/trendCHO.R"
6saving_directory = "/var/jenkins/workspace/postjob-Fabric5/"
7scriptDir = "~/CHO_Jenkins_Scripts/"
8
9graphScript = generateGraphScript( branchList )
10
11stage( 'Generating-Graph' ){
12 node( "TestStation-Fabric5s" ){
13 runScript( graphScript )
14 }
15}
16stage( 'posting-result' ){
17 postJob()
18}
19
20def generateGraphScript( branchList ){
21 graphScript = ''''''
22 for( branch in branchList ){
23 branchDir = scriptDir + branch + "/"
Devin Limd482df72018-05-11 13:52:34 -070024 graphScript += '''export BRANCH=''' + branchDir + '''
25 mkdir ''' + branchDir + ''';
Devin Lim21681b82018-05-11 14:20:06 -070026 cp *.csv ''' + branchDir + ''';
Devin Lim64a2eca2018-05-10 18:44:52 -070027 bash log-summary;''' + '''
28 ''' + script_file + ' ' + branchDir + 'event.csv ' +
29 branchDir + 'failure.csv ' + branchDir + 'error.csv ' +
30 branch + ' 60 ' + saving_directory + ''';
31 '''
32 print( graphScript )
33 }
34 return graphScript
35}
36def runScript( graphScript ){
37 sh '''#!/bin/bash -l
38 set -i
39 set +e
40 export PYTHONPATH=/home/sdn/TestON:/home/sdn/sts
Devin Limd482df72018-05-11 13:52:34 -070041 cd ''' + scriptDir + ''';
42 ''' + graphScript
Devin Lim64a2eca2018-05-10 18:44:52 -070043}
44def postJob(){
45 jobToRun = "postjob-Fabric5"
46 build job: jobToRun, propagate: false
47}