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