Devin Lim | e1346f4 | 2018-05-15 15:41:36 -0700 | [diff] [blame] | 1 | #!groovy |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 2 | // Copyright 2017 Open Networking Foundation (ONF) |
| 3 | // |
| 4 | // Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 5 | // the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 6 | // or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg> |
| 7 | // |
| 8 | // TestON is free software: you can redistribute it and/or modify |
| 9 | // it under the terms of the GNU General Public License as published by |
| 10 | // the Free Software Foundation, either version 2 of the License, or |
| 11 | // (at your option) any later version. |
| 12 | // |
| 13 | // TestON is distributed in the hope that it will be useful, |
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | // GNU General Public License for more details. |
| 17 | // |
| 18 | // You should have received a copy of the GNU General Public License |
| 19 | // along with TestON. If not, see <http://www.gnu.org/licenses/>. |
| 20 | |
| 21 | // This is the Jenkins script for vm-pipeline-trigger or bm-pipeline-trigger |
| 22 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 23 | // set the functions of the dependencies. |
Devin Lim | b734ea5 | 2018-05-14 14:13:05 -0700 | [diff] [blame] | 24 | funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' ) |
Devin Lim | b734ea5 | 2018-05-14 14:13:05 -0700 | [diff] [blame] | 25 | triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/TriggerFuncs.groovy' ) |
| 26 | fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' ) |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 27 | test_list = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' ) |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 28 | |
Jeremy Ronquillo | 4fd8244 | 2019-05-21 20:56:58 -0700 | [diff] [blame^] | 29 | test_list.init() |
| 30 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 31 | // set the versions of the onos |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame] | 32 | fileRelated.init() |
You Wang | 7ca7dc7 | 2018-09-05 10:56:24 -0700 | [diff] [blame] | 33 | current_version = "master" |
You Wang | 8f12d7d | 2018-11-09 13:47:23 -0800 | [diff] [blame] | 34 | previous_version = "1.15" |
You Wang | f043d0a | 2019-04-22 16:30:40 -0700 | [diff] [blame] | 35 | before_previous_version = "2.1" |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 36 | |
| 37 | // init trend graphs to be on VM. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 38 | funcs.initializeTrend( "VM" ); |
| 39 | triggerFuncs.init( funcs ) |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 40 | |
| 41 | // contents for page https://wiki.onosproject.org/display/ONOS/Automated+Test+Schedule |
| 42 | // which will demonstrates the list of the scheduled tests on the days. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 43 | wikiContents = "" |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 44 | |
| 45 | // default FUNC,HA to be VM, SCPF,USECASE to be BM. |
| 46 | // SR will not be used in here. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 47 | testcases = [ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 48 | "FUNC": [ tests: "", nodeName: "VM", wikiContent: "" ], |
| 49 | "HA": [ tests: "", nodeName: "VM", wikiContent: "" ], |
| 50 | "SCPF": [ tests: "", nodeName: "BM", wikiContent: "" ], |
| 51 | "SR": [ tests: "", nodeName: "Fabric", wikiContent: "" ], |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 52 | "SRHA": [ tests: "", nodeName: "Fabric", wikiContent: "" ], |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 53 | "USECASE": [ tests: "", nodeName: "BM", wikiContent: "" ] |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 54 | ] |
| 55 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 56 | // read the parameters from the Jenkins |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 57 | manually_run = params.manual_run |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 58 | |
| 59 | // set default onos_b to be current_version. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 60 | onos_b = current_version |
| 61 | test_branch = "" |
| 62 | onos_tag = params.ONOSTag |
| 63 | isOldFlow = true |
| 64 | |
| 65 | // Set tests based on day of week |
| 66 | def now = funcs.getCurrentTime() |
| 67 | print now.toString() |
| 68 | today = now[ Calendar.DAY_OF_WEEK ] |
| 69 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 70 | // get branch from parameter if it is manually running |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 71 | if ( manually_run ){ |
| 72 | onos_b = params.ONOSVersion |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 73 | } |
| 74 | else { |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 75 | // otherwise, the version would be different over the weekend. |
| 76 | // If today is weekdays, it will be default to current_version. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 77 | if ( today == Calendar.SATURDAY ){ |
| 78 | onos_b = previous_version |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 79 | } |
| 80 | else if ( today == Calendar.SUNDAY ){ |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 81 | onos_b = before_previous_version |
| 82 | } |
| 83 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 84 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 85 | // list of the tests to be run will be saved in each choices. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 86 | day = "" |
| 87 | SCPF_choices = "" |
| 88 | USECASE_choices = "" |
| 89 | FUNC_choices = "" |
| 90 | HA_choices = "" |
| 91 | SR_choices = "" |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 92 | SRHA_choices = "" |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 93 | |
| 94 | // init some paths for the files and directories. |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame] | 95 | stat_graph_generator_file = fileRelated.histogramMultiple |
| 96 | pie_graph_generator_file = fileRelated.pieMultiple |
| 97 | graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/" |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 98 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 99 | // get post result from the params for manually run. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 100 | post_result = params.PostResult |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 101 | |
| 102 | // if automatically run, it will remove the comma at the end after dividing the tests. |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 103 | if ( !manually_run ){ |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 104 | testDivider( today ) |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 105 | FUNC_choices = triggerFuncs.lastCommaRemover( FUNC_choices ) |
| 106 | HA_choices = triggerFuncs.lastCommaRemover( HA_choices ) |
| 107 | SCPF_choices = triggerFuncs.lastCommaRemover( SCPF_choices ) |
| 108 | USECASE_choices = triggerFuncs.lastCommaRemover( USECASE_choices ) |
| 109 | SR_choices = triggerFuncs.lastCommaRemover( SR_choices ) |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 110 | SRHA_choices = triggerFuncs.lastCommaRemover( SRHA_choices ) |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 111 | } |
| 112 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 113 | |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 114 | if ( manually_run ){ |
| 115 | testcases = triggerFuncs.organize_tests( params.Tests, testcases ) |
| 116 | |
| 117 | isOldFlow = params.isOldFlow |
| 118 | println "Tests to be run manually : " |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 119 | } |
| 120 | else { |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 121 | testcases[ "SCPF" ][ "tests" ] = SCPF_choices |
| 122 | testcases[ "USECASE" ][ "tests" ] = USECASE_choices |
| 123 | testcases[ "FUNC" ][ "tests" ] = FUNC_choices |
| 124 | testcases[ "HA" ][ "tests" ] = HA_choices |
| 125 | testcases[ "SR" ][ "tests" ] = SR_choices |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 126 | testcases[ "SRHA" ][ "tests" ] = SRHA_choices |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 127 | println "Defaulting to " + day + " tests:" |
| 128 | } |
| 129 | |
| 130 | triggerFuncs.print_tests( testcases ) |
| 131 | |
| 132 | def runTest = [ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 133 | "VM": [ : ], |
| 134 | "BM": [ : ] |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 135 | ] |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 136 | |
| 137 | // set the test running function into the dictionary. |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 138 | for ( String test in testcases.keySet() ){ |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 139 | println test |
| 140 | if ( testcases[ test ][ "tests" ] != "" ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 141 | runTest[ testcases[ test ][ "nodeName" ] ][ test ] = triggerFuncs. |
| 142 | trigger_pipeline( onos_b, testcases[ test ][ "tests" ], testcases[ test ][ "nodeName" ], test, |
| 143 | manually_run, onos_tag ) |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 144 | } |
| 145 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 146 | def finalList = [ : ] |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 147 | |
| 148 | // get the name of the job. |
Devin Lim | b91bf79 | 2018-05-10 15:09:52 -0700 | [diff] [blame] | 149 | jobName = env.JOB_NAME |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 150 | |
| 151 | // first set the list of the functions to be run. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 152 | finalList[ "VM" ] = triggerFuncs.runTestSeq( runTest[ "VM" ] ) |
| 153 | finalList[ "BM" ] = triggerFuncs.runTestSeq( runTest[ "BM" ] ) |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 154 | |
| 155 | // if first two character of the job name is vm, only call VM. |
| 156 | // else, only on BM |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 157 | if ( jobName.take( 2 ) == "vm" ){ |
Devin Lim | b91bf79 | 2018-05-10 15:09:52 -0700 | [diff] [blame] | 158 | finalList[ "VM" ].call() |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 159 | } |
| 160 | else { |
Devin Lim | b91bf79 | 2018-05-10 15:09:52 -0700 | [diff] [blame] | 161 | finalList[ "BM" ].call() |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 162 | } |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 163 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 164 | // If it is automated running, it will generate the stats graph on VM. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 165 | if ( !manually_run ){ |
| 166 | funcs.generateStatGraph( "TestStation-VMs", |
| 167 | funcs.branchWithPrefix( onos_b ), |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 168 | stat_graph_generator_file, |
| 169 | pie_graph_generator_file, |
| 170 | graph_saved_directory ) |
| 171 | } |
| 172 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 173 | // function that will divide tests depends on which day it is. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 174 | def testDivider( today ){ |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 175 | todayStr = today.toString() |
| 176 | |
| 177 | dayMap = [ ( Calendar.MONDAY ) : "mon", |
| 178 | ( Calendar.TUESDAY ) : "tue", |
| 179 | ( Calendar.WEDNESDAY ) : "wed", |
| 180 | ( Calendar.THURSDAY ) : "thu", |
| 181 | ( Calendar.FRIDAY ) : "fri", |
| 182 | ( Calendar.SATURDAY ) : "sat", |
| 183 | ( Calendar.SUNDAY ) : "sun" ] |
| 184 | fullDayMap = [ ( Calendar.MONDAY ) : "Monday", |
| 185 | ( Calendar.TUESDAY ) : "Tuesday", |
| 186 | ( Calendar.WEDNESDAY ) : "Wednesday", |
| 187 | ( Calendar.THURSDAY ) : "Thursday", |
| 188 | ( Calendar.FRIDAY ) : "Friday", |
| 189 | ( Calendar.SATURDAY ) : "Saturday", |
| 190 | ( Calendar.SUNDAY ) : "Sunday" ] |
| 191 | |
| 192 | if ( today == Calendar.MONDAY ){ |
| 193 | initHtmlForWiki() |
| 194 | day = fullDayMap[ today ] |
| 195 | for ( key in dayMap.keySet() ){ |
| 196 | buildDay( dayMap[ key ], false ) |
| 197 | } |
| 198 | closeHtmlForWiki() |
| 199 | postToWiki( wikiContents ) |
| 200 | slackSend( color: '#FFD988', |
| 201 | message: "Tests to be run this weekdays : \n" + |
| 202 | triggerFuncs.printDaysForTest() ) |
| 203 | } else { |
| 204 | day = fullDayMap[ today ] |
| 205 | buildDay( dayMap[ today ], true ) |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 206 | } |
| 207 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 208 | |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 209 | def buildDay( dayStr, getResult ){ |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 210 | addingHeader( "FUNC" ) |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 211 | FUNC_choices += adder( "FUNC", dayStr, getResult ) |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 212 | closingHeader( "FUNC" ) |
| 213 | addingHeader( "HA" ) |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 214 | HA_choices += adder( "HA", dayStr, getResult ) |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 215 | closingHeader( "HA" ) |
| 216 | addingHeader( "SCPF" ) |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 217 | SCPF_choices += adder( "SCPF", dayStr, getResult ) |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 218 | closingHeader( "SCPF" ) |
| 219 | addingHeader( "SR" ) |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 220 | SR_choices += adder( "SR", dayStr, false ) |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 221 | closingHeader( "SR" ) |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 222 | addingHeader( "SRHA" ) |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 223 | SRHA_choices += adder( "SRHA", dayStr, false ) |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 224 | closingHeader( "SRHA" ) |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 225 | addingHeader( "USECASE" ) |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 226 | USECASE_choices += adder( "USECASE", dayStr, getResult ) |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 227 | closingHeader( "USECASE" ) |
| 228 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 229 | |
| 230 | // adder that will return the list of the tests. |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 231 | def adder( category, day, getResult ){ |
| 232 | // category : the category of the test which will be either FUNC,HA,SR... |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 233 | // day : the day you are trying to add (m,t,w,th... ) |
| 234 | // getResult : if want to get the list of the test to be run. False will return empty list. |
| 235 | // And once the list is empty, it will not be run. |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 236 | def result = "" |
Jeremy Ronquillo | 4fd8244 | 2019-05-21 20:56:58 -0700 | [diff] [blame^] | 237 | selectedTests = test_list.getTestsFromCategory( category, test_list.getTestsFromDay( day, onos_b ) ) |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 238 | |
| 239 | for ( String test in selectedTests.keySet() ){ |
| 240 | if ( getResult ){ |
| 241 | result += test + "," |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 242 | } |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 243 | // make HTML columns for wiki page on schedule. |
| 244 | makeHtmlColList( category, test ) |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 245 | } |
| 246 | return result |
| 247 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 248 | |
| 249 | // Initial part of the wiki page. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 250 | def initHtmlForWiki(){ |
| 251 | wikiContents = ''' |
| 252 | <table class="wrapped confluenceTable"> |
| 253 | <colgroup> |
| 254 | <col /> |
| 255 | <col /> |
| 256 | <col /> |
| 257 | <col /> |
| 258 | <col /> |
| 259 | <col /> |
| 260 | </colgroup> |
| 261 | <tbody> |
| 262 | <tr> |
| 263 | <th colspan="1" class="confluenceTh"> |
| 264 | <br /> |
| 265 | </th> |
| 266 | <th class="confluenceTh"><p>Monday</p></th> |
| 267 | <th class="confluenceTh"><p>Tuesday</p></th> |
| 268 | <th class="confluenceTh"><p>Wednesday</p></th> |
| 269 | <th class="confluenceTh"><p>Thursday</p></th> |
| 270 | <th class="confluenceTh"><p>Friday</p></th> |
| 271 | <th class="confluenceTh"><p>Saturday</p></th> |
| 272 | <th class="confluenceTh"><p>Sunday</p></th> |
| 273 | </tr>''' |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 274 | for ( String test in testcases.keySet() ){ |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 275 | testcases[ test ][ 'wikiContent' ] = ''' |
| 276 | <tr> |
| 277 | <th colspan="1" class="confluenceTh">''' + test + '''</th>''' |
| 278 | } |
| 279 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 280 | |
| 281 | // adding header functionality. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 282 | def addingHeader( testCategory ){ |
| 283 | testcases[ testCategory ][ 'wikiContent' ] += ''' |
| 284 | <td class="confluenceTd"> |
| 285 | <ul>''' |
| 286 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 287 | |
| 288 | // making column list for html |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 289 | def makeHtmlColList( testCategory, testName ){ |
| 290 | testcases[ testCategory ][ 'wikiContent' ] += ''' |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 291 | <li>''' + testName + '''</li>''' |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 292 | |
| 293 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 294 | |
| 295 | // closing the header for html |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 296 | def closingHeader( testCategory ){ |
| 297 | testcases[ testCategory ][ 'wikiContent' ] += ''' |
| 298 | </ul> |
| 299 | </td>''' |
| 300 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 301 | |
| 302 | // close the html for the wiki page. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 303 | def closeHtmlForWiki(){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 304 | for ( String test in testcases.keySet() ){ |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 305 | wikiContents += testcases[ test ][ 'wikiContent' ] |
| 306 | wikiContents += ''' |
| 307 | </tr>''' |
| 308 | } |
| 309 | wikiContents += ''' |
| 310 | </tbody> |
| 311 | </table> |
| 312 | <p><strong>Everyday</strong>, all SegmentRouting tests are built and run on every supported branch.</p> |
| 313 | <p>On <strong>Weekdays</strong>, all the other tests are built and run on the master branch.</p> |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 314 | <p>On <strong>Saturdays</strong>, all the other tests are built and run on the ''' + |
| 315 | funcs.branchWithPrefix( previous_version ) + ''' branch.</p> |
| 316 | <p>On <strong>Sundays</strong>, all the other tests are built and run on the ''' + |
| 317 | funcs.branchWithPrefix( before_previous_version ) + ''' branch.</p>''' |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 318 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 319 | |
| 320 | // post the result to wiki page using publish to confluence. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 321 | def postToWiki( contents ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 322 | node( testMachine ) { |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame] | 323 | workspace = fileRelated.jenkinsWorkspace + "all-pipeline-trigger/" |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 324 | filename = "jenkinsSchedule.txt" |
| 325 | writeFile file: workspace + filename, text: contents |
| 326 | funcs.publishToConfluence( "false", "true", |
| 327 | "Automated Test Schedule", |
| 328 | workspace + filename ) |
| 329 | } |
| 330 | } |