blob: 2811a48792a1f4c6a0b9c875e798f8cd36fbc11d [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 Lim64a2eca2018-05-10 18:44:52 -070026 bash log-summary;''' + '''
27 ''' + script_file + ' ' + branchDir + 'event.csv ' +
28 branchDir + 'failure.csv ' + branchDir + 'error.csv ' +
29 branch + ' 60 ' + saving_directory + ''';
30 '''
31 print( graphScript )
32 }
33 return graphScript
34}
35def runScript( graphScript ){
36 sh '''#!/bin/bash -l
37 set -i
38 set +e
39 export PYTHONPATH=/home/sdn/TestON:/home/sdn/sts
Devin Limd482df72018-05-11 13:52:34 -070040 cd ''' + scriptDir + ''';
41 ''' + graphScript
Devin Lim64a2eca2018-05-10 18:44:52 -070042}
43def postJob(){
44 jobToRun = "postjob-Fabric5"
45 build job: jobToRun, propagate: false
46}