Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 1 | #!groovy |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 2 | |
Devin Lim | 81ab48b | 2018-02-09 14:24:57 -0800 | [diff] [blame] | 3 | funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' ) |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 4 | test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' ) |
| 5 | |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 6 | previous_version = "1.12" |
Devin Lim | 3fa96a9 | 2018-03-16 11:47:58 -0700 | [diff] [blame] | 7 | before_previous_version = "1.11" |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 8 | funcs.initializeTrend( "VM" ); |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 9 | wikiContents = "" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 10 | testcases = [ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 11 | "FUNC" : [ tests : "" , nodeName : "VM", wikiContent : "" ], |
| 12 | "HA" : [ tests : "" , nodeName : "VM", wikiContent : "" ], |
| 13 | "SCPF" : [ tests : "" , nodeName : "BM", wikiContent : "" ], |
| 14 | "SR" : [ tests : "", nodeName : "VM", wikiContent : "" ], |
| 15 | "USECASE" : [ tests : "" , nodeName : "BM", wikiContent : "" ] |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 16 | ] |
| 17 | Prefix_organizer = [ |
| 18 | "FU" : "FUNC", |
| 19 | "HA" : "HA", |
| 20 | "PL" : "USECASE", |
| 21 | "SA" : "USECASE", |
| 22 | "SC" : "SCPF", |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 23 | "SR" : "SR", |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 24 | "US" : "USECASE", |
| 25 | "VP" : "USECASE" |
| 26 | ] |
| 27 | |
Jeremy Ronquillo | cdd177d | 2018-03-09 16:55:44 -0800 | [diff] [blame] | 28 | manually_run = params.manual_run |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 29 | onos_b = "master" |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 30 | test_branch = "" |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 31 | onos_tag = params.ONOSTag |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 32 | isOldFlow = true |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 33 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 34 | // Set tests based on day of week |
Devin Lim | d1fb8e9 | 2018-02-28 16:29:33 -0800 | [diff] [blame] | 35 | def now = funcs.getCurrentTime() |
| 36 | print now.toString() |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 37 | today = now[ Calendar.DAY_OF_WEEK ] |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 38 | |
Jeremy Ronquillo | cdd177d | 2018-03-09 16:55:44 -0800 | [diff] [blame] | 39 | if ( manually_run ){ |
| 40 | onos_b = params.ONOSVersion |
| 41 | } else { |
| 42 | if ( today == Calendar.SATURDAY ){ |
| 43 | onos_b = previous_version |
| 44 | } else if( today == Calendar.SUNDAY ){ |
| 45 | onos_b = before_previous_version |
| 46 | } |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 47 | } |
| 48 | AllTheTests = test_lists.getAllTheTests( onos_b ) |
| 49 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 50 | day = "" |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 51 | SCPF_choices = "" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 52 | USECASE_choices = "" |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 53 | FUNC_choices = "" |
| 54 | HA_choices = "" |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 55 | SR_choices = "" |
| 56 | stat_graph_generator_file = "testCategoryBuildStats.R" |
| 57 | pie_graph_generator_file = "testCategoryPiePassFail.R" |
| 58 | graph_saved_directory = "/var/jenkins/workspace/postjob-VM/" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 59 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 60 | post_result = params.PostResult |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 61 | if( !manually_run ){ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 62 | slackSend( color:'#03CD9F', |
| 63 | message:":sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:\n" |
| 64 | + "Starting tests on : " + now.toString() |
| 65 | + "\n:sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 66 | testDivider( today ) |
| 67 | FUNC_choices = lastCommaRemover( FUNC_choices ) |
| 68 | HA_choices = lastCommaRemover( HA_choices ) |
| 69 | SCPF_choices = lastCommaRemover( SCPF_choices ) |
| 70 | USECASE_choices = lastCommaRemover( USECASE_choices ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 71 | SR_choices = lastCommaRemover( SR_choices ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 72 | } |
| 73 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 74 | if ( manually_run ){ |
| 75 | organize_tests( params.Tests ) |
Jeremy Ronquillo | cdd177d | 2018-03-09 16:55:44 -0800 | [diff] [blame] | 76 | |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 77 | isOldFlow = params.isOldFlow |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 78 | println "Tests to be run manually : " |
| 79 | }else{ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 80 | testcases[ "SCPF" ][ "tests" ] = SCPF_choices |
| 81 | testcases[ "USECASE" ][ "tests" ] = USECASE_choices |
| 82 | testcases[ "FUNC" ][ "tests" ] = FUNC_choices |
| 83 | testcases[ "HA" ][ "tests" ] = HA_choices |
| 84 | testcases[ "SR" ][ "tests" ] = SR_choices |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 85 | println "Defaulting to " + day + " tests:" |
| 86 | } |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 87 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 88 | print_tests( testcases ) |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 89 | |
Devin Lim | 37a8379 | 2017-10-26 16:38:21 -0700 | [diff] [blame] | 90 | def runTest = [ |
| 91 | "VM" : [:], |
| 92 | "BM" : [:] |
| 93 | ] |
| 94 | for( String test in testcases.keySet() ){ |
| 95 | println test |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 96 | if ( testcases[ test ][ "tests" ] != "" ){ |
| 97 | runTest[ testcases[ test ][ "nodeName" ] ][ test ] = trigger_pipeline( onos_b, testcases[ test ][ "tests" ], testcases[ test ][ "nodeName" ], test, manually_run, onos_tag ) |
Devin Lim | 37a8379 | 2017-10-26 16:38:21 -0700 | [diff] [blame] | 98 | } |
| 99 | } |
| 100 | def finalList = [:] |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 101 | finalList[ "VM" ] = runTestSeq( runTest[ "VM" ] ) |
| 102 | finalList[ "BM" ] = runTestSeq( runTest[ "BM" ] ) |
Devin Lim | 37a8379 | 2017-10-26 16:38:21 -0700 | [diff] [blame] | 103 | parallel finalList |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 104 | //finalList[ "BM" ].call() |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 105 | |
| 106 | if ( !manually_run ){ |
Jeremy Ronquillo | f78a6ca | 2018-03-12 09:20:57 -0700 | [diff] [blame] | 107 | funcs.generateStatGraph( funcs.branchWithPrefix( onos_b ), |
| 108 | AllTheTests, |
| 109 | stat_graph_generator_file, |
| 110 | pie_graph_generator_file, |
| 111 | graph_saved_directory ) |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 112 | } |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 113 | |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 114 | def testDivider( today ){ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 115 | switch ( today ) { |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 116 | case Calendar.MONDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 117 | initHtmlForWiki() |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 118 | monday( true ) |
| 119 | tuesday( true, false ) |
| 120 | wednesday( true, false ) |
| 121 | thursday( true, false ) |
| 122 | friday( true, false ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 123 | saturday( false, false ) |
| 124 | sunday( false, false ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 125 | day = "Monday" |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 126 | closeHtmlForWiki() |
| 127 | postToWiki( wikiContents ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 128 | slackSend( color:'#FFD988', message:"Tests to be run this weekdays : \n" + printDaysForTest() ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 129 | break |
| 130 | case Calendar.TUESDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 131 | tuesday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 132 | day = "Tuesday" |
| 133 | break |
| 134 | case Calendar.WEDNESDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 135 | wednesday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 136 | day = "Wednesday" |
| 137 | break |
| 138 | case Calendar.THURSDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 139 | thursday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 140 | day = "Thursday" |
| 141 | break |
| 142 | case Calendar.FRIDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 143 | friday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 144 | day = "Friday" |
| 145 | break |
| 146 | case Calendar.SATURDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 147 | saturday( false, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 148 | day = "Saturday" |
| 149 | break |
| 150 | case Calendar.SUNDAY: |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 151 | sunday( false , true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 152 | day = "Sunday" |
Devin Lim | 3fa96a9 | 2018-03-16 11:47:58 -0700 | [diff] [blame] | 153 | isOldFlow = false |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 154 | break |
| 155 | } |
| 156 | } |
| 157 | def printDaysForTest(){ |
| 158 | result = "" |
| 159 | for ( String test in AllTheTests.keySet() ){ |
| 160 | result += test + " : \n" |
| 161 | for( String each in AllTheTests[ test ].keySet() ){ |
| 162 | AllTheTests[ test ][ each ][ "day" ] = lastCommaRemover( AllTheTests[ test ][ each ][ "day" ] ) |
| 163 | result += " " + each + ":[" + AllTheTests[ test ][ each ][ "day" ] + "]\n" |
| 164 | } |
| 165 | result += "\n" |
| 166 | } |
| 167 | return result |
| 168 | } |
| 169 | def lastCommaRemover( str ){ |
| 170 | if ( str.size() > 0 && str[ str.size() - 1 ] == ',' ){ |
| 171 | str = str.substring( 0,str.size() - 1 ) |
| 172 | } |
| 173 | return str |
| 174 | } |
| 175 | def monday( getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 176 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 177 | FUNC_choices += adder( "FUNC", "basic", true, "M", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 178 | FUNC_choices += adder( "FUNC", "new_Test", true, "M", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 179 | FUNC_choices += adder( "FUNC", "extra_A", true, "M", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 180 | closingHeader( "FUNC" ) |
| 181 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 182 | HA_choices += adder( "HA", "basic", true, "M", getResult ) |
| 183 | HA_choices += adder( "HA", "extra_A", true, "M", getResult ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 184 | //HA_choices += adder( "HA", "new_Test", true, "M", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 185 | closingHeader( "HA" ) |
| 186 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 187 | SCPF_choices += adder( "SCPF", "basic", true, "M", getResult ) |
| 188 | SCPF_choices += adder( "SCPF", "extra_B", true, "M", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 189 | closingHeader( "SCPF" ) |
| 190 | addingHeader( "SR" ) |
| 191 | SR_choices += adder( "SR", "basic", true, "M", getResult ) |
| 192 | closingHeader( "SR" ) |
| 193 | addingHeader( "USECASE" ) |
| 194 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 195 | } |
| 196 | def tuesday( getDay, getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 197 | |
| 198 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 199 | FUNC_choices += adder( "FUNC", "basic", getDay, "T", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 200 | FUNC_choices += adder( "FUNC", "new_Test", getDay, "T", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 201 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "T", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 202 | closingHeader( "FUNC" ) |
| 203 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 204 | HA_choices += adder( "HA", "basic", getDay, "T", getResult ) |
| 205 | HA_choices += adder( "HA", "extra_B", getDay, "T", getResult ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 206 | HA_choices += adder( "HA", "new_Test", getDay, "T", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 207 | closingHeader( "HA" ) |
| 208 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 209 | SCPF_choices += adder( "SCPF", "basic", getDay, "T", getResult ) |
| 210 | SCPF_choices += adder( "SCPF", "extra_C", getDay, "T", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 211 | closingHeader( "SCPF" ) |
| 212 | addingHeader( "SR" ) |
| 213 | SR_choices += adder( "SR", "basic", getDay, "T", getResult ) |
| 214 | closingHeader( "SR" ) |
| 215 | addingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 216 | USECASE_choices += adder( "USECASE", "basic", getDay, "T", getResult ) |
| 217 | USECASE_choices += adder( "USECASE", "extra_A", getDay, "T", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 218 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 219 | } |
| 220 | def wednesday( getDay, getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 221 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 222 | FUNC_choices += adder( "FUNC", "basic", getDay, "W", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 223 | FUNC_choices += adder( "FUNC", "new_Test", getDay, "W", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 224 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "W", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 225 | closingHeader( "FUNC" ) |
| 226 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 227 | HA_choices += adder( "HA", "basic", getDay, "W", getResult ) |
| 228 | HA_choices += adder( "HA", "extra_A", getDay, "W", getResult ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 229 | //HA_choices += adder( "HA", "new_Test", getDay, "W", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 230 | closingHeader( "HA" ) |
| 231 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 232 | SCPF_choices += adder( "SCPF", "basic", getDay, "W", getResult ) |
| 233 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "W", getResult ) |
| 234 | SCPF_choices += adder( "SCPF", "new_Test", getDay, "W", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 235 | closingHeader( "SCPF" ) |
| 236 | addingHeader( "SR" ) |
| 237 | SR_choices += adder( "SR", "basic", getDay, "W", getResult ) |
| 238 | closingHeader( "SR" ) |
| 239 | addingHeader( "USECASE" ) |
| 240 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 241 | } |
| 242 | def thursday( getDay, getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 243 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 244 | FUNC_choices += adder( "FUNC", "basic", getDay, "Th", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 245 | FUNC_choices += adder( "FUNC", "new_Test", getDay, "Th", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 246 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "Th", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 247 | closingHeader( "FUNC" ) |
| 248 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 249 | HA_choices += adder( "HA", "basic", getDay, "Th", getResult ) |
| 250 | HA_choices += adder( "HA", "extra_B", getDay, "Th", getResult ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 251 | HA_choices += adder( "HA", "new_Test", getDay, "Th", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 252 | closingHeader( "HA" ) |
| 253 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 254 | SCPF_choices += adder( "SCPF", "basic", getDay, "Th", getResult ) |
| 255 | SCPF_choices += adder( "SCPF", "extra_B", getDay, "Th", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 256 | closingHeader( "SCPF" ) |
| 257 | addingHeader( "SR" ) |
| 258 | SR_choices += adder( "SR", "basic", getDay, "Th", getResult ) |
| 259 | closingHeader( "SR" ) |
| 260 | addingHeader( "USECASE" ) |
| 261 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 262 | } |
| 263 | def friday( getDay, getResult ){ |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 264 | addingHeader( "FUNC" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 265 | FUNC_choices += adder( "FUNC", "basic", getDay, "F", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 266 | FUNC_choices += adder( "FUNC", "new_Test", getDay, "F", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 267 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "F", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 268 | closingHeader( "FUNC" ) |
| 269 | addingHeader( "HA" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 270 | HA_choices += adder( "HA", "basic", getDay, "F", getResult ) |
| 271 | HA_choices += adder( "HA", "extra_A", getDay, "F", getResult ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 272 | //HA_choices += adder( "HA", "new_Test", getDay, "F", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 273 | closingHeader( "HA" ) |
| 274 | addingHeader( "SCPF" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 275 | SCPF_choices += adder( "SCPF", "basic", getDay, "F", getResult ) |
| 276 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "F", getResult ) |
| 277 | SCPF_choices += adder( "SCPF", "extra_D", getDay, "F", getResult ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 278 | closingHeader( "SCPF" ) |
| 279 | addingHeader( "SR" ) |
| 280 | SR_choices += adder( "SR", "basic", getDay, "F", getResult ) |
| 281 | closingHeader( "SR" ) |
| 282 | addingHeader( "USECASE" ) |
| 283 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 284 | } |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 285 | def saturday( getDay, getResult ){ |
| 286 | addingHeader( "FUNC" ) |
| 287 | FUNC_choices += adder( "FUNC", "basic", getDay, "Sa", getResult ) |
| 288 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "Sa", getResult ) |
| 289 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "Sa", getResult ) |
| 290 | FUNC_choices += adder( "FUNC", "new_Test", getDay, "Sa", getResult ) |
| 291 | closingHeader( "FUNC" ) |
| 292 | addingHeader( "HA" ) |
| 293 | HA_choices += adder( "HA", "basic", getDay, "Sa", getResult ) |
| 294 | HA_choices += adder( "HA", "extra_A", getDay, "Sa", getResult ) |
| 295 | HA_choices += adder( "HA", "extra_B", getDay, "Sa", getResult ) |
| 296 | HA_choices += adder( "HA", "new_Test", getDay, "Sa", getResult ) |
| 297 | closingHeader( "HA" ) |
| 298 | addingHeader( "SCPF" ) |
| 299 | SCPF_choices += adder( "SCPF", "basic", getDay, "Sa", getResult ) |
| 300 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "Sa", getResult ) |
| 301 | SCPF_choices += adder( "SCPF", "extra_B", getDay, "Sa", getResult ) |
| 302 | SCPF_choices += adder( "SCPF", "extra_C", getDay, "Sa", getResult ) |
| 303 | SCPF_choices += adder( "SCPF", "extra_D", getDay, "Sa", getResult ) |
| 304 | SCPF_choices += adder( "SCPF", "new_Test", getDay, "Sa", getResult ) |
| 305 | closingHeader( "SCPF" ) |
| 306 | addingHeader( "SR" ) |
| 307 | SR_choices += adder( "SR", "basic", getDay, "Sa", getResult ) |
| 308 | closingHeader( "SR" ) |
| 309 | addingHeader( "USECASE" ) |
| 310 | USECASE_choices += adder( "USECASE", "basic", getDay, "Sa", getResult ) |
| 311 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 312 | } |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 313 | def sunday( getDay, getResult ){ |
| 314 | addingHeader( "FUNC" ) |
| 315 | FUNC_choices += adder( "FUNC", "basic", getDay, "S", getResult ) |
| 316 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "S", getResult ) |
| 317 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "S", getResult ) |
| 318 | closingHeader( "FUNC" ) |
| 319 | addingHeader( "HA" ) |
| 320 | HA_choices += adder( "HA", "basic", getDay, "S", getResult ) |
| 321 | HA_choices += adder( "HA", "extra_A", getDay, "S", getResult ) |
| 322 | HA_choices += adder( "HA", "extra_B", getDay, "S", getResult ) |
| 323 | closingHeader( "HA" ) |
| 324 | addingHeader( "SCPF" ) |
| 325 | SCPF_choices += adder( "SCPF", "basic", getDay, "S", getResult ) |
| 326 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "S", getResult ) |
| 327 | SCPF_choices += adder( "SCPF", "extra_B", getDay, "S", getResult ) |
| 328 | SCPF_choices += adder( "SCPF", "extra_C", getDay, "S", getResult ) |
| 329 | SCPF_choices += adder( "SCPF", "extra_D", getDay, "S", getResult ) |
| 330 | closingHeader( "SCPF" ) |
| 331 | addingHeader( "SR" ) |
| 332 | SR_choices += adder( "SR", "basic", getDay, "S", getResult ) |
| 333 | closingHeader( "SR" ) |
| 334 | addingHeader( "USECASE" ) |
| 335 | USECASE_choices += adder( "USECASE", "basic", getDay, "S", getResult ) |
| 336 | closingHeader( "USECASE" ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 337 | } |
| 338 | def adder( testCat, set, dayAdding, day, getResult ){ |
| 339 | result = "" |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 340 | for( String test in AllTheTests[ testCat ].keySet() ){ |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 341 | if( AllTheTests[ testCat ][ test ][ set ] ){ |
| 342 | if( getResult ) |
| 343 | result += test + "," |
| 344 | if( dayAdding ) |
| 345 | dayAdder( testCat, test, day ) |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 346 | makeHtmlColList( testCat, test ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 347 | } |
| 348 | } |
| 349 | return result |
| 350 | } |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 351 | def initHtmlForWiki(){ |
| 352 | wikiContents = ''' |
| 353 | <table class="wrapped confluenceTable"> |
| 354 | <colgroup> |
| 355 | <col /> |
| 356 | <col /> |
| 357 | <col /> |
| 358 | <col /> |
| 359 | <col /> |
| 360 | <col /> |
| 361 | </colgroup> |
| 362 | <tbody> |
| 363 | <tr> |
| 364 | <th colspan="1" class="confluenceTh"> |
| 365 | <br /> |
| 366 | </th> |
| 367 | <th class="confluenceTh"><p>Monday</p></th> |
| 368 | <th class="confluenceTh"><p>Tuesday</p></th> |
| 369 | <th class="confluenceTh"><p>Wednesday</p></th> |
| 370 | <th class="confluenceTh"><p>Thursday</p></th> |
| 371 | <th class="confluenceTh"><p>Friday</p></th> |
| 372 | <th class="confluenceTh"><p>Saturday</p></th> |
| 373 | <th class="confluenceTh"><p>Sunday</p></th> |
| 374 | </tr>''' |
| 375 | for( String test in testcases.keySet() ){ |
| 376 | testcases[ test ][ 'wikiContent' ] = ''' |
| 377 | <tr> |
| 378 | <th colspan="1" class="confluenceTh">''' + test + '''</th>''' |
| 379 | } |
| 380 | } |
| 381 | def addingHeader( testCategory ){ |
| 382 | testcases[ testCategory ][ 'wikiContent' ] += ''' |
| 383 | <td class="confluenceTd"> |
| 384 | <ul>''' |
| 385 | } |
| 386 | def makeHtmlColList( testCategory, testName ){ |
| 387 | testcases[ testCategory ][ 'wikiContent' ] += ''' |
| 388 | <li>'''+ testName +'''</li>''' |
| 389 | |
| 390 | } |
| 391 | def closingHeader( testCategory ){ |
| 392 | testcases[ testCategory ][ 'wikiContent' ] += ''' |
| 393 | </ul> |
| 394 | </td>''' |
| 395 | } |
| 396 | def closeHtmlForWiki(){ |
| 397 | for( String test in testcases.keySet() ){ |
| 398 | wikiContents += testcases[ test ][ 'wikiContent' ] |
| 399 | wikiContents += ''' |
| 400 | </tr>''' |
| 401 | } |
| 402 | wikiContents += ''' |
| 403 | </tbody> |
| 404 | </table> |
| 405 | <p><strong>Everyday</strong>, all SegmentRouting tests are built and run on every branch.</p> |
| 406 | <p>On <strong>Weekdays</strong>, all the other tests are built and run on the master branch.</p> |
| 407 | <p>On <strong>Saturdays</strong>, all the other tests are built and run on the '''+ funcs.branchWithPrefix( previous_version ) +''' branch.</p> |
| 408 | <p>On <strong>Sundays</strong>, all the other tests are built and run on the '''+ funcs.branchWithPrefix( before_previous_version ) +''' branch.</p>''' |
| 409 | } |
| 410 | def postToWiki( contents ){ |
| 411 | node( testMachine ){ |
| 412 | workspace = "/var/jenkins/workspace/all-pipeline-trigger/" |
| 413 | filename = "jenkinsSchedule.txt" |
| 414 | writeFile file: workspace + filename, text: contents |
| 415 | funcs.publishToConfluence( "false", "true", |
| 416 | "Automated Test Schedule", |
| 417 | workspace + filename ) |
| 418 | } |
| 419 | } |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 420 | def dayAdder( testCat, testName, dayOfWeek ){ |
| 421 | AllTheTests[ testCat ][ testName ][ "day" ] += dayOfWeek + "," |
| 422 | } |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 423 | def runTestSeq( testList ){ |
| 424 | return{ |
| 425 | for ( test in testList.keySet() ){ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 426 | testList[ test ].call() |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 427 | } |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | def print_tests( tests ){ |
| 432 | for( String test in tests.keySet() ){ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 433 | if( tests[ test ][ "tests" ] != "" ){ |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 434 | println test + ":" |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 435 | println tests[ test ][ "tests" ] |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 436 | } |
| 437 | } |
| 438 | } |
| 439 | def organize_tests( tests ){ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 440 | testList = tests.tokenize( "\n;, " ) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 441 | for( String test in testList ) |
| 442 | testcases [ Prefix_organizer[ ( test == "FUNCbgpls" || test == "FUNCvirNetNB" ? "US" : ( test[ 0 ] + test[ 1 ] ) ) ] ][ "tests" ] += test + "," |
| 443 | } |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 444 | def borrow_mn( jobOn ){ |
| 445 | result = "" |
| 446 | if( jobOn == "SR" ){ |
| 447 | result = "~/cell_borrow.sh" |
| 448 | } |
| 449 | return result |
| 450 | } |
| 451 | def trigger( branch, tests, nodeName, jobOn, manuallyRun, onosTag ){ |
| 452 | println jobOn + "-pipeline-" + manuallyRun ? "manually" : branch |
| 453 | wiki = branch |
Jeremy Ronquillo | f78a6ca | 2018-03-12 09:20:57 -0700 | [diff] [blame] | 454 | branch = funcs.branchWithPrefix( branch ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 455 | test_branch = "master" |
| 456 | node( "TestStation-" + nodeName + "s" ){ |
| 457 | envSetup( branch, test_branch, onosTag, jobOn, manuallyRun ) |
| 458 | |
| 459 | exportEnvProperty( branch, test_branch, wiki, tests, post_result, manuallyRun, onosTag, isOldFlow ) |
| 460 | } |
| 461 | |
| 462 | jobToRun = jobOn + "-pipeline-" + ( manuallyRun ? "manually" : wiki ) |
| 463 | build job: jobToRun, propagate: false |
| 464 | } |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 465 | def trigger_pipeline( branch, tests, nodeName, jobOn, manuallyRun, onosTag ){ |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 466 | // nodeName : "BM" or "VM" |
| 467 | // jobOn : "SCPF" or "USECASE" or "FUNC" or "HA" |
| 468 | return{ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 469 | if( jobOn == "SR" ){ |
Devin Lim | f5bf9b5 | 2018-02-28 18:16:21 -0800 | [diff] [blame] | 470 | trigger( "1.11", tests, nodeName, jobOn, manuallyRun, onosTag ) |
| 471 | trigger( "1.12", tests, nodeName, jobOn, manuallyRun, onosTag ) |
| 472 | trigger( "master", tests, nodeName, jobOn, manuallyRun, onosTag ) |
Devin Lim | d1fb8e9 | 2018-02-28 16:29:33 -0800 | [diff] [blame] | 473 | // returnCell( nodeName ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 474 | }else{ |
| 475 | trigger( branch, tests, nodeName, jobOn, manuallyRun, onosTag ) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 476 | } |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 477 | } |
| 478 | } |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 479 | // export Environment properties. |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 480 | def exportEnvProperty( onos_branch, test_branch, wiki, tests, postResult, manually_run, onosTag, isOldFlow ){ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 481 | stage( "export Property" ){ |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 482 | sh ''' |
| 483 | echo "ONOSBranch=''' + onos_branch +'''" > /var/jenkins/TestONOS.property |
| 484 | echo "TestONBranch=''' + test_branch +'''" >> /var/jenkins/TestONOS.property |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 485 | echo "ONOSTag='''+ onosTag +'''" >> /var/jenkins/TestONOS.property |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 486 | echo "WikiPrefix=''' + wiki +'''" >> /var/jenkins/TestONOS.property |
| 487 | echo "ONOSJVMHeap='''+ env.ONOSJVMHeap +'''" >> /var/jenkins/TestONOS.property |
| 488 | echo "Tests=''' + tests +'''" >> /var/jenkins/TestONOS.property |
| 489 | echo "postResult=''' + postResult +'''" >> /var/jenkins/TestONOS.property |
| 490 | echo "manualRun=''' + manually_run +'''" >> /var/jenkins/TestONOS.property |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 491 | echo "isOldFlow=''' + isOldFlow +'''" >> /var/jenkins/TestONOS.property |
| 492 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 493 | ''' |
| 494 | } |
| 495 | } |
| 496 | // Initialize the environment Setup for the onos and OnosSystemTest |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 497 | def envSetup( onos_branch, test_branch, onos_tag, jobOn, manuallyRun ){ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 498 | stage( "envSetup" ) { |
Devin Lim | f5bf9b5 | 2018-02-28 18:16:21 -0800 | [diff] [blame] | 499 | // after env: ''' + borrow_mn( jobOn ) + ''' |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 500 | sh '''#!/bin/bash -l |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 501 | set +e |
| 502 | . ~/.bashrc |
| 503 | env |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 504 | ''' + preSetup( onos_branch, test_branch, onos_tag, manuallyRun ) + ''' |
Devin Lim | cbba085 | 2017-11-13 10:31:32 -0800 | [diff] [blame] | 505 | ''' + oldFlowCheck( jobOn, onos_branch ) + ''' |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 506 | ''' + postSetup( onos_branch, test_branch, onos_tag, manuallyRun ) |
| 507 | } |
| 508 | } |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 509 | def tagCheck( onos_tag, onos_branch ){ |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 510 | result = "git checkout " |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 511 | if ( onos_tag == "" ) |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 512 | result += onos_branch //create new local branch |
| 513 | else |
| 514 | result += onos_tag //checkout the tag |
| 515 | return result |
| 516 | } |
| 517 | def preSetup( onos_branch, test_branch, onos_tag, isManual ){ |
| 518 | result = "" |
| 519 | if( !isManual ){ |
| 520 | result = '''echo -e "\n##### Set TestON Branch #####" |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 521 | echo "TestON Branch is set on: ''' + test_branch + '''" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 522 | |
| 523 | cd ~/OnosSystemTest/ |
| 524 | git checkout HEAD~1 # Make sure you aren't pn a branch |
| 525 | git branch | grep -v "detached from" | xargs git branch -d # delete all local branches merged with remote |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 526 | git branch -D ''' + test_branch + ''' # just incase there are local changes. This will normally result in a branch not found error |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 527 | git clean -df # clean any local files |
| 528 | git fetch --all # update all caches from remotes |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 529 | git reset --hard origin/''' + test_branch +''' # force local index to match remote branch |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 530 | git clean -df # clean any local files |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 531 | git checkout ''' + test_branch + ''' #create new local branch |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 532 | git branch |
| 533 | git log -1 --decorate |
| 534 | |
| 535 | |
| 536 | echo -e "\n##### Set ONOS Branch #####" |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 537 | echo "ONOS Branch is set on: ''' + onos_branch + '''" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 538 | |
| 539 | echo -e "\n #### check karaf version ######" |
| 540 | env |grep karaf |
| 541 | |
| 542 | cd ~/onos |
| 543 | rm -rf buck-out/* |
| 544 | ~/onos/tools/build/onos-buck clean |
| 545 | git checkout HEAD~1 # Make sure you aren't pn a branch |
| 546 | git branch | grep -v "detached from" | xargs git branch -d # delete all local branches merged with remote |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 547 | git branch -D ''' + onos_branch + ''' # just incase there are local changes. This will normally result in a branch not found error |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 548 | git clean -df # clean any local files |
| 549 | git fetch --all # update all caches from remotes |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 550 | git reset --hard origin/''' + onos_branch + ''' # force local index to match remote branch |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 551 | git clean -df # clean any local files |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 552 | ''' + tagCheck( onos_tag, onos_branch ) + ''' |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 553 | git branch |
| 554 | git log -1 --decorate |
| 555 | |
| 556 | |
| 557 | echo -e "\n##### set jvm heap size to 8G #####" |
| 558 | echo ${ONOSJVMHeap} |
| 559 | |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 560 | inserted_line="export JAVA_OPTS=\"\${ONOSJVMHeap}\"" |
| 561 | sed -i "s/bash/bash\\n$inserted_line/" ~/onos/tools/package/bin/onos-service |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 562 | |
| 563 | echo "##### Check onos-service setting..... #####" |
| 564 | cat ~/onos/tools/package/bin/onos-service |
| 565 | |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 566 | export JAVA_HOME=/usr/lib/jvm/java-8-oracle''' |
| 567 | } |
| 568 | return result |
| 569 | } |
Devin Lim | cbba085 | 2017-11-13 10:31:32 -0800 | [diff] [blame] | 570 | def oldFlowCheck( jobOn, onos_branch ){ |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 571 | result = "" |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 572 | if( jobOn == "SCPF" && ( onos_branch== "master" || onos_branch=="onos-1.12" ) ) |
| 573 | result = '''sed -i -e 's/@Component(immediate = true)/@Component(enabled = false)/g' ~/onos/core/store/dist/src/main/java/org/onosproject/store/flow/impl/''' + ( isOldFlow ? "DistributedFlowRuleStore" : "ECFlowRuleStore" ) + '''.java |
| 574 | sed -i -e 's/@Component(enabled = false)/@Component(immediate = true)/g' ~/onos/core/store/dist/src/main/java/org/onosproject/store/flow/impl/''' + ( isOldFlow ? "ECFlowRuleStore" : "DistributedFlowRuleStore" ) + ".java" |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 575 | return result |
| 576 | } |
| 577 | def postSetup( onos_branch, test_branch, onos_tag, isManual ){ |
| 578 | result = "" |
| 579 | if( !isManual ){ |
| 580 | result = '''echo -e "\n##### build ONOS skip unit tests ######" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 581 | #mvn clean install -DskipTests |
| 582 | # Force buck update |
| 583 | rm -f ~/onos/bin/buck |
| 584 | ~/onos/tools/build/onos-buck build onos |
| 585 | |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 586 | sleep 30 |
| 587 | echo -e "\n##### Stop all running instances of Karaf #####" |
| 588 | kill $(ps -efw | grep karaf | grep -v grep | awk '{print $2}') |
| 589 | sleep 30 |
| 590 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 591 | git branch''' |
| 592 | } |
Devin Lim | 37a8379 | 2017-10-26 16:38:21 -0700 | [diff] [blame] | 593 | return result |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 594 | } |
| 595 | def returnCell( nodeName ){ |
| 596 | node( "TestStation-" + nodeName + "s" ){ |
| 597 | sh '''#!/bin/bash -l |
| 598 | set +e |
| 599 | . ~/.bashrc |
| 600 | env |
| 601 | ~/./return_cell.sh |
| 602 | ''' |
| 603 | } |
Devin Lim | 3fa96a9 | 2018-03-16 11:47:58 -0700 | [diff] [blame] | 604 | } |