Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 1 | // Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | // voltha-2.x e2e tests for openonu-go |
| 16 | // uses bbsim to simulate OLT/ONUs |
| 17 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 18 | // [TODO] Update syntax below to the latest supported |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 19 | library identifier: 'cord-jenkins-libraries@master', |
| 20 | retriever: modernSCM([ |
| 21 | $class: 'GitSCMSource', |
| 22 | remote: 'https://gerrit.opencord.org/ci-management.git' |
| 23 | ]) |
| 24 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 25 | //------------------// |
| 26 | //---] GLOBAL [---// |
| 27 | //------------------// |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 28 | String clusterName = 'kind-ci' // was def |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 29 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 30 | // ----------------------------------------------------------------------- |
| 31 | // Intent: |
| 32 | // ----------------------------------------------------------------------- |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 33 | String branchName() { |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 34 | String name = 'voltha-2.12' |
| 35 | |
| 36 | // [TODO] Sanity check the target branch |
| 37 | // if (name != jenkins.branch) { fatal } |
| 38 | return(name) |
| 39 | } |
| 40 | |
| 41 | // ----------------------------------------------------------------------- |
Joey Armstrong | af4eef2 | 2023-08-25 16:14:45 -0400 | [diff] [blame] | 42 | // Intent: Difficult at times to determine when pipeline jobs have |
| 43 | // regenerated. Hardcode a version string that can be assigned |
| 44 | // per-script to be sure latest repository changes are being used. |
| 45 | // ----------------------------------------------------------------------- |
| 46 | String pipelineVer() { |
Joey Armstrong | 6146f7e | 2023-08-28 09:05:38 -0400 | [diff] [blame] | 47 | String version = '5addce3fac89095d103ac5c6eedff2bb02e9ec63' |
Joey Armstrong | af4eef2 | 2023-08-25 16:14:45 -0400 | [diff] [blame] | 48 | return(version) |
| 49 | } |
| 50 | |
| 51 | // ----------------------------------------------------------------------- |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 52 | // Intent: Due to lack of a reliable stack trace, construct a literal. |
Joey Armstrong | d0b5af0 | 2023-08-25 15:12:54 -0400 | [diff] [blame] | 53 | // Jenkins will re-write the call stack for serialization.S |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 54 | // ----------------------------------------------------------------------- |
Joey Armstrong | d0b5af0 | 2023-08-25 15:12:54 -0400 | [diff] [blame] | 55 | // Note: Hardcoded version string used to visualize changes in jenkins UI |
| 56 | // ----------------------------------------------------------------------- |
Joey Armstrong | af4eef2 | 2023-08-25 16:14:45 -0400 | [diff] [blame] | 57 | String getIam(String func) { |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 58 | String branchName = branchName() |
Joey Armstrong | af4eef2 | 2023-08-25 16:14:45 -0400 | [diff] [blame] | 59 | String version = pipelineVer() |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 60 | String src = [ |
| 61 | 'ci-management', |
| 62 | 'jjb', |
| 63 | 'pipeline', |
| 64 | 'voltha', |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 65 | branchName, |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 66 | 'bbsim-tests.groovy' |
| 67 | ].join('/') |
| 68 | |
Joey Armstrong | d0b5af0 | 2023-08-25 15:12:54 -0400 | [diff] [blame] | 69 | String name = [src, version, func].join('::') |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 70 | return(name) |
| 71 | } |
| 72 | |
| 73 | // ----------------------------------------------------------------------- |
Joey Armstrong | af4eef2 | 2023-08-25 16:14:45 -0400 | [diff] [blame] | 74 | // Intent: Log progress message |
| 75 | // ----------------------------------------------------------------------- |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 76 | void enter(String name) { |
Joey Armstrong | af4eef2 | 2023-08-25 16:14:45 -0400 | [diff] [blame] | 77 | // Announce ourselves for log usability |
| 78 | String iam = getIam(name) |
| 79 | println("${iam}: ENTER") |
| 80 | return |
| 81 | } |
| 82 | |
| 83 | // ----------------------------------------------------------------------- |
| 84 | // Intent: Log progress message |
| 85 | // ----------------------------------------------------------------------- |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 86 | void leave(String name) { |
Joey Armstrong | af4eef2 | 2023-08-25 16:14:45 -0400 | [diff] [blame] | 87 | // Announce ourselves for log usability |
| 88 | String iam = getIam(name) |
| 89 | println("${iam}: LEAVE") |
| 90 | return |
| 91 | } |
| 92 | |
| 93 | // ----------------------------------------------------------------------- |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 94 | // Intent: Determine if working on a release branch. |
| 95 | // Note: Conditional is legacy, should also check for *-dev or *-pre |
| 96 | // ----------------------------------------------------------------------- |
Joey Armstrong | ec1ae0a | 2023-08-23 21:51:45 -0400 | [diff] [blame] | 97 | Boolean isReleaseBranch(String name) { |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 98 | // List modifiers = ['-dev', '-pre', 'voltha-x.y.z-pre'] |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 99 | // if branchName in modifiers |
| 100 | return(name != 'master') // OR branchName.contains('-') |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | // ----------------------------------------------------------------------- |
Joey Armstrong | af4eef2 | 2023-08-25 16:14:45 -0400 | [diff] [blame] | 104 | // Intent: Iterate over a list of test suites and invoke. |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 105 | // ----------------------------------------------------------------------- |
Joey Armstrong | af4eef2 | 2023-08-25 16:14:45 -0400 | [diff] [blame] | 106 | void execute_test\ |
| 107 | ( |
| 108 | String testTarget, // functional-single-kind-dt |
| 109 | String workflow, // dt |
| 110 | String testLogging, // 'True' |
| 111 | Boolean teardown, // true |
| 112 | String testSpecificHelmFlags='' |
| 113 | ) { |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 114 | String infraNamespace = 'default' |
| 115 | String volthaNamespace = 'voltha' |
| 116 | String logsDir = "$WORKSPACE/${testTarget}" |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 117 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 118 | // ----------------------------------------------------------------------- |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 119 | // Intent: Cleanup stale port-forwarding |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 120 | // ----------------------------------------------------------------------- |
Joey Armstrong | ec1ae0a | 2023-08-23 21:51:45 -0400 | [diff] [blame] | 121 | stage('Cleanup') { |
Joey Armstrong | 38a8783 | 2023-08-23 17:02:50 -0400 | [diff] [blame] | 122 | if (teardown) { |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 123 | timeout(15) { |
Joey Armstrong | 38a8783 | 2023-08-23 17:02:50 -0400 | [diff] [blame] | 124 | script { |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 125 | helmTeardown(['default', infraNamespace, volthaNamespace]) |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 126 | } |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 127 | } // timeout |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 128 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 129 | timeout(5) { |
| 130 | script { |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 131 | enter('Cleanup') |
| 132 | // remove orphaned port-forward from different namespaces |
Joey Armstrong | ebc1802 | 2023-08-26 13:20:49 -0400 | [diff] [blame] | 133 | String proc = 'kubectl .*port-forward' // was 'port-forw' |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 134 | pgrep_proc(proc) |
| 135 | pkill_proc(proc) |
Joey Armstrong | ebc1802 | 2023-08-26 13:20:49 -0400 | [diff] [blame] | 136 | |
| 137 | // todo: fatal unless (proc count==0) |
| 138 | pgrep_proc(proc) |
Joey Armstrong | 6146f7e | 2023-08-28 09:05:38 -0400 | [diff] [blame] | 139 | leave('Cleanup') |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 140 | } // script |
| 141 | } // timeout |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 142 | } // teardown |
Joey Armstrong | 38a8783 | 2023-08-23 17:02:50 -0400 | [diff] [blame] | 143 | } // stage('Cleanup') |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 144 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 145 | // ----------------------------------------------------------------------- |
| 146 | // ----------------------------------------------------------------------- |
Joey Armstrong | ec1ae0a | 2023-08-23 21:51:45 -0400 | [diff] [blame] | 147 | stage('Deploy common infrastructure') { |
| 148 | script { |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 149 | local dashargs = [ |
| 150 | 'kpi_exporter.enabled=false', |
| 151 | 'dashboards.xos=false', |
| 152 | 'dashboards.onos=false', |
| 153 | 'dashboards.aaa=false', |
| 154 | 'dashboards.voltha=false', |
| 155 | ].join(',') |
| 156 | |
| 157 | local promargs = [ |
| 158 | 'prometheus.alertmanager.enabled=false', |
| 159 | 'prometheus.pushgateway.enabled=false', |
| 160 | ].join(',') |
| 161 | |
Joey Armstrong | 6146f7e | 2023-08-28 09:05:38 -0400 | [diff] [blame] | 162 | sh(label : 'Deploy common infrastructure', |
| 163 | script : """ |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 164 | helm repo add onf https://charts.opencord.org |
| 165 | helm repo update |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 166 | |
| 167 | echo -e "\nwithMonitoring=[$withMonitoring]" |
| 168 | if [ ${withMonitoring} = true ] ; then |
| 169 | helm install nem-monitoring onf/nem-monitoring \ |
Joey Armstrong | 38a8783 | 2023-08-23 17:02:50 -0400 | [diff] [blame] | 170 | --set ${promargs} \ |
| 171 | --set ${dashargs} |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 172 | fi |
Joey Armstrong | 38a8783 | 2023-08-23 17:02:50 -0400 | [diff] [blame] | 173 | """) |
| 174 | } // script |
| 175 | } // stage('Deploy Common Infra') |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 176 | |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 177 | // ----------------------------------------------------------------------- |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 178 | // [TODO] Check onos_log output |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 179 | // ----------------------------------------------------------------------- |
Joey Armstrong | ec1ae0a | 2023-08-23 21:51:45 -0400 | [diff] [blame] | 180 | stage('Deploy Voltha') { |
| 181 | if (teardown) { |
| 182 | timeout(10) { |
| 183 | script { |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 184 | String iam = getIam('Deploy Voltha') |
| 185 | String onosLog = "${logsDir}/onos-voltha-startup-combined.log" |
| 186 | sh(""" |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 187 | mkdir -p ${logsDir} |
Joey Armstrong | 38a8783 | 2023-08-23 17:02:50 -0400 | [diff] [blame] | 188 | touch "$onosLog" |
| 189 | echo "** kail-startup ENTER: \$(date)" > "$onosLog" |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 190 | |
| 191 | # Intermixed output (tee -a &) may get conflusing but let(s) see |
| 192 | # what messages are logged during startup. |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 193 | # _TAG=ka7il-startup kail -n ${infraNamespace} -n ${volthaNamespace} >> "$onosLog" & |
Joey Armstrong | 38a8783 | 2023-08-23 17:02:50 -0400 | [diff] [blame] | 194 | _TAG=kail-startup kail -n ${infraNamespace} -n ${volthaNamespace} | tee -a "$onosLog" & |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 195 | """) |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 196 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 197 | // if we're downloading a voltha-helm-charts patch, then install from a local copy of the charts |
| 198 | Boolean localCharts = false |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 199 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 200 | if (volthaHelmChartsChange != '' |
| 201 | || gerritProject == 'voltha-helm-charts' |
| 202 | || isReleaseBranch(branch) // branch != 'master' |
| 203 | ) { |
| 204 | localCharts = true |
| 205 | } |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 206 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 207 | String branchName = branchName() |
| 208 | Boolean isRelease = isReleaseBranch(branch) |
| 209 | println([ |
| 210 | " ** localCharts=${localCharts}", |
| 211 | "branchName=${branchName}", |
| 212 | "branch=${branch}", |
| 213 | "branch=isReleaseBranch=${isRelease}", |
| 214 | ].join(', ')) |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 215 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 216 | // ----------------------------------------------------------------------- |
| 217 | // Rewrite localHelmFlags using array join, moving code around and |
| 218 | // refactoring into standalone functions |
| 219 | // ----------------------------------------------------------------------- |
| 220 | // NOTE temporary workaround expose ONOS node ports |
| 221 | // ----------------------------------------------------------------------- |
| 222 | String localHelmFlags = [ |
| 223 | extraHelmFlags.trim(), |
| 224 | "--set global.log_level=${logLevel.toUpperCase()}", |
| 225 | '--set onos-classic.onosSshPort=30115', |
| 226 | '--set onos-classic.onosApiPort=30120', |
| 227 | '--set onos-classic.onosOfPort=31653', |
| 228 | '--set onos-classic.individualOpenFlowNodePorts=true', |
| 229 | testSpecificHelmFlags |
| 230 | ].join(' ') |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 231 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 232 | println("** ${iam} localHelmFlags = ${localHelmFlags}") |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 233 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 234 | if (gerritProject != '') { |
| 235 | localHelmFlags = "${localHelmFlags} " + getVolthaImageFlags("${gerritProject}") |
| 236 | } |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 237 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 238 | println("** ${iam}: ENTER") |
| 239 | volthaDeploy([ |
| 240 | infraNamespace: infraNamespace, |
| 241 | volthaNamespace: volthaNamespace, |
| 242 | workflow: workflow.toLowerCase(), |
| 243 | withMacLearning: enableMacLearning.toBoolean(), |
| 244 | extraHelmFlags: localHelmFlags, |
| 245 | localCharts: localCharts, |
| 246 | bbsimReplica: olts.toInteger(), |
| 247 | dockerRegistry: registry, |
| 248 | ]) |
| 249 | println("** ${iam}: LEAVE") |
| 250 | } // script |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 251 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 252 | // ----------------------------------------------------------------------- |
| 253 | // Intent: Replacing P_IDS with pgrep/pkill is a step forward. |
| 254 | // Why not simply use a pid file, capture _TAG=kail-startup above |
| 255 | // Grep runs the risk of terminating stray commands (??-good <=> bad-??) |
| 256 | // ----------------------------------------------------------------------- |
| 257 | script { |
| 258 | String proc = '_TAG=kail-startup' |
Joey Armstrong | dddbbf9 | 2023-08-22 16:00:41 -0400 | [diff] [blame] | 259 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 260 | println("${iam}: ENTER") |
| 261 | println("${iam}: Shutdown process $proc") |
| 262 | pgrep_proc(proc) |
| 263 | pkill_proc(proc) |
| 264 | pgrep_proc(proc) |
| 265 | println("${iam}: LEAVE") |
| 266 | } |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 267 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 268 | // ----------------------------------------------------------------------- |
| 269 | // Bundle onos-voltha / kail logs |
| 270 | // ----------------------------------------------------------------------- |
| 271 | sh(""" |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 272 | cat <<EOM |
| 273 | |
| 274 | ** ----------------------------------------------------------------------- |
| 275 | ** Combine an compress voltha startup log(s) |
| 276 | ** ----------------------------------------------------------------------- |
| 277 | EOM |
| 278 | pushd "${logsDir}" || { echo "ERROR: pushd $logsDir failed"; exit 1; } |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 279 | gzip -k onos-voltha-startup-combined.log |
| 280 | rm onos-voltha-startup-combined.log |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 281 | popd |
| 282 | """) |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 283 | } // timeout(10) |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 284 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 285 | // ----------------------------------------------------------------------- |
| 286 | // ----------------------------------------------------------------------- |
| 287 | sh """ |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 288 | JENKINS_NODE_COOKIE="dontKillMe" _TAG="voltha-voltha-api" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${volthaNamespace} svc/voltha-voltha-api 55555:55555; done"& |
| 289 | JENKINS_NODE_COOKIE="dontKillMe" _TAG="voltha-infra-etcd" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${infraNamespace} svc/voltha-infra-etcd 2379:2379; done"& |
| 290 | JENKINS_NODE_COOKIE="dontKillMe" _TAG="voltha-infra-kafka" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${infraNamespace} svc/voltha-infra-kafka 9092:9092; done"& |
| 291 | bbsimDmiPortFwd=50075 |
| 292 | for i in {0..${olts.toInteger() - 1}}; do |
| 293 | JENKINS_NODE_COOKIE="dontKillMe" _TAG="bbsim\${i}" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${volthaNamespace} svc/bbsim\${i} \${bbsimDmiPortFwd}:50075; done"& |
| 294 | ((bbsimDmiPortFwd++)) |
| 295 | done |
| 296 | if [ ${withMonitoring} = true ] ; then |
| 297 | JENKINS_NODE_COOKIE="dontKillMe" _TAG="nem-monitoring-prometheus-server" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n default svc/nem-monitoring-prometheus-server 31301:80; done"& |
| 298 | fi |
| 299 | ps aux | grep port-forward |
| 300 | """ |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 301 | // --------------------------------- |
| 302 | // Sanity check port-forward spawned |
| 303 | // --------------------------------- |
| 304 | script { |
| 305 | enter('port-forward check') |
Joey Armstrong | ebc1802 | 2023-08-26 13:20:49 -0400 | [diff] [blame] | 306 | // String proc = 'kubectl.*port-forward' // was 'port-forward' |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 307 | String proc = 'port-forward' |
| 308 | println("Display spawned ${proc}") |
| 309 | pgrep_proc(proc) |
| 310 | leave('port-forward check') |
| 311 | } |
Joey Armstrong | 5d65efe | 2023-08-25 09:43:18 -0400 | [diff] [blame] | 312 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 313 | // setting ONOS log level |
| 314 | script { |
| 315 | enter('setOnosLogLevels') |
| 316 | setOnosLogLevels([ |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 317 | onosNamespace: infraNamespace, |
| 318 | apps: [ |
| 319 | 'org.opencord.dhcpl2relay', |
| 320 | 'org.opencord.olt', |
| 321 | 'org.opencord.aaa', |
| 322 | 'org.opencord.maclearner', |
| 323 | 'org.onosproject.net.flowobjective.impl.FlowObjectiveManager', |
| 324 | 'org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager' |
| 325 | ], |
| 326 | logLevel: logLevel |
| 327 | ]) |
Joey Armstrong | 6146f7e | 2023-08-28 09:05:38 -0400 | [diff] [blame] | 328 | leave('setOnosLogLevels') |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 329 | } // script |
| 330 | } // if (teardown) |
| 331 | } // stage('Deploy Voltha') |
| 332 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 333 | // ----------------------------------------------------------------------- |
| 334 | // ----------------------------------------------------------------------- |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 335 | stage("Run test ${testTarget} on workflow ${workflow}") |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 336 | { |
Joey Armstrong | ebc1802 | 2023-08-26 13:20:49 -0400 | [diff] [blame] | 337 | sh( |
| 338 | label : 'Monitor using mem_consumption.py', |
| 339 | script : """ |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 340 | echo -e "\n** Monitor using mem_consumption.py ?" |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 341 | |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 342 | if [ ${withMonitoring} = true ] ; then |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 343 | cat <<EOM |
| 344 | |
| 345 | ** ----------------------------------------------------------------------- |
| 346 | ** Monitoring memory usage with mem_consumption.py |
| 347 | ** ----------------------------------------------------------------------- |
| 348 | EOM |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 349 | mkdir -p "$WORKSPACE/voltha-pods-mem-consumption-${workflow}" |
| 350 | cd "$WORKSPACE/voltha-system-tests" |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 351 | |
| 352 | echo '** Installing python virtualenv' |
| 353 | make venv-activate-patched |
| 354 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 355 | set +u && source .venv/bin/activate && set -u |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 356 | # Collect initial memory consumption |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 357 | python scripts/mem_consumption.py -o $WORKSPACE/voltha-pods-mem-consumption-${workflow} -a 0.0.0.0:31301 -n ${volthaNamespace} |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 358 | fi |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 359 | |
| 360 | echo -e '** Monitor memory consumption: LEAVE\n' |
Joey Armstrong | ebc1802 | 2023-08-26 13:20:49 -0400 | [diff] [blame] | 361 | """) |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 362 | |
| 363 | sh """ |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 364 | echo -e "\n** make testTarget=[${testTarget}]" |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 365 | mkdir -p ${logsDir} |
| 366 | export ROBOT_MISC_ARGS="-d ${logsDir} ${params.extraRobotArgs} " |
| 367 | ROBOT_MISC_ARGS+="-v ONOS_SSH_PORT:30115 -v ONOS_REST_PORT:30120 -v NAMESPACE:${volthaNamespace} -v INFRA_NAMESPACE:${infraNamespace} -v container_log_dir:${logsDir} -v logging:${testLogging}" |
| 368 | export KVSTOREPREFIX=voltha/voltha_voltha |
| 369 | |
Joey Armstrong | 0eb8bd8 | 2023-07-10 13:26:25 -0400 | [diff] [blame] | 370 | make -C "$WORKSPACE/voltha-system-tests" ${testTarget} |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 371 | """ |
| 372 | |
| 373 | getPodsInfo("${logsDir}") |
| 374 | |
Joey Armstrong | ebc1802 | 2023-08-26 13:20:49 -0400 | [diff] [blame] | 375 | sh( |
| 376 | label : 'Gather robot Framework logs', |
| 377 | script : """ |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 378 | echo -e '\n** Gather robot Framework logs: ENTER' |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 379 | # set +e |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 380 | # collect logs collected in the Robot Framework StartLogging keyword |
| 381 | cd ${logsDir} |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 382 | gzip *-combined.log |
| 383 | rm -f *-combined.log |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 384 | |
| 385 | echo -e '** Gather robot Framework logs: LEAVE\n' |
Joey Armstrong | ebc1802 | 2023-08-26 13:20:49 -0400 | [diff] [blame] | 386 | """) |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 387 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 388 | // ----------------------------------------------------------------------- |
| 389 | // ----------------------------------------------------------------------- |
Joey Armstrong | ebc1802 | 2023-08-26 13:20:49 -0400 | [diff] [blame] | 390 | sh( |
| 391 | label : 'Monitor pod-mem-consumption', |
| 392 | script : """ |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 393 | echo -e '** Monitor pod-mem-consumption: ENTER' |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 394 | if [ ${withMonitoring} = true ] ; then |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 395 | cat <<EOM |
| 396 | |
| 397 | ** ----------------------------------------------------------------------- |
| 398 | ** Monitoring pod-memory-consumption using mem_consumption.py |
| 399 | ** ----------------------------------------------------------------------- |
| 400 | EOM |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 401 | cd "$WORKSPACE/voltha-system-tests" |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame] | 402 | |
| 403 | echo '** Installing python virtualenv' |
| 404 | make venv-activate-patched |
Joey Armstrong | 38a8783 | 2023-08-23 17:02:50 -0400 | [diff] [blame] | 405 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 406 | set +u && source .venv/bin/activate && set -u |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 407 | # Collect memory consumption of voltha pods once all the tests are complete |
Joey Armstrong | 0eb8bd8 | 2023-07-10 13:26:25 -0400 | [diff] [blame] | 408 | python scripts/mem_consumption.py -o $WORKSPACE/voltha-pods-mem-consumption-${workflow} -a 0.0.0.0:31301 -n ${volthaNamespace} |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 409 | fi |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 410 | echo -e '** Monitor pod-mem-consumption: LEAVE\n' |
Joey Armstrong | ebc1802 | 2023-08-26 13:20:49 -0400 | [diff] [blame] | 411 | """) |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 412 | } // stage |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 413 | |
| 414 | return |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 415 | } // execute_test() |
| 416 | |
| 417 | // ----------------------------------------------------------------------- |
| 418 | // ----------------------------------------------------------------------- |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 419 | def collectArtifacts(exitStatus) { |
Joey Armstrong | 6115fd6 | 2023-08-24 08:19:28 -0400 | [diff] [blame] | 420 | script { |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 421 | String iam = getIam('collectArtifacts') |
| 422 | println("${iam}: ENTER (exitStatus=${exitStatus})") |
Joey Armstrong | 6115fd6 | 2023-08-24 08:19:28 -0400 | [diff] [blame] | 423 | } |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 424 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 425 | echo ''' |
| 426 | |
| 427 | ** ----------------------------------------------------------------------- |
| 428 | ** collectArtifacts |
| 429 | ** ----------------------------------------------------------------------- |
| 430 | ''' |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 431 | |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 432 | getPodsInfo("$WORKSPACE/${exitStatus}") |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 433 | |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 434 | sh """ |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 435 | kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/${exitStatus}/voltha.log |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 436 | """ |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 437 | |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 438 | archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt,**/*.html,**/voltha-pods-mem-consumption-att/*,**/voltha-pods-mem-consumption-dt/*,**/voltha-pods-mem-consumption-tt/*' |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 439 | |
Joey Armstrong | ec1ae0a | 2023-08-23 21:51:45 -0400 | [diff] [blame] | 440 | script { |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 441 | println("${iam}: ENTER") |
| 442 | pgrep_proc('kail-startup') |
| 443 | pkill_proc('kail') |
| 444 | println("${iam}: LEAVE") |
Joey Armstrong | ec1ae0a | 2023-08-23 21:51:45 -0400 | [diff] [blame] | 445 | } |
Joey Armstrong | dd0cd6b | 2023-08-25 17:27:56 -0400 | [diff] [blame] | 446 | |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 447 | println("${iam}: ENTER RobotPublisher") |
| 448 | step([$class: 'RobotPublisher', |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 449 | disableArchiveOutput: false, |
| 450 | logFileName: '**/*/log*.html', |
| 451 | otherFiles: '', |
| 452 | outputFileName: '**/*/output*.xml', |
| 453 | outputPath: '.', |
| 454 | passThreshold: 100, |
| 455 | reportFileName: '**/*/report*.html', |
| 456 | unstableThreshold: 0, |
| 457 | onlyCritical: true]) |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 458 | println("${iam}: LEAVE RobotPublisher") |
| 459 | |
| 460 | println("${iam}: LEAVE (exitStatus=${exitStatus})") |
| 461 | return |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 462 | } |
| 463 | |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 464 | // ----------------------------------------------------------------------- |
| 465 | // Intent: main |
| 466 | // ----------------------------------------------------------------------- |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 467 | pipeline { |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 468 | /* no label, executor is determined by JJB */ |
| 469 | agent { |
| 470 | label "${params.buildNode}" |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 471 | } |
| 472 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 473 | options { |
| 474 | timeout(time: "${timeout}", unit: 'MINUTES') |
| 475 | } |
| 476 | |
| 477 | environment { |
| 478 | KUBECONFIG = "$HOME/.kube/kind-${clusterName}" |
| 479 | VOLTCONFIG = "$HOME/.volt/config" |
| 480 | PATH = "$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
| 481 | DIAGS_PROFILE = 'VOLTHA_PROFILE' |
| 482 | SSHPASS = 'karaf' |
| 483 | } |
| 484 | |
| 485 | stages { |
| 486 | stage('Download Code') { |
| 487 | steps { |
| 488 | getVolthaCode([ |
| 489 | branch: "${branch}", |
| 490 | gerritProject: "${gerritProject}", |
| 491 | gerritRefspec: "${gerritRefspec}", |
| 492 | volthaSystemTestsChange: "${volthaSystemTestsChange}", |
| 493 | volthaHelmChartsChange: "${volthaHelmChartsChange}", |
| 494 | ]) |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 495 | } |
| 496 | } |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 497 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 498 | stage('Build patch v1.1') { |
| 499 | // build the patch only if gerritProject is specified |
| 500 | when { |
| 501 | expression { return !gerritProject.isEmpty() } |
| 502 | } |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 503 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 504 | steps { |
| 505 | // NOTE that the correct patch has already been checked out |
| 506 | // during the getVolthaCode step |
| 507 | buildVolthaComponent("${gerritProject}") |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | // ----------------------------------------------------------------------- |
| 512 | // ----------------------------------------------------------------------- |
| 513 | stage('Install Kail') |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 514 | { |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 515 | steps |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 516 | { |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 517 | script |
| 518 | { |
| 519 | String cmd = [ |
| 520 | 'make', |
| 521 | '--no-print-directory', |
| 522 | '-C', "$WORKSPACE/voltha-system-tests", |
| 523 | "KAIL_PATH=\"$WORKSPACE/bin\"", |
| 524 | 'kail', |
| 525 | ].join(' ') |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 526 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 527 | println(" ** Running: ${cmd}") |
| 528 | sh("${cmd}") |
| 529 | } // script |
| 530 | } // steps |
| 531 | } // stage |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 532 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 533 | // ----------------------------------------------------------------------- |
| 534 | // ----------------------------------------------------------------------- |
| 535 | stage('Install Tools') { |
| 536 | steps { |
| 537 | script { |
| 538 | String branchName = branchName() |
| 539 | String iam = getIam('Install Tools') |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 540 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 541 | println("${iam}: ENTER (branch=$branch)") |
| 542 | installKind(branch) // needed early by stage(Cleanup) |
| 543 | println("${iam}: LEAVE (branch=$branch)") |
| 544 | } // script |
| 545 | } // steps |
| 546 | } // stage |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 547 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 548 | // ----------------------------------------------------------------------- |
| 549 | // ----------------------------------------------------------------------- |
| 550 | stage('Create K8s Cluster') { |
| 551 | steps { |
| 552 | script { |
| 553 | def clusterExists = sh( |
| 554 | returnStdout: true, |
| 555 | script: """kind get clusters | grep "${clusterName}" | wc -l""") |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 556 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 557 | if (clusterExists.trim() == '0') { |
| 558 | createKubernetesCluster([nodes: 3, name: clusterName]) |
| 559 | } |
| 560 | } // script |
| 561 | } // steps |
| 562 | } // stage('Create K8s Cluster') |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 563 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 564 | // ----------------------------------------------------------------------- |
| 565 | // ----------------------------------------------------------------------- |
| 566 | stage('Replace voltctl') { |
| 567 | // if the project is voltctl, override the downloaded one with the built one |
| 568 | when { |
| 569 | expression { return gerritProject == 'voltctl' } |
| 570 | } |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 571 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 572 | // Hmmmm(?) where did the voltctl download happen ? |
| 573 | // Likely Makefile but would be helpful to document here. |
| 574 | steps { |
| 575 | script { |
| 576 | String iam = getIam('Replace voltctl') |
Joey Armstrong | 6115fd6 | 2023-08-24 08:19:28 -0400 | [diff] [blame] | 577 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 578 | println("${iam} Running: installVoltctl($branch)") |
| 579 | println("${iam}: ENTER") |
| 580 | installVoltctl("$branch") |
| 581 | println("${iam}: LEAVE") |
| 582 | } // script |
| 583 | } // step |
| 584 | } // stage |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 585 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 586 | // ----------------------------------------------------------------------- |
| 587 | // ----------------------------------------------------------------------- |
| 588 | stage('Load image in kind nodes') |
| 589 | { |
| 590 | when { |
| 591 | expression { return !gerritProject.isEmpty() } |
| 592 | } |
| 593 | steps { |
| 594 | loadToKind() |
| 595 | } // steps |
| 596 | } // stage |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 597 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 598 | // ----------------------------------------------------------------------- |
| 599 | // [TODO] verify testing output |
| 600 | // ----------------------------------------------------------------------- |
| 601 | stage('Parse and execute tests') |
| 602 | { |
| 603 | steps { |
| 604 | script { |
| 605 | // Announce ourselves for log usability |
| 606 | enter('Parse and execute tests') |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 607 | |
Joey Armstrong | ebc1802 | 2023-08-26 13:20:49 -0400 | [diff] [blame] | 608 | def tests = readYaml text: testTargets // typeof == Map (?) |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 609 | println("** [DEBUG]: tests=$tests") |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 610 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 611 | // Display expected tests for times when output goes dark |
| 612 | tests.eachWithIndex { test, idx -> |
| 613 | String target = test['target'] |
| 614 | println("** test[${idx}]: ${target}\n") |
| 615 | } |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 616 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 617 | println(''' |
Joey Armstrong | b29d561 | 2023-08-24 12:53:46 -0400 | [diff] [blame] | 618 | ** ----------------------------------------------------------------------- |
| 619 | ** NOTE: For odd/silent job failures verify a few details |
Joey Armstrong | 5d65efe | 2023-08-25 09:43:18 -0400 | [diff] [blame] | 620 | ** - All tests mentioned in the tests-to-run index were logged. |
Joey Armstrong | b29d561 | 2023-08-24 12:53:46 -0400 | [diff] [blame] | 621 | ** - Test suites display ENTER/LEAVE mesasge pairs. |
Joey Armstrong | 5d65efe | 2023-08-25 09:43:18 -0400 | [diff] [blame] | 622 | ** - Processing terminated prematurely when LEAVE strings are missing. |
Joey Armstrong | b29d561 | 2023-08-24 12:53:46 -0400 | [diff] [blame] | 623 | ** ----------------------------------------------------------------------- |
Joey Armstrong | be7c924 | 2023-08-24 16:20:31 -0400 | [diff] [blame] | 624 | ''') |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 625 | tests.eachWithIndex { test, idx -> |
| 626 | println "** readYaml test suite[$idx]) test=[${test}]" |
Joey Armstrong | f46b3ae | 2023-08-25 11:07:20 -0400 | [diff] [blame] | 627 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 628 | String target = test['target'] |
| 629 | String workflow = test['workflow'] |
| 630 | String flags = test['flags'] |
| 631 | Boolean teardown = test['teardown'].toBoolean() |
| 632 | Boolean logging = test['logging'].toBoolean() |
| 633 | String testLogging = (logging) ? 'True' : 'False' |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 634 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 635 | print(""" |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 636 | ** ----------------------------------------------------------------------- |
Joey Armstrong | 38a8783 | 2023-08-23 17:02:50 -0400 | [diff] [blame] | 637 | ** Executing test ${target} on workflow ${workflow} with logging ${testLogging} and extra flags ${flags} |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 638 | ** ----------------------------------------------------------------------- |
Joey Armstrong | 38a8783 | 2023-08-23 17:02:50 -0400 | [diff] [blame] | 639 | """) |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 640 | try { |
Joey Armstrong | 6146f7e | 2023-08-28 09:05:38 -0400 | [diff] [blame] | 641 | enter("execute_test (target=$target)") |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 642 | execute_test(target, workflow, testLogging, teardown, flags) |
| 643 | } |
Joey Armstrong | 9341c9a | 2023-08-28 12:09:19 -0400 | [diff] [blame] | 644 | // groovylint-disable-next-line CatchException |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 645 | catch (Exception err) { |
Joey Armstrong | 9341c9a | 2023-08-28 12:09:19 -0400 | [diff] [blame] | 646 | String iamexc = getIam(name) |
| 647 | println("** ${iamexc}: EXCEPTION ${err}") |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 648 | } |
| 649 | finally { |
| 650 | leave("execute_test (target=$target)") |
| 651 | } |
| 652 | } // for |
| 653 | // Premature exit if this message is not logged |
| 654 | leave('Parse and execute tests') |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 655 | } // script |
| 656 | } // steps |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 657 | } // stage |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 658 | } // stages |
| 659 | |
| 660 | post |
| 661 | { |
| 662 | aborted { collectArtifacts('aborted') } |
| 663 | failure { collectArtifacts('failed') } |
| 664 | always { collectArtifacts('always') } |
| 665 | } |
| 666 | } // pipeline |
| 667 | |
Joey Armstrong | 7229d9b | 2023-08-25 18:03:13 -0400 | [diff] [blame] | 668 | // [EOF] - 2 |