Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 1 | #!groovy |
| 2 | // This is a Jenkinsfile for a scripted pipeline for the SCPF tests |
| 3 | // Define sets of tests |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 4 | AllTheTests= |
| 5 | [ |
| 6 | "FUNC":[ |
| 7 | "FUNCipv6Intent" : ["basic":true, "extra_A":false, "extra_B":false, "day":""], |
| 8 | "FUNCoptical" : ["basic":true, "extra_A":false, "extra_B":false, "day":""], |
| 9 | "FUNCflow" : ["basic":true, "extra_A":false, "extra_B":false, "day":""], |
| 10 | "FUNCnetCfg": ["basic":true, "extra_A":false, "extra_B":false, "day":""], |
| 11 | "FUNCovsdbtest" : ["basic":true, "extra_A":false, "extra_B":false, "day":""], |
| 12 | "FUNCnetconf" : ["basic":true, "extra_A":false, "extra_B":false, "day":""], |
| 13 | "FUNCgroup" : ["basic":true, "extra_A":false, "extra_B":false, "day":""], |
| 14 | "FUNCintent" : ["basic":false, "extra_A":true, "extra_B":false, "day":""], |
| 15 | "FUNCintentRest" : ["basic":false, "extra_A":false, "extra_B":true, "day":""] |
| 16 | ], |
| 17 | "HA":[ |
| 18 | "HAsanity" : ["basic":true, "extra_A":false, "extra_B":false, "day":""], |
| 19 | "HAclusterRestart" : ["basic":true, "extra_A":false, "extra_B":false, "day":""], |
| 20 | "HAsingleInstanceRestart" : ["basic":true, "extra_A":false, "extra_B":false, "day":""], |
| 21 | "HAstopNodes" : ["basic":false, "extra_A":true, "extra_B":false, "day":""], |
| 22 | "HAfullNetPartition" : ["basic":false, "extra_A":true, "extra_B":false, "day":""], |
| 23 | "HAswapNodes" : ["basic":false, "extra_A":false, "extra_B":true, "day":""], |
| 24 | "HAscaling" : ["basic":false, "extra_A":false, "extra_B":true, "day":""], |
| 25 | "HAkillNodes" : ["basic":false, "extra_A":false, "extra_B":true, "day":""] |
| 26 | ], |
| 27 | "SCPF":[ |
| 28 | "SCPFswitchLat": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 29 | "SCPFcbench": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 30 | "SCPFportLat": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 31 | "SCPFflowTp1g": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 32 | "SCPFintentEventTp": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 33 | "SCPFhostLat": ["basic":false, "extra_A":true, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 34 | // batch will be on extra_A after fixing from the ONOS side. |
| 35 | "SCPFbatchFlowResp": ["basic":false, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 36 | "SCPFintentRerouteLat": ["basic":false, "extra_A":true, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 37 | "SCPFintentInstallWithdrawLat": ["basic":false, "extra_A":true, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 38 | "SCPFflowTp1gWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 39 | "SCPFintentEventTpWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 40 | "SCPFintentRerouteLatWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 41 | "SCPFscalingMaxIntentsWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 42 | "SCPFintentInstallWithdrawLatWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 43 | "SCPFscaleTopo": ["basic":false, "extra_A":false, "extra_B":false, "extra_C":true, "extra_D":false, "new_Test":false, day:""], |
| 44 | "SCPFscalingMaxIntents": ["basic":false, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":true, "new_Test":false, day:""], |
| 45 | "SCPFmastershipFailoverLat": ["basic":false, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":true, day:""] |
| 46 | ], |
| 47 | "USECASE":[ |
| 48 | "FUNCvirNetNB" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 49 | "FUNCbgpls" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 50 | "VPLSBasic" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 51 | "USECASE_SdnipFunction": ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 52 | "USECASE_SdnipFunctionCluster": ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 53 | "PLATdockertest": ["basic":false, "extra_A":true, "extra_B":false, "new_Test":false, "day":""], |
| 54 | "SRSanity": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 55 | "SRSwitchFailure": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 56 | "SRLinkFailure": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 57 | "SROnosFailure": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 58 | "SRClusterRestart": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 59 | "SRDynamic": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 60 | "SRHighAvailability": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 61 | "VPLSfailsafe" : ["basic":false, "extra_A":false, "extra_B":false, "new_Test":true, "day":""] |
| 62 | ] |
| 63 | ] |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 64 | testcases = [ |
| 65 | "FUNC" : [ tests : "" , nodeName : "VM"], |
| 66 | "HA" : [ tests : "" , nodeName : "VM"], |
| 67 | "SCPF" : [ tests : "" , nodeName : "BM"], |
| 68 | "USECASE" : [ tests : "" , nodeName : "BM"] |
| 69 | ] |
| 70 | Prefix_organizer = [ |
| 71 | "FU" : "FUNC", |
| 72 | "HA" : "HA", |
| 73 | "PL" : "USECASE", |
| 74 | "SA" : "USECASE", |
| 75 | "SC" : "SCPF", |
| 76 | "SR" : "USECASE", |
| 77 | "US" : "USECASE", |
| 78 | "VP" : "USECASE" |
| 79 | ] |
| 80 | |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 81 | onos_branch = "master" |
| 82 | onos_tag = params.ONOSTag |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 83 | // Set tests based on day of week |
| 84 | def now = new Date() |
| 85 | echo(now.toString()) |
| 86 | today = now[Calendar.DAY_OF_WEEK] |
| 87 | day = "" |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 88 | SCPF_choices = "" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 89 | USECASE_choices = "" |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 90 | FUNC_choices = "" |
| 91 | HA_choices = "" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 92 | |
| 93 | manually_run = params.manual_run |
| 94 | post_result = params.PostResult |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 95 | if( !manually_run ){ |
| 96 | sendToSlack( '#03CD9F', ":sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:\n" |
| 97 | + "Starting tests on : " + now.toString() |
| 98 | + "\n:sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:" ) |
| 99 | testDivider( today ) |
| 100 | FUNC_choices = lastCommaRemover( FUNC_choices ) |
| 101 | HA_choices = lastCommaRemover( HA_choices ) |
| 102 | SCPF_choices = lastCommaRemover( SCPF_choices ) |
| 103 | USECASE_choices = lastCommaRemover( USECASE_choices ) |
| 104 | } |
| 105 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 106 | if ( manually_run ){ |
| 107 | organize_tests( params.Tests ) |
| 108 | onos_branch = params.ONOSVersion |
| 109 | test_branch = params.TestONBranch |
| 110 | println "Tests to be run manually : " |
| 111 | }else{ |
| 112 | testcases["SCPF"]["tests"] = SCPF_choices |
| 113 | testcases["USECASE"]["tests"] = USECASE_choices |
| 114 | testcases["FUNC"]["tests"] = FUNC_choices |
| 115 | testcases["HA"]["tests"] = HA_choices |
| 116 | println "Defaulting to " + day + " tests:" |
| 117 | } |
| 118 | print_tests( testcases ) |
| 119 | |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 120 | def testDivider( today ){ |
| 121 | switch (today) { |
| 122 | case Calendar.MONDAY: |
| 123 | monday( true ) |
| 124 | tuesday( true, false ) |
| 125 | wednesday( true, false ) |
| 126 | thursday( true, false ) |
| 127 | friday( true, false ) |
| 128 | day = "Monday" |
| 129 | sendToSlack( '#FFD988', "Tests to be run this weekdays : \n" + printDaysForTest() ) |
| 130 | break |
| 131 | case Calendar.TUESDAY: |
| 132 | tuesday( true, true ) |
| 133 | day = "Tuesday" |
| 134 | break |
| 135 | case Calendar.WEDNESDAY: |
| 136 | wednesday( true, true ) |
| 137 | day = "Wednesday" |
| 138 | break |
| 139 | case Calendar.THURSDAY: |
| 140 | thursday( true, true) |
| 141 | day = "Thursday" |
| 142 | break |
| 143 | case Calendar.FRIDAY: |
| 144 | friday( true, true) |
| 145 | day = "Friday" |
| 146 | break |
| 147 | case Calendar.SATURDAY: |
| 148 | saturday() |
| 149 | onos_branch= "1.11" |
| 150 | day = "Saturday" |
| 151 | break |
| 152 | case Calendar.SUNDAY: |
| 153 | sunday() |
| 154 | onos_branch= "1.10" |
| 155 | day = "Sunday" |
| 156 | break |
| 157 | } |
| 158 | } |
| 159 | def printDaysForTest(){ |
| 160 | result = "" |
| 161 | for ( String test in AllTheTests.keySet() ){ |
| 162 | result += test + " : \n" |
| 163 | for( String each in AllTheTests[ test ].keySet() ){ |
| 164 | AllTheTests[ test ][ each ][ "day" ] = lastCommaRemover( AllTheTests[ test ][ each ][ "day" ] ) |
| 165 | result += " " + each + ":[" + AllTheTests[ test ][ each ][ "day" ] + "]\n" |
| 166 | } |
| 167 | result += "\n" |
| 168 | } |
| 169 | return result |
| 170 | } |
| 171 | def lastCommaRemover( str ){ |
| 172 | if ( str.size() > 0 && str[ str.size() - 1 ] == ',' ){ |
| 173 | str = str.substring( 0,str.size() - 1 ) |
| 174 | } |
| 175 | return str |
| 176 | } |
| 177 | def monday( getResult ){ |
| 178 | FUNC_choices += adder( "FUNC", "basic", true, "M", getResult ) |
| 179 | FUNC_choices += adder( "FUNC", "extra_A", true, "M", getResult ) |
| 180 | HA_choices += adder( "HA", "basic", true, "M", getResult ) |
| 181 | HA_choices += adder( "HA", "extra_A", true, "M", getResult ) |
| 182 | SCPF_choices += adder( "SCPF", "basic", true, "M", getResult ) |
| 183 | SCPF_choices += adder( "SCPF", "extra_B", true, "M", getResult ) |
| 184 | } |
| 185 | def tuesday( getDay, getResult ){ |
| 186 | FUNC_choices += adder( "FUNC", "basic", getDay, "T", getResult ) |
| 187 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "T", getResult ) |
| 188 | HA_choices += adder( "HA", "basic", getDay, "T", getResult ) |
| 189 | HA_choices += adder( "HA", "extra_B", getDay, "T", getResult ) |
| 190 | SCPF_choices += adder( "SCPF", "basic", getDay, "T", getResult ) |
| 191 | SCPF_choices += adder( "SCPF", "extra_C", getDay, "T", getResult ) |
| 192 | USECASE_choices += adder( "USECASE", "basic", getDay, "T", getResult ) |
| 193 | USECASE_choices += adder( "USECASE", "extra_A", getDay, "T", getResult ) |
| 194 | USECASE_choices += adder( "USECASE", "new_Test", getDay, "T", getResult ) |
| 195 | } |
| 196 | def wednesday( getDay, getResult ){ |
| 197 | FUNC_choices += adder( "FUNC", "basic", getDay, "W", getResult ) |
| 198 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "W", getResult ) |
| 199 | HA_choices += adder( "HA", "basic", getDay, "W", getResult ) |
| 200 | HA_choices += adder( "HA", "extra_A", getDay, "W", getResult ) |
| 201 | SCPF_choices += adder( "SCPF", "basic", getDay, "W", getResult ) |
| 202 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "W", getResult ) |
| 203 | SCPF_choices += adder( "SCPF", "new_Test", getDay, "W", getResult ) |
| 204 | } |
| 205 | def thursday( getDay, getResult ){ |
| 206 | FUNC_choices += adder( "FUNC", "basic", getDay, "Th", getResult ) |
| 207 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "Th", getResult ) |
| 208 | HA_choices += adder( "HA", "basic", getDay, "Th", getResult ) |
| 209 | HA_choices += adder( "HA", "extra_B", getDay, "Th", getResult ) |
| 210 | SCPF_choices += adder( "SCPF", "basic", getDay, "Th", getResult ) |
| 211 | SCPF_choices += adder( "SCPF", "extra_B", getDay, "Th", getResult ) |
| 212 | } |
| 213 | def friday( getDay, getResult ){ |
| 214 | FUNC_choices += adder( "FUNC", "basic", getDay, "F", getResult ) |
| 215 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "F", getResult ) |
| 216 | HA_choices += adder( "HA", "basic", getDay, "F", getResult ) |
| 217 | HA_choices += adder( "HA", "extra_A", getDay, "F", getResult ) |
| 218 | SCPF_choices += adder( "SCPF", "basic", getDay, "F", getResult ) |
| 219 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "F", getResult ) |
| 220 | SCPF_choices += adder( "SCPF", "extra_D", getDay, "F", getResult ) |
| 221 | } |
| 222 | def saturday(){ |
| 223 | FUNC_choices += adder( "FUNC", "basic", false, "Sa", true ) |
| 224 | FUNC_choices += adder( "FUNC", "extra_A", false, "Sa", true ) |
| 225 | FUNC_choices += adder( "FUNC", "extra_B", false, "Sa", true ) |
| 226 | HA_choices += adder( "HA", "basic", false, "Sa", true ) |
| 227 | HA_choices += adder( "HA", "extra_A", false, "Sa", true ) |
| 228 | HA_choices += adder( "HA", "extra_B", false, "Sa", true ) |
| 229 | SCPF_choices += adder( "SCPF", "basic", false, "Sa", true ) |
| 230 | SCPF_choices += adder( "SCPF", "extra_A", false, "Sa", true ) |
| 231 | SCPF_choices += adder( "SCPF", "extra_B", false, "Sa", true ) |
| 232 | SCPF_choices += adder( "SCPF", "extra_C", false, "Sa", true ) |
| 233 | SCPF_choices += adder( "SCPF", "extra_D", false, "Sa", true ) |
| 234 | SCPF_choices += adder( "SCPF", "new_Test", false, "Sa", true ) |
| 235 | USECASE_choices += adder( "USECASE", "basic", false, "Sa", true ) |
| 236 | USECASE_choices += adder( "USECASE", "new_Test", false, "Sa", true ) |
| 237 | } |
| 238 | def sunday(){ |
| 239 | FUNC_choices += adder( "FUNC", "basic", false, "S", true ) |
| 240 | FUNC_choices += adder( "FUNC", "extra_A", false, "S", true ) |
| 241 | FUNC_choices += adder( "FUNC", "extra_B", false, "S", true ) |
| 242 | HA_choices += adder( "HA", "basic", false, "S", true ) |
| 243 | HA_choices += adder( "HA", "extra_A", false, "S", true ) |
| 244 | HA_choices += adder( "HA", "extra_B", false, "S", true ) |
| 245 | SCPF_choices += adder( "SCPF", "basic", false, "S", true ) |
| 246 | USECASE_choices += adder( "USECASE", "basic", false, "S", true ) |
| 247 | } |
| 248 | def adder( testCat, set, dayAdding, day, getResult ){ |
| 249 | result = "" |
| 250 | for( String test in AllTheTests[ testCat ].keySet() ){ |
| 251 | if( AllTheTests[ testCat ][ test ][ set ] ){ |
| 252 | if( getResult ) |
| 253 | result += test + "," |
| 254 | if( dayAdding ) |
| 255 | dayAdder( testCat, test, day ) |
| 256 | } |
| 257 | } |
| 258 | return result |
| 259 | } |
| 260 | def dayAdder( testCat, testName, dayOfWeek ){ |
| 261 | AllTheTests[ testCat ][ testName ][ "day" ] += dayOfWeek + "," |
| 262 | } |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 263 | def runTest = [ |
| 264 | "VM" : [:], |
| 265 | "BM" : [:] |
| 266 | ] |
| 267 | for( String test in testcases.keySet() ){ |
| 268 | println test |
| 269 | if (testcases[test]["tests"] != ""){ |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 270 | runTest[testcases[test]["nodeName"]][test] = trigger_pipeline( onos_branch, testcases[test]["tests"], testcases[test]["nodeName"], test, manually_run, onos_tag ) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 271 | } |
| 272 | } |
| 273 | def finalList = [:] |
| 274 | finalList["VM"] = runTestSeq( runTest["VM"] ) |
| 275 | finalList["BM"] = runTestSeq( runTest["BM"] ) |
| 276 | parallel finalList |
| 277 | |
| 278 | def runTestSeq( testList ){ |
| 279 | return{ |
| 280 | for ( test in testList.keySet() ){ |
| 281 | testList[test].call() |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | def print_tests( tests ){ |
| 287 | for( String test in tests.keySet() ){ |
| 288 | if( tests[test]["tests"] != "" ){ |
| 289 | println test + ":" |
| 290 | println tests[test]["tests"] |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | def organize_tests( tests ){ |
| 295 | testList = tests.tokenize("\n;, ") |
| 296 | for( String test in testList ) |
| 297 | testcases [ Prefix_organizer[ ( test == "FUNCbgpls" || test == "FUNCvirNetNB" ? "US" : ( test[ 0 ] + test[ 1 ] ) ) ] ][ "tests" ] += test + "," |
| 298 | } |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 299 | def trigger_pipeline( branch, tests, nodeName, jobOn, manuallyRun, onosTag ){ |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 300 | // nodeName : "BM" or "VM" |
| 301 | // jobOn : "SCPF" or "USECASE" or "FUNC" or "HA" |
| 302 | return{ |
| 303 | if (branch == "master"){ |
| 304 | onos_branch = branch |
| 305 | }else{ |
| 306 | onos_branch = "onos-" + branch |
| 307 | } |
| 308 | wiki = branch |
| 309 | if ( !manuallyRun ) |
| 310 | test_branch = onos_branch |
| 311 | if (onos_branch == "onos-1.11") |
| 312 | test_branch = "master" |
| 313 | println jobOn + "_Pipeline_" + manuallyRun ? "manually" : branch |
| 314 | node("TestStation-" + nodeName + "s"){ |
| 315 | if (!manuallyRun) |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 316 | envSetup(onos_branch, test_branch, onosTag) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 317 | |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 318 | exportEnvProperty( onos_branch, test_branch, wiki, tests, post_result, manuallyRun, onosTag ) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 319 | } |
| 320 | |
| 321 | jobToRun = jobOn + "_Pipeline_" + ( manuallyRun ? "manually" : branch ) |
| 322 | build job: jobToRun, propagate: false |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | // export Environment properties. |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 327 | def exportEnvProperty( onos_branch, test_branch, wiki, tests, postResult, manually_run, onosTag ){ |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 328 | stage("export Property"){ |
| 329 | sh ''' |
| 330 | echo "ONOSBranch=''' + onos_branch +'''" > /var/jenkins/TestONOS.property |
| 331 | echo "TestONBranch=''' + test_branch +'''" >> /var/jenkins/TestONOS.property |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 332 | echo "ONOSTag='''+ onosTag +'''" >> /var/jenkins/TestONOS.property |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 333 | echo "WikiPrefix=''' + wiki +'''" >> /var/jenkins/TestONOS.property |
| 334 | echo "ONOSJVMHeap='''+ env.ONOSJVMHeap +'''" >> /var/jenkins/TestONOS.property |
| 335 | echo "Tests=''' + tests +'''" >> /var/jenkins/TestONOS.property |
| 336 | echo "postResult=''' + postResult +'''" >> /var/jenkins/TestONOS.property |
| 337 | echo "manualRun=''' + manually_run +'''" >> /var/jenkins/TestONOS.property |
| 338 | ''' |
| 339 | } |
| 340 | } |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 341 | def sendToSlack( color, message ){ |
| 342 | slackSend(color:color, message: message) |
| 343 | } |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 344 | // Initialize the environment Setup for the onos and OnosSystemTest |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 345 | def envSetup( onos_branch, test_branch, onos_tag ){ |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 346 | stage("envSetup") { |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 347 | sh '''#!/bin/bash -l |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 348 | set +e |
| 349 | . ~/.bashrc |
| 350 | env |
| 351 | |
| 352 | echo -e "\n##### Set TestON Branch #####" |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 353 | echo "TestON Branch is set on: ''' + test_branch + '''" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 354 | |
| 355 | cd ~/OnosSystemTest/ |
| 356 | git checkout HEAD~1 # Make sure you aren't pn a branch |
| 357 | 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] | 358 | 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] | 359 | git clean -df # clean any local files |
| 360 | git fetch --all # update all caches from remotes |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 361 | 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] | 362 | git clean -df # clean any local files |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 363 | git checkout ''' + test_branch + ''' #create new local branch |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 364 | git branch |
| 365 | git log -1 --decorate |
| 366 | |
| 367 | |
| 368 | echo -e "\n##### Set ONOS Branch #####" |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 369 | echo "ONOS Branch is set on: ''' + onos_branch + '''" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 370 | |
| 371 | echo -e "\n #### check karaf version ######" |
| 372 | env |grep karaf |
| 373 | |
| 374 | cd ~/onos |
| 375 | rm -rf buck-out/* |
| 376 | ~/onos/tools/build/onos-buck clean |
| 377 | git checkout HEAD~1 # Make sure you aren't pn a branch |
| 378 | 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] | 379 | 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] | 380 | git clean -df # clean any local files |
| 381 | git fetch --all # update all caches from remotes |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 382 | 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] | 383 | git clean -df # clean any local files |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 384 | ''' + tagCheck(onos_tag, onos_branch) + ''' |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 385 | git branch |
| 386 | git log -1 --decorate |
| 387 | |
| 388 | |
| 389 | echo -e "\n##### set jvm heap size to 8G #####" |
| 390 | echo ${ONOSJVMHeap} |
| 391 | |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 392 | inserted_line="export JAVA_OPTS=\"\${ONOSJVMHeap}\"" |
| 393 | 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] | 394 | |
| 395 | echo "##### Check onos-service setting..... #####" |
| 396 | cat ~/onos/tools/package/bin/onos-service |
| 397 | |
| 398 | export JAVA_HOME=/usr/lib/jvm/java-8-oracle |
| 399 | |
| 400 | echo -e "\n##### build ONOS skip unit tests ######" |
| 401 | #mvn clean install -DskipTests |
| 402 | # Force buck update |
| 403 | rm -f ~/onos/bin/buck |
| 404 | ~/onos/tools/build/onos-buck build onos |
| 405 | |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 406 | sleep 30 |
| 407 | echo -e "\n##### Stop all running instances of Karaf #####" |
| 408 | kill $(ps -efw | grep karaf | grep -v grep | awk '{print $2}') |
| 409 | sleep 30 |
| 410 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 411 | git branch''' |
| 412 | } |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 413 | } |
| 414 | def tagCheck(onos_tag, onos_branch){ |
| 415 | result = "git checkout " |
| 416 | if (onos_tag == "" ) |
| 417 | result += onos_branch //create new local branch |
| 418 | else |
| 419 | result += onos_tag //checkout the tag |
| 420 | return result |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 421 | } |