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 | // ----------------------------------------------------------------------- |
| 42 | // Intent: Due to lack of a reliable stack trace, construct a literal. |
| 43 | // Jenkins will re-write the call stack for serialization. |
| 44 | // ----------------------------------------------------------------------- |
| 45 | String getIam(String func) { |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 46 | String branchName = branchName() |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 47 | String src = [ |
| 48 | 'ci-management', |
| 49 | 'jjb', |
| 50 | 'pipeline', |
| 51 | 'voltha', |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 52 | branchName, |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 53 | 'bbsim-tests.groovy' |
| 54 | ].join('/') |
| 55 | |
| 56 | String name = [src, func].join('::') |
| 57 | return(name) |
| 58 | } |
| 59 | |
| 60 | // ----------------------------------------------------------------------- |
| 61 | // Intent: Determine if working on a release branch. |
| 62 | // Note: Conditional is legacy, should also check for *-dev or *-pre |
| 63 | // ----------------------------------------------------------------------- |
| 64 | Boolean isReleaseBranch(String name) |
| 65 | { |
| 66 | // List modifiers = ['-dev', '-pre', 'voltha-x.y.z-pre'] |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 67 | // if branchName in modifiers |
| 68 | return(name != 'master') // OR branchName.contains('-') |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | // ----------------------------------------------------------------------- |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 72 | // ----------------------------------------------------------------------- |
| 73 | void pgrep_proc(String proc) |
| 74 | { |
| 75 | println("** Running: pgrep --list-full ${proc}") |
| 76 | sh("""pgrep --list-full "${proc}" || true""") |
| 77 | return |
| 78 | } |
| 79 | |
| 80 | // ----------------------------------------------------------------------- |
| 81 | // ----------------------------------------------------------------------- |
| 82 | void pkill_proc(String proc) |
| 83 | { |
| 84 | println("** Running: pkill ${proc}") |
| 85 | sh(""" [[ \$(pgrep --count "${proc}") -gt 0 ]] && pkill --echo "${proc}" """) |
| 86 | return |
| 87 | } |
| 88 | |
| 89 | // ----------------------------------------------------------------------- |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 90 | // Intent: |
| 91 | // ----------------------------------------------------------------------- |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 92 | void execute_test(testTarget, workflow, testLogging, teardown, testSpecificHelmFlags='') |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 93 | { |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 94 | String infraNamespace = 'default' |
| 95 | String volthaNamespace = 'voltha' |
| 96 | String logsDir = "$WORKSPACE/${testTarget}" |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 97 | |
| 98 | stage('IAM') |
| 99 | { |
| 100 | script |
| 101 | { |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 102 | // Announce ourselves for log usability |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 103 | String iam = getIam('execute_test') |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 104 | println("${iam}: ENTER") |
| 105 | println("${iam}: LEAVE") |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 106 | } |
| 107 | } |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 108 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 109 | // ----------------------------------------------------------------------- |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 110 | // Intent: Cleanup stale port-forwarding |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 111 | // ----------------------------------------------------------------------- |
| 112 | stage('Cleanup') |
| 113 | { |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 114 | if (teardown) { |
| 115 | timeout(15) { |
| 116 | script { |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 117 | helmTeardown(['default', infraNamespace, volthaNamespace]) |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 118 | } |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 119 | } // timeout |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 120 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 121 | timeout(5) { |
| 122 | script { |
| 123 | String iam = getIam('Cleanup') |
| 124 | println("${iam}: ENTER") |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 125 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 126 | // remove orphaned port-forward from different namespaces |
| 127 | String proc = 'port-forw' |
| 128 | pgrep_proc(proc) |
| 129 | pkill_proc(proc) |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 130 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 131 | // Sanity check processes terminated |
| 132 | sh(""" |
| 133 | [[ \$(pgrep --count "${proc}") -gt 0 ]] && { \ |
| 134 | echo "ERROR: Detected zombie port-forwarding processes" |
| 135 | pgrep --list-full "${proc}" || true ; } |
| 136 | """) |
| 137 | println("${iam}: LEAVE") |
| 138 | } // script |
| 139 | } // timeout |
| 140 | } // teardown |
| 141 | } // stage |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 142 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 143 | // ----------------------------------------------------------------------- |
| 144 | // ----------------------------------------------------------------------- |
| 145 | stage('Deploy common infrastructure') |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 146 | { |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 147 | script |
| 148 | { |
| 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 | |
| 162 | sh(''' |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 163 | helm repo add onf https://charts.opencord.org |
| 164 | helm repo update |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 165 | |
| 166 | echo -e "\nwithMonitoring=[$withMonitoring]" |
| 167 | if [ ${withMonitoring} = true ] ; then |
| 168 | helm install nem-monitoring onf/nem-monitoring \ |
| 169 | --set $promargs \ |
| 170 | --set $dashargs |
| 171 | fi |
| 172 | ''') |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 173 | } |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 174 | } |
| 175 | |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 176 | // ----------------------------------------------------------------------- |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 177 | // [TODO] Check onos_log output |
| 178 | // [TODO] kail-startup pgrep/pkill |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 179 | // ----------------------------------------------------------------------- |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 180 | stage('Deploy Voltha') |
| 181 | { |
| 182 | if (teardown) |
| 183 | { |
| 184 | timeout(10) |
| 185 | { |
| 186 | script |
| 187 | { |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 188 | String iam = getIam('Deploy Voltha') |
| 189 | String combinedLog = "${logsDir}/onos-voltha-startup-combined.log" |
| 190 | sh(""" |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 191 | mkdir -p ${logsDir} |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 192 | onos_log="${logsDir}/onos-voltha-startup-combined.log" |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 193 | touch "$onos_log |
Joey Armstrong | dddbbf9 | 2023-08-22 16:00:41 -0400 | [diff] [blame] | 194 | echo "** kail-startup ENTER: \$(date)" > "$onos_log" |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 195 | |
| 196 | # Intermixed output (tee -a &) may get conflusing but let(s) see |
| 197 | # what messages are logged during startup. |
| 198 | # _TAG=kail-startup kail -n ${infraNamespace} -n ${volthaNamespace} >> "$onos_log" & |
| 199 | _TAG=kail-startup kail -n ${infraNamespace} -n ${volthaNamespace} | tee -a "$onos_log" & |
| 200 | """) |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 201 | |
Joey Armstrong | dddbbf9 | 2023-08-22 16:00:41 -0400 | [diff] [blame] | 202 | // if we're downloading a voltha-helm-charts patch, then install from a local copy of the charts |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 203 | Boolean localCharts = false |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 204 | |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 205 | if (volthaHelmChartsChange != '' |
| 206 | || gerritProject == 'voltha-helm-charts' |
| 207 | || isReleaseBranch(branch) // branch != 'master' |
| 208 | ) { |
| 209 | localCharts = true |
| 210 | } |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 211 | |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 212 | String branchName = branchName() |
| 213 | Boolean is_release = isReleaseBranch(branch) |
| 214 | println([ |
| 215 | " ** localCharts=${localCharts}", |
| 216 | "branchName=${branchName}", |
| 217 | "branch=${branch}", |
| 218 | "branch=isReleaseBranch=${is_release}", |
| 219 | ].join(', ')) |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 220 | |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 221 | // ----------------------------------------------------------------------- |
| 222 | // Rewrite localHelmFlags using array join, moving code around and |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 223 | // refactoring into standalone functions |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 224 | // ----------------------------------------------------------------------- |
| 225 | // hudson.remoting.ProxyException: groovy.lang.MissingMethodException: |
| 226 | // No signature of method: java.lang.String.positive() is applicable for argument types: () values: [] |
| 227 | // ----------------------------------------------------------------------- |
| 228 | // NOTE temporary workaround expose ONOS node ports |
| 229 | // ----------------------------------------------------------------------- |
| 230 | String localHelmFlags = [ |
| 231 | extraHelmFlags.trim(), |
| 232 | "--set global.log_level=${logLevel.toUpperCase()}", |
| 233 | '--set onos-classic.onosSshPort=30115', |
| 234 | '--set onos-classic.onosApiPort=30120', |
| 235 | '--set onos-classic.onosOfPort=31653', |
| 236 | '--set onos-classic.individualOpenFlowNodePorts=true', |
| 237 | testSpecificHelmFlags |
| 238 | ].join(' ') |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 239 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 240 | println("** ${iam} localHelmFlags = ${localHelmFlags}") |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 241 | |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 242 | if (gerritProject != '') { |
| 243 | localHelmFlags = "${localHelmFlags} " + getVolthaImageFlags("${gerritProject}") |
| 244 | } |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 245 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 246 | println('** ${iam}: ENTER') |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 247 | volthaDeploy([ |
| 248 | infraNamespace: infraNamespace, |
| 249 | volthaNamespace: volthaNamespace, |
| 250 | workflow: workflow.toLowerCase(), |
| 251 | withMacLearning: enableMacLearning.toBoolean(), |
| 252 | extraHelmFlags: localHelmFlags, |
| 253 | localCharts: localCharts, |
| 254 | bbsimReplica: olts.toInteger(), |
| 255 | dockerRegistry: registry, |
| 256 | ]) |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 257 | println('** ${iam}: LEAVE') |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 258 | } // script |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 259 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 260 | // ----------------------------------------------------------------------- |
| 261 | // Intent: Replacing P_IDS with pgrep/pkill is a step forward. |
| 262 | // Why not simply use a pid file, capture _TAG=kail-startup above |
| 263 | // Grep runs the risk of terminating stray commands (??-good <=> bad-??) |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 264 | // ----------------------------------------------------------------------- |
| 265 | script { |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 266 | pgrep_proc('kail-startup') |
Joey Armstrong | dddbbf9 | 2023-08-22 16:00:41 -0400 | [diff] [blame] | 267 | |
| 268 | println(''' |
| 269 | |
| 270 | ** ----------------------------------------------------------------------- |
| 271 | ** Raw ps process list for kail-startup (WIP) |
| 272 | ** ----------------------------------------------------------------------- |
| 273 | ''') |
| 274 | sh('''ps e -ww -A | grep "_TAG=kail-startup"''') |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 275 | } |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 276 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 277 | // ----------------------------------------------------------------------- |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 278 | // stop logging |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 279 | // ----------------------------------------------------------------------- |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 280 | sh(""" |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 281 | P_IDS="\$(ps e -ww -A | grep "_TAG=kail-startup" | grep -v grep | awk '{print \$1}')" |
| 282 | if [ -n "\$P_IDS" ]; then |
| 283 | echo \$P_IDS |
| 284 | for P_ID in \$P_IDS; do |
| 285 | kill -9 \$P_ID |
| 286 | done |
| 287 | fi |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 288 | """) |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 289 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 290 | sh(""" |
| 291 | cat <<EOM |
| 292 | |
| 293 | ** ----------------------------------------------------------------------- |
| 294 | ** Combine an compress voltha startup log(s) |
| 295 | ** ----------------------------------------------------------------------- |
| 296 | EOM |
| 297 | pushd "${logsDir}" || { echo "ERROR: pushd $logsDir failed"; exit 1; } |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 298 | gzip -k onos-voltha-startup-combined.log |
| 299 | rm onos-voltha-startup-combined.log |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 300 | popd |
| 301 | """) |
| 302 | } |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 303 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 304 | |
| 305 | // ----------------------------------------------------------------------- |
| 306 | // ----------------------------------------------------------------------- |
| 307 | sh """ |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 308 | 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"& |
| 309 | 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"& |
| 310 | 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"& |
| 311 | bbsimDmiPortFwd=50075 |
| 312 | for i in {0..${olts.toInteger() - 1}}; do |
| 313 | 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"& |
| 314 | ((bbsimDmiPortFwd++)) |
| 315 | done |
| 316 | if [ ${withMonitoring} = true ] ; then |
| 317 | 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"& |
| 318 | fi |
| 319 | ps aux | grep port-forward |
| 320 | """ |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 321 | // [TODO] pgrep_proc('port-forward') |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 322 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 323 | |
| 324 | // setting ONOS log level |
| 325 | script { |
| 326 | println('** setOnosLogLevels: ENTER') |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 327 | setOnosLogLevels([ |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 328 | onosNamespace: infraNamespace, |
| 329 | apps: [ |
| 330 | 'org.opencord.dhcpl2relay', |
| 331 | 'org.opencord.olt', |
| 332 | 'org.opencord.aaa', |
| 333 | 'org.opencord.maclearner', |
| 334 | 'org.onosproject.net.flowobjective.impl.FlowObjectiveManager', |
| 335 | 'org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager' |
| 336 | ], |
| 337 | logLevel: logLevel |
| 338 | ]) |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 339 | println('** setOnosLogLevels: LEAVE') |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 340 | } // script |
| 341 | } // if (teardown) |
| 342 | } // stage('Deploy Voltha') |
| 343 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 344 | // ----------------------------------------------------------------------- |
| 345 | // ----------------------------------------------------------------------- |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 346 | stage("Run test ${testTarget} on workflow ${workflow}") |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 347 | { |
| 348 | sh """ |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 349 | echo -e "\n** Monitor using mem_consumption.py ?" |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 350 | |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 351 | if [ ${withMonitoring} = true ] ; then |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 352 | cat <<EOM |
| 353 | |
| 354 | ** ----------------------------------------------------------------------- |
| 355 | ** Monitoring memory usage with mem_consumption.py |
| 356 | ** ----------------------------------------------------------------------- |
| 357 | EOM |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 358 | mkdir -p "$WORKSPACE/voltha-pods-mem-consumption-${workflow}" |
| 359 | cd "$WORKSPACE/voltha-system-tests" |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 360 | |
| 361 | echo '** Installing python virtualenv' |
| 362 | make venv-activate-patched |
| 363 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 364 | set +u && source .venv/bin/activate && set -u |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 365 | # Collect initial memory consumption |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 366 | 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] | 367 | fi |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 368 | |
| 369 | echo -e '** Monitor memory consumption: LEAVE\n' |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 370 | """ |
| 371 | |
| 372 | sh """ |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 373 | echo -e "\n** make testTarget=[${testTarget}]" |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 374 | mkdir -p ${logsDir} |
| 375 | export ROBOT_MISC_ARGS="-d ${logsDir} ${params.extraRobotArgs} " |
| 376 | 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}" |
| 377 | export KVSTOREPREFIX=voltha/voltha_voltha |
| 378 | |
Joey Armstrong | 0eb8bd8 | 2023-07-10 13:26:25 -0400 | [diff] [blame] | 379 | make -C "$WORKSPACE/voltha-system-tests" ${testTarget} |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 380 | """ |
| 381 | |
| 382 | getPodsInfo("${logsDir}") |
| 383 | |
| 384 | sh """ |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 385 | echo -e '\n** Gather robot Framework logs: ENTER' |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 386 | # set +e |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 387 | # collect logs collected in the Robot Framework StartLogging keyword |
| 388 | cd ${logsDir} |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 389 | gzip *-combined.log |
| 390 | rm -f *-combined.log |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 391 | |
| 392 | echo -e '** Gather robot Framework logs: LEAVE\n' |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 393 | """ |
| 394 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 395 | // ----------------------------------------------------------------------- |
| 396 | // ----------------------------------------------------------------------- |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 397 | sh """ |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 398 | echo -e '** Monitor pod-mem-consumption: ENTER' |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 399 | if [ ${withMonitoring} = true ] ; then |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 400 | cat <<EOM |
| 401 | |
| 402 | ** ----------------------------------------------------------------------- |
| 403 | ** Monitoring pod-memory-consumption using mem_consumption.py |
| 404 | ** ----------------------------------------------------------------------- |
| 405 | EOM |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 406 | cd "$WORKSPACE/voltha-system-tests" |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 407 | |
| 408 | echo '** Installing python virtualenv' |
| 409 | make venv-activate-patched |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 410 | set +u && source .venv/bin/activate && set -u |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 411 | # Collect memory consumption of voltha pods once all the tests are complete |
Joey Armstrong | 0eb8bd8 | 2023-07-10 13:26:25 -0400 | [diff] [blame] | 412 | 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] | 413 | fi |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 414 | echo -e '** Monitor pod-mem-consumption: LEAVE\n' |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 415 | """ |
| 416 | } // stage |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 417 | |
| 418 | return |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 419 | } // execute_test() |
| 420 | |
| 421 | // ----------------------------------------------------------------------- |
| 422 | // ----------------------------------------------------------------------- |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 423 | def collectArtifacts(exitStatus) { |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 424 | String iam = getIam('execute_test') |
| 425 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 426 | echo ''' |
| 427 | |
| 428 | ** ----------------------------------------------------------------------- |
| 429 | ** collectArtifacts |
| 430 | ** ----------------------------------------------------------------------- |
| 431 | ''' |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 432 | println("${iam}: ENTER (exitStatus=${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 | getPodsInfo("$WORKSPACE/${exitStatus}") |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 435 | |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 436 | sh """ |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 437 | 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] | 438 | """ |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 439 | |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 440 | 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] | 441 | |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 442 | sh(returnStdout:true, script: ''' |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 443 | sync |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 444 | echo '** Running: pgrep --list-full kail-startup (ENTER)' |
| 445 | pgrep --list-full 'kail-startup' || true |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 446 | [[ $(pgrep --count kail) -gt 0 ]] && pkill --echo kail |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 447 | echo '** Running: pgrep --list-full kail-startup (LEAVE)' |
| 448 | ''') |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 449 | |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 450 | println("${iam}: ENTER RobotPublisher") |
| 451 | step([$class: 'RobotPublisher', |
| 452 | disableArchiveOutput: false, |
| 453 | logFileName: '**/*/log*.html', |
| 454 | otherFiles: '', |
| 455 | outputFileName: '**/*/output*.xml', |
| 456 | outputPath: '.', |
| 457 | passThreshold: 100, |
| 458 | reportFileName: '**/*/report*.html', |
| 459 | unstableThreshold: 0, |
| 460 | onlyCritical: true]); |
| 461 | println("${iam}: LEAVE RobotPublisher") |
| 462 | |
| 463 | println("${iam}: LEAVE (exitStatus=${exitStatus})") |
| 464 | return |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 465 | } |
| 466 | |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 467 | // ----------------------------------------------------------------------- |
| 468 | // Intent: main |
| 469 | // ----------------------------------------------------------------------- |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 470 | pipeline { |
| 471 | |
| 472 | /* no label, executor is determined by JJB */ |
| 473 | agent { |
| 474 | label "${params.buildNode}" |
| 475 | } |
| 476 | options { |
| 477 | timeout(time: "${timeout}", unit: 'MINUTES') |
| 478 | } |
| 479 | environment { |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 480 | KUBECONFIG = "$HOME/.kube/kind-${clusterName}" |
| 481 | VOLTCONFIG = "$HOME/.volt/config" |
| 482 | PATH = "$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
| 483 | DIAGS_PROFILE = 'VOLTHA_PROFILE' |
| 484 | SSHPASS = 'karaf' |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 485 | } |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 486 | |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 487 | stages { |
| 488 | stage('Download Code') { |
| 489 | steps { |
| 490 | getVolthaCode([ |
| 491 | branch: "${branch}", |
| 492 | gerritProject: "${gerritProject}", |
| 493 | gerritRefspec: "${gerritRefspec}", |
| 494 | volthaSystemTestsChange: "${volthaSystemTestsChange}", |
| 495 | volthaHelmChartsChange: "${volthaHelmChartsChange}", |
| 496 | ]) |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | stage('Build patch v1.1') |
| 501 | { |
| 502 | // build the patch only if gerritProject is specified |
| 503 | when |
| 504 | { |
| 505 | expression |
| 506 | { |
| 507 | return !gerritProject.isEmpty() |
| 508 | } |
| 509 | } |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 510 | |
| 511 | steps |
| 512 | { |
| 513 | // NOTE that the correct patch has already been checked out |
| 514 | // during the getVolthaCode step |
| 515 | buildVolthaComponent("${gerritProject}") |
| 516 | } |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 517 | } |
| 518 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 519 | // ----------------------------------------------------------------------- |
| 520 | // ----------------------------------------------------------------------- |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 521 | stage('Install Kail') |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 522 | { |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 523 | steps |
| 524 | { |
| 525 | script |
| 526 | { |
| 527 | String cmd = [ |
| 528 | 'make', |
Joey Armstrong | 9f184d3 | 2023-08-03 11:34:48 -0400 | [diff] [blame] | 529 | '--no-print-directory', |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 530 | '-C', "$WORKSPACE/voltha-system-tests", |
| 531 | "KAIL_PATH=\"$WORKSPACE/bin\"", |
| 532 | 'kail', |
| 533 | ].join(' ') |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 534 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 535 | println(" ** Running: ${cmd}") |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 536 | sh("${cmd}") |
| 537 | } // script |
| 538 | } // steps |
| 539 | } // stage |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 540 | |
| 541 | // ----------------------------------------------------------------------- |
| 542 | // ----------------------------------------------------------------------- |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 543 | stage('Install Kind') |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 544 | { |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 545 | steps |
| 546 | { |
| 547 | script |
| 548 | { |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 549 | |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 550 | String cmd = [ |
| 551 | 'make', |
Joey Armstrong | 9f184d3 | 2023-08-03 11:34:48 -0400 | [diff] [blame] | 552 | '--no-print-directory', |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 553 | '-C', "$WORKSPACE/voltha-system-tests", |
| 554 | "KIND_PATH=\"$WORKSPACE/bin\"", |
| 555 | 'install-command-kind', |
| 556 | ].join(' ') |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 557 | |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 558 | println(" ** Running: ${cmd}") |
| 559 | sh("${cmd}") |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 560 | } // script |
| 561 | } // steps |
| 562 | } // stage |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 563 | |
| 564 | // ----------------------------------------------------------------------- |
| 565 | // ----------------------------------------------------------------------- |
| 566 | stage('Create K8s Cluster') |
| 567 | { |
| 568 | steps |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 569 | { |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 570 | script |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 571 | { |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 572 | def clusterExists = sh( |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 573 | returnStdout: true, |
| 574 | script: """kind get clusters | grep "${clusterName}" | wc -l""") |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 575 | |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 576 | if (clusterExists.trim() == '0') |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 577 | { |
| 578 | createKubernetesCluster([nodes: 3, name: clusterName]) |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 579 | } |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 580 | } // script |
| 581 | } // steps |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 582 | } // stage('Create K8s Cluster') |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 583 | |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 584 | // ----------------------------------------------------------------------- |
| 585 | // ----------------------------------------------------------------------- |
| 586 | stage('Replace voltctl') |
| 587 | { |
| 588 | // if the project is voltctl, override the downloaded one with the built one |
| 589 | when { |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 590 | expression { return gerritProject == 'voltctl' } |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 591 | } |
| 592 | |
| 593 | // Hmmmm(?) where did the voltctl download happen ? |
| 594 | // Likely Makefile but would be helpful to document here. |
| 595 | steps |
| 596 | { |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 597 | println("${iam} Running: installVoltctl($branch)") |
| 598 | installVoltctl("$branch") |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 599 | } // steps |
| 600 | } // stage |
| 601 | |
| 602 | // ----------------------------------------------------------------------- |
| 603 | // ----------------------------------------------------------------------- |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 604 | stage('voltctl [DEBUG]') { |
| 605 | steps { |
| 606 | script { |
| 607 | String iam = getIam('execute_test') |
| 608 | |
| 609 | println("${iam} Display umask") |
| 610 | sh('umask') |
| 611 | |
| 612 | println("${iam} Checking voltctl config permissions") |
| 613 | sh('/bin/ls -ld ~/.volt ~/.volt/* || true') |
| 614 | } // script |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 615 | } // steps |
| 616 | } // stage |
| 617 | |
| 618 | // ----------------------------------------------------------------------- |
| 619 | // ----------------------------------------------------------------------- |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 620 | stage('Load image in kind nodes') |
| 621 | { |
| 622 | when { |
| 623 | expression { return !gerritProject.isEmpty() } |
| 624 | } |
| 625 | steps { |
| 626 | loadToKind() |
| 627 | } // steps |
| 628 | } // stage |
| 629 | |
| 630 | // ----------------------------------------------------------------------- |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 631 | // [TODO] verify testing output |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 632 | // ----------------------------------------------------------------------- |
| 633 | stage('Parse and execute tests') |
| 634 | { |
| 635 | steps { |
| 636 | script { |
Joey Armstrong | f060aee | 2023-08-22 21:55:26 -0400 | [diff] [blame^] | 637 | // Announce ourselves for log usability |
| 638 | String iam = getIam('execute_test') |
| 639 | println("${iam}: ENTER") |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 640 | |
| 641 | def tests = readYaml text: testTargets |
| 642 | |
| 643 | println("** $iam: Testing index: tests-to-run") |
| 644 | tests.eachWithIndex { test, idx -> |
| 645 | String target = test['target'] |
| 646 | println("** $idx: $target") |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 647 | } |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 648 | println("** NOTE: For odd failures compare tests-to-run with teste output") |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 649 | |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 650 | tests.eachWithIndex { test, idx -> |
| 651 | println "** readYaml test suite[$idx]) test=[${test}]" |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 652 | |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 653 | String target = test['target'] |
| 654 | String workflow = test['workflow'] |
| 655 | String flags = test['flags'] |
| 656 | Boolean teardown = test['teardown'].toBoolean() |
| 657 | Boolean logging = test['logging'].toBoolean() |
| 658 | String testLogging = (logging) ? 'True' : 'False' |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 659 | |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 660 | print(""" |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 661 | ** ----------------------------------------------------------------------- |
| 662 | ** Executing test ${target} on workflow ${workflow} with logging ${testLogging} and extra flags ${flags}" |
| 663 | ** ----------------------------------------------------------------------- |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 664 | ) |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 665 | |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 666 | try { |
| 667 | println "Executing test ${target}: ENTER" |
| 668 | execute_test(target, workflow, testLogging, teardown, flags) |
| 669 | } |
| 670 | catch (Exception err) { |
| 671 | println("** ${iam}: EXCEPTION ${err}") |
| 672 | } |
| 673 | finally { |
| 674 | println "Executing test ${target}: LEAVE" |
| 675 | } |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 676 | |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 677 | } // for |
Joey Armstrong | 642540a | 2023-08-10 10:26:36 -0400 | [diff] [blame] | 678 | |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 679 | // Premature exit if this message is not logged |
| 680 | println("${iam}: LEAVE (testing ran to completion)") |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 681 | } // script |
| 682 | } // steps |
Joey Armstrong | 008cfaf | 2023-08-18 14:49:06 -0400 | [diff] [blame] | 683 | } // stage |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 684 | } // stages |
| 685 | |
| 686 | post |
| 687 | { |
| 688 | aborted { collectArtifacts('aborted') } |
| 689 | failure { collectArtifacts('failed') } |
| 690 | always { collectArtifacts('always') } |
| 691 | } |
| 692 | } // pipeline |
| 693 | |
| 694 | // EOF |