Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 1 | // Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 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 | |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 15 | // voltha-2.x e2e tests for openonu-go |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 16 | // uses bbsim to simulate OLT/ONUs |
| 17 | |
Joey Armstrong | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 18 | // [TODO] Update syntax below to the latest supported |
Matteo Scandolo | a156b57 | 2021-02-04 11:52:18 -0800 | [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 | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 25 | //------------------// |
| 26 | //---] GLOBAL [---// |
| 27 | //------------------// |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 28 | String clusterName = 'kind-ci' // was def |
Joey Armstrong | f076c31 | 2023-08-01 17:17:10 -0400 | [diff] [blame] | 29 | |
| 30 | // ----------------------------------------------------------------------- |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 31 | // Intent: |
Joey Armstrong | f076c31 | 2023-08-01 17:17:10 -0400 | [diff] [blame] | 32 | // ----------------------------------------------------------------------- |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 33 | String branchName() { |
Joey Armstrong | f076c31 | 2023-08-01 17:17:10 -0400 | [diff] [blame] | 34 | String name = 'master' |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 35 | |
| 36 | // [TODO] Sanity check the target branch |
| 37 | // if (name != jenkins.branch) { fatal } |
Joey Armstrong | f076c31 | 2023-08-01 17:17:10 -0400 | [diff] [blame] | 38 | return(name) |
| 39 | } |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 40 | |
Joey Armstrong | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 41 | // ----------------------------------------------------------------------- |
Joey Armstrong | 06a6837 | 2023-07-24 16:37:16 -0400 | [diff] [blame] | 42 | // Intent: Due to lack of a reliable stack trace, construct a literal. |
| 43 | // Jenkins will re-write the call stack for serialization. |
| 44 | // ----------------------------------------------------------------------- |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 45 | String getIam(String func) { |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 46 | String branchName = branchName() |
Joey Armstrong | 06a6837 | 2023-07-24 16:37:16 -0400 | [diff] [blame] | 47 | String src = [ |
| 48 | 'ci-management', |
| 49 | 'jjb', |
| 50 | 'pipeline', |
| 51 | 'voltha', |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 52 | branchName, |
Joey Armstrong | 06a6837 | 2023-07-24 16:37:16 -0400 | [diff] [blame] | 53 | 'bbsim-tests.groovy' |
| 54 | ].join('/') |
| 55 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 56 | String name = [src, func].join('::') |
| 57 | return(name) |
Joey Armstrong | 06a6837 | 2023-07-24 16:37:16 -0400 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | // ----------------------------------------------------------------------- |
Joey Armstrong | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 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 | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 67 | // if branchName in modifiers |
| 68 | return(name != 'master') // OR branchName.contains('-') |
Joey Armstrong | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | // ----------------------------------------------------------------------- |
| 72 | // Intent: |
| 73 | // ----------------------------------------------------------------------- |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 74 | void execute_test(testTarget, workflow, testLogging, teardown, testSpecificHelmFlags='') |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 75 | { |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 76 | String infraNamespace = 'default' |
| 77 | String volthaNamespace = 'voltha' |
| 78 | String logsDir = "$WORKSPACE/${testTarget}" |
Joey Armstrong | 293e16b | 2022-11-26 20:16:33 -0500 | [diff] [blame] | 79 | |
| 80 | stage('IAM') |
| 81 | { |
Joey Armstrong | 84adc54 | 2023-04-11 14:47:34 -0400 | [diff] [blame] | 82 | script |
| 83 | { |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 84 | // Announce ourselves for log usability |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 85 | String iam = getIam('execute_test') |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 86 | println("${iam}: ENTER") |
| 87 | println("${iam}: LEAVE") |
Joey Armstrong | 84adc54 | 2023-04-11 14:47:34 -0400 | [diff] [blame] | 88 | } |
Joey Armstrong | 293e16b | 2022-11-26 20:16:33 -0500 | [diff] [blame] | 89 | } |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 90 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 91 | // ----------------------------------------------------------------------- |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 92 | // Intent: Cleanup stale port-forwarding |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 93 | // ----------------------------------------------------------------------- |
Joey Armstrong | f076c31 | 2023-08-01 17:17:10 -0400 | [diff] [blame] | 94 | stage('Cleanup') |
| 95 | { |
Joey Armstrong | 84adc54 | 2023-04-11 14:47:34 -0400 | [diff] [blame] | 96 | if (teardown) { |
| 97 | timeout(15) { |
| 98 | script { |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 99 | helmTeardown(['default', infraNamespace, volthaNamespace]) |
Joey Armstrong | 84adc54 | 2023-04-11 14:47:34 -0400 | [diff] [blame] | 100 | } |
| 101 | timeout(1) { |
| 102 | sh returnStdout: false, script: ''' |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 103 | # remove orphaned port-forward from different namespaces |
Joey Armstrong | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 104 | ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 105 | ''' |
Joey Armstrong | 84adc54 | 2023-04-11 14:47:34 -0400 | [diff] [blame] | 106 | } |
| 107 | } |
| 108 | } |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 109 | } |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 110 | |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 111 | // ----------------------------------------------------------------------- |
| 112 | // ----------------------------------------------------------------------- |
Joey Armstrong | 06a6837 | 2023-07-24 16:37:16 -0400 | [diff] [blame] | 113 | stage('Deploy common infrastructure') |
| 114 | { |
Joey Armstrong | 84adc54 | 2023-04-11 14:47:34 -0400 | [diff] [blame] | 115 | sh ''' |
Hardik Windlass | e166049 | 2022-03-14 15:12:46 +0000 | [diff] [blame] | 116 | helm repo add onf https://charts.opencord.org |
| 117 | helm repo update |
| 118 | if [ ${withMonitoring} = true ] ; then |
| 119 | helm install nem-monitoring onf/nem-monitoring \ |
| 120 | --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \ |
| 121 | --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false |
| 122 | fi |
| 123 | ''' |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 124 | } |
| 125 | |
Joey Armstrong | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 126 | stage('Deploy Voltha') |
| 127 | { |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 128 | if (teardown) |
| 129 | { |
| 130 | timeout(10) |
| 131 | { |
| 132 | script |
| 133 | { |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 134 | sh """ |
Matteo Scandolo | 9c230bb | 2021-10-22 12:48:39 -0700 | [diff] [blame] | 135 | mkdir -p ${logsDir} |
| 136 | _TAG=kail-startup kail -n ${infraNamespace} -n ${volthaNamespace} > ${logsDir}/onos-voltha-startup-combined.log & |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 137 | """ |
| 138 | |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 139 | // if we're downloading a voltha-helm-charts patch, then install from a local copy of the charts |
| 140 | Boolean localCharts = false |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 141 | |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 142 | if (volthaHelmChartsChange != '' |
| 143 | || gerritProject == 'voltha-helm-charts' |
| 144 | || isReleaseBranch(branch) // branch != 'master' |
| 145 | ) { |
| 146 | localCharts = true |
| 147 | } |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 148 | |
Joey Armstrong | 8a960ee | 2023-08-03 15:00:00 -0400 | [diff] [blame] | 149 | String branchName = branchName() |
| 150 | Boolean is_release = isReleaseBranch(branch) |
| 151 | println([ |
| 152 | " ** localCharts=${localCharts}", |
| 153 | "branchName=${branchName}", |
| 154 | "branch=${branch}", |
| 155 | "branch=isReleaseBranch=${is_release}", |
| 156 | ].join(', ')) |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 157 | |
Joey Armstrong | 8a960ee | 2023-08-03 15:00:00 -0400 | [diff] [blame] | 158 | // ----------------------------------------------------------------------- |
| 159 | // Rewrite localHelmFlags using array join, moving code around and |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 160 | // refactoring into standalone functions |
Joey Armstrong | 8a960ee | 2023-08-03 15:00:00 -0400 | [diff] [blame] | 161 | // ----------------------------------------------------------------------- |
| 162 | // hudson.remoting.ProxyException: groovy.lang.MissingMethodException: |
| 163 | // No signature of method: java.lang.String.positive() is applicable for argument types: () values: [] |
| 164 | // ----------------------------------------------------------------------- |
| 165 | // NOTE temporary workaround expose ONOS node ports |
| 166 | // ----------------------------------------------------------------------- |
| 167 | String localHelmFlags = [ |
| 168 | extraHelmFlags.trim(), |
| 169 | "--set global.log_level=${logLevel.toUpperCase()}", |
| 170 | '--set onos-classic.onosSshPort=30115', |
| 171 | '--set onos-classic.onosApiPort=30120', |
| 172 | '--set onos-classic.onosOfPort=31653', |
| 173 | '--set onos-classic.individualOpenFlowNodePorts=true', |
| 174 | testSpecificHelmFlags |
| 175 | ].join(' ') |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 176 | |
Joey Armstrong | 28e86ee | 2023-08-03 15:22:29 -0400 | [diff] [blame] | 177 | println("** localHelmFlags = ${localHelmFlags}") |
| 178 | |
Joey Armstrong | 8a960ee | 2023-08-03 15:00:00 -0400 | [diff] [blame] | 179 | if (gerritProject != '') { |
| 180 | localHelmFlags = "${localHelmFlags} " + getVolthaImageFlags("${gerritProject}") |
| 181 | } |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 182 | |
Joey Armstrong | 8a960ee | 2023-08-03 15:00:00 -0400 | [diff] [blame] | 183 | println('volthaDeploy: ENTER') |
| 184 | volthaDeploy([ |
| 185 | infraNamespace: infraNamespace, |
| 186 | volthaNamespace: volthaNamespace, |
| 187 | workflow: workflow.toLowerCase(), |
| 188 | withMacLearning: enableMacLearning.toBoolean(), |
| 189 | extraHelmFlags: localHelmFlags, |
| 190 | localCharts: localCharts, |
| 191 | bbsimReplica: olts.toInteger(), |
| 192 | dockerRegistry: registry, |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 193 | ]) |
Joey Armstrong | 8a960ee | 2023-08-03 15:00:00 -0400 | [diff] [blame] | 194 | println('volthaDeploy: LEAVE') |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 195 | } // script |
Matteo Scandolo | fcfc60d | 2021-02-24 09:06:48 -0800 | [diff] [blame] | 196 | |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 197 | // ----------------------------------------------------------------------- |
| 198 | // Intent: Replacing P_IDS with pgrep/pkill is a step forward. |
| 199 | // Why not simply use a pid file, capture _TAG=kail-startup above |
| 200 | // Grep runs the risk of terminating stray commands (??-good <=> bad-??) |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 201 | // ----------------------------------------------------------------------- |
| 202 | script { |
| 203 | println('Try out pgrep/pkill commands') |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 204 | sh('''pgrep --list-full kail-startup || true''') |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 205 | } |
Joey Armstrong | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 206 | |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 207 | // ----------------------------------------------------------------------- |
Joey Armstrong | 38a8783 | 2023-08-23 17:02:50 -0400 | [diff] [blame] | 208 | // stop logging |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 209 | // ----------------------------------------------------------------------- |
Matteo Scandolo | d17de3a | 2021-04-09 15:47:52 -0700 | [diff] [blame] | 210 | sh """ |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 211 | P_IDS="\$(ps e -ww -A | grep "_TAG=kail-startup" | grep -v grep | awk '{print \$1}')" |
| 212 | if [ -n "\$P_IDS" ]; then |
| 213 | echo \$P_IDS |
| 214 | for P_ID in \$P_IDS; do |
| 215 | kill -9 \$P_ID |
| 216 | done |
| 217 | fi |
Matteo Scandolo | 9c230bb | 2021-10-22 12:48:39 -0700 | [diff] [blame] | 218 | cd ${logsDir} |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 219 | gzip -k onos-voltha-startup-combined.log |
| 220 | rm onos-voltha-startup-combined.log |
Matteo Scandolo | d17de3a | 2021-04-09 15:47:52 -0700 | [diff] [blame] | 221 | """ |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 222 | } |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 223 | |
| 224 | sh """ |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 225 | 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"& |
| 226 | 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"& |
| 227 | 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"& |
| 228 | bbsimDmiPortFwd=50075 |
| 229 | for i in {0..${olts.toInteger() - 1}}; do |
| 230 | 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"& |
| 231 | ((bbsimDmiPortFwd++)) |
| 232 | done |
Hardik Windlass | 3bb089a | 2022-03-22 17:56:03 +0000 | [diff] [blame] | 233 | if [ ${withMonitoring} = true ] ; then |
| 234 | 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"& |
| 235 | fi |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 236 | ps aux | grep port-forward |
| 237 | """ |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 238 | |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 239 | // setting ONOS log level |
| 240 | script |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 241 | { |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 242 | println('** setOnosLogLevels: ENTER') |
| 243 | setOnosLogLevels([ |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 244 | onosNamespace: infraNamespace, |
| 245 | apps: [ |
| 246 | 'org.opencord.dhcpl2relay', |
| 247 | 'org.opencord.olt', |
| 248 | 'org.opencord.aaa', |
| 249 | 'org.opencord.maclearner', |
| 250 | 'org.onosproject.net.flowobjective.impl.FlowObjectiveManager', |
| 251 | 'org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager' |
| 252 | ], |
| 253 | logLevel: logLevel |
| 254 | ]) |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 255 | println('** setOnosLogLevels: LEAVE') |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 256 | } // script |
| 257 | } // if (teardown) |
| 258 | } // stage('Deploy Voltha') |
| 259 | |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 260 | // ----------------------------------------------------------------------- |
| 261 | // ----------------------------------------------------------------------- |
Joey Armstrong | fd89652 | 2023-08-04 13:30:48 -0400 | [diff] [blame] | 262 | stage("Run test ${testTarget} on workflow ${workflow}") |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 263 | { |
| 264 | sh """ |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 265 | echo -e '** Monitor memory consumption: ENTER' |
| 266 | |
Hardik Windlass | 8cd517c | 2022-03-22 04:01:40 +0000 | [diff] [blame] | 267 | if [ ${withMonitoring} = true ] ; then |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 268 | cat <<EOM |
| 269 | |
| 270 | ** ----------------------------------------------------------------------- |
| 271 | ** Monitoring memory usage with mem_consumption.py |
| 272 | ** ----------------------------------------------------------------------- |
| 273 | EOM |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 274 | mkdir -p "$WORKSPACE/voltha-pods-mem-consumption-${workflow}" |
| 275 | cd "$WORKSPACE/voltha-system-tests" |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 276 | |
| 277 | echo '** Installing python virtualenv' |
| 278 | make venv-activate-patched |
| 279 | |
Joey Armstrong | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 280 | set +u && source .venv/bin/activate && set -u |
Hardik Windlass | 8cd517c | 2022-03-22 04:01:40 +0000 | [diff] [blame] | 281 | # Collect initial memory consumption |
Joey Armstrong | 0eb8bd8 | 2023-07-10 13:26:25 -0400 | [diff] [blame] | 282 | python scripts/mem_consumption.py -o $WORKSPACE/voltha-pods-mem-consumption-${workflow} -a 0.0.0.0:31301 -n ${volthaNamespace} |
Hardik Windlass | 8cd517c | 2022-03-22 04:01:40 +0000 | [diff] [blame] | 283 | fi |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 284 | |
| 285 | echo -e '** Monitor memory consumption: LEAVE\n' |
Hardik Windlass | e166049 | 2022-03-14 15:12:46 +0000 | [diff] [blame] | 286 | """ |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 287 | |
| 288 | sh """ |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 289 | echo -e "\n** make testTarget=[${testTarget}]" |
Matteo Scandolo | 9c230bb | 2021-10-22 12:48:39 -0700 | [diff] [blame] | 290 | mkdir -p ${logsDir} |
Hardik Windlass | d62442d | 2021-11-30 10:51:20 +0000 | [diff] [blame] | 291 | export ROBOT_MISC_ARGS="-d ${logsDir} ${params.extraRobotArgs} " |
Matteo Scandolo | 9c230bb | 2021-10-22 12:48:39 -0700 | [diff] [blame] | 292 | 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}" |
Hardik Windlass | 7294730 | 2021-06-14 10:36:57 +0000 | [diff] [blame] | 293 | export KVSTOREPREFIX=voltha/voltha_voltha |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 294 | |
Joey Armstrong | 0eb8bd8 | 2023-07-10 13:26:25 -0400 | [diff] [blame] | 295 | make -C "$WORKSPACE/voltha-system-tests" ${testTarget} |
Hardik Windlass | 7294730 | 2021-06-14 10:36:57 +0000 | [diff] [blame] | 296 | """ |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 297 | |
| 298 | getPodsInfo("${logsDir}") |
| 299 | |
| 300 | sh """ |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 301 | echo -e '\n** Gather robot Framework logs: ENTER' |
Joey Armstrong | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 302 | # set +e |
Hardik Windlass | dad8e5c | 2021-11-11 05:19:47 +0000 | [diff] [blame] | 303 | # collect logs collected in the Robot Framework StartLogging keyword |
| 304 | cd ${logsDir} |
Joey Armstrong | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 305 | gzip *-combined.log |
| 306 | rm -f *-combined.log |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 307 | |
| 308 | echo -e '** Gather robot Framework logs: LEAVE\n' |
Hardik Windlass | dad8e5c | 2021-11-11 05:19:47 +0000 | [diff] [blame] | 309 | """ |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 310 | |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 311 | // ----------------------------------------------------------------------- |
| 312 | // ----------------------------------------------------------------------- |
Hardik Windlass | 8cd517c | 2022-03-22 04:01:40 +0000 | [diff] [blame] | 313 | sh """ |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 314 | echo -e '** Monitor pod-mem-consumption: ENTER' |
Hardik Windlass | 8cd517c | 2022-03-22 04:01:40 +0000 | [diff] [blame] | 315 | if [ ${withMonitoring} = true ] ; then |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 316 | cat <<EOM |
| 317 | |
| 318 | ** ----------------------------------------------------------------------- |
| 319 | ** Monitoring pod-memory-consumption using mem_consumption.py |
| 320 | ** ----------------------------------------------------------------------- |
| 321 | EOM |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 322 | cd "$WORKSPACE/voltha-system-tests" |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 323 | |
| 324 | echo '** Installing python virtualenv' |
| 325 | make venv-activate-patched |
| 326 | |
Joey Armstrong | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 327 | set +u && source .venv/bin/activate && set -u |
Hardik Windlass | 8cd517c | 2022-03-22 04:01:40 +0000 | [diff] [blame] | 328 | # Collect memory consumption of voltha pods once all the tests are complete |
Joey Armstrong | 0eb8bd8 | 2023-07-10 13:26:25 -0400 | [diff] [blame] | 329 | python scripts/mem_consumption.py -o $WORKSPACE/voltha-pods-mem-consumption-${workflow} -a 0.0.0.0:31301 -n ${volthaNamespace} |
Hardik Windlass | 8cd517c | 2022-03-22 04:01:40 +0000 | [diff] [blame] | 330 | fi |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 331 | echo -e '** Monitor pod-mem-consumption: LEAVE\n' |
Hardik Windlass | 8cd517c | 2022-03-22 04:01:40 +0000 | [diff] [blame] | 332 | """ |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 333 | } // stage |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 334 | |
| 335 | return |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 336 | } // execute_test() |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 337 | |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 338 | // ----------------------------------------------------------------------- |
| 339 | // ----------------------------------------------------------------------- |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 340 | def collectArtifacts(exitStatus) { |
Joey Armstrong | cd41912 | 2023-08-07 14:56:39 -0400 | [diff] [blame] | 341 | String iam = getIam('execute_test') |
| 342 | |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 343 | echo ''' |
| 344 | |
| 345 | ** ----------------------------------------------------------------------- |
| 346 | ** collectArtifacts |
| 347 | ** ----------------------------------------------------------------------- |
| 348 | ''' |
Joey Armstrong | cd41912 | 2023-08-07 14:56:39 -0400 | [diff] [blame] | 349 | println("${iam}: ENTER (exitStatus=${exitStatus})") |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 350 | |
Joey Armstrong | cd41912 | 2023-08-07 14:56:39 -0400 | [diff] [blame] | 351 | getPodsInfo("$WORKSPACE/${exitStatus}") |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 352 | |
Joey Armstrong | cd41912 | 2023-08-07 14:56:39 -0400 | [diff] [blame] | 353 | sh """ |
Joey Armstrong | 0eb8bd8 | 2023-07-10 13:26:25 -0400 | [diff] [blame] | 354 | kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/${exitStatus}/voltha.log |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 355 | """ |
Joey Armstrong | 66fcb4e | 2023-08-11 12:09:24 -0400 | [diff] [blame] | 356 | |
Joey Armstrong | cd41912 | 2023-08-07 14:56:39 -0400 | [diff] [blame] | 357 | 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] | 358 | |
Joey Armstrong | cd41912 | 2023-08-07 14:56:39 -0400 | [diff] [blame] | 359 | sh(returnStdout:true, script: ''' |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 360 | sync |
Joey Armstrong | cd41912 | 2023-08-07 14:56:39 -0400 | [diff] [blame] | 361 | echo '** Running: pgrep --list-full kail-startup (ENTER)' |
| 362 | pgrep --list-full 'kail-startup' || true |
Joey Armstrong | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 363 | [[ $(pgrep --count kail) -gt 0 ]] && pkill --echo kail |
Joey Armstrong | cd41912 | 2023-08-07 14:56:39 -0400 | [diff] [blame] | 364 | echo '** Running: pgrep --list-full kail-startup (LEAVE)' |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 365 | ''') |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 366 | |
Joey Armstrong | cd41912 | 2023-08-07 14:56:39 -0400 | [diff] [blame] | 367 | println("${iam}: ENTER RobotPublisher") |
| 368 | step([$class: 'RobotPublisher', |
| 369 | disableArchiveOutput: false, |
| 370 | logFileName: '**/*/log*.html', |
| 371 | otherFiles: '', |
| 372 | outputFileName: '**/*/output*.xml', |
| 373 | outputPath: '.', |
| 374 | passThreshold: 100, |
| 375 | reportFileName: '**/*/report*.html', |
| 376 | unstableThreshold: 0, |
| 377 | onlyCritical: true]); |
| 378 | println("${iam}: LEAVE RobotPublisher") |
| 379 | |
| 380 | println("${iam}: LEAVE (exitStatus=${exitStatus})") |
| 381 | return |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 382 | } |
| 383 | |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 384 | // ----------------------------------------------------------------------- |
| 385 | // Intent: main |
| 386 | // ----------------------------------------------------------------------- |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 387 | pipeline { |
| 388 | |
| 389 | /* no label, executor is determined by JJB */ |
| 390 | agent { |
| 391 | label "${params.buildNode}" |
| 392 | } |
| 393 | options { |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 394 | timeout(time: "${timeout}", unit: 'MINUTES') |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 395 | } |
| 396 | environment { |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 397 | KUBECONFIG = "$HOME/.kube/kind-${clusterName}" |
| 398 | VOLTCONFIG = "$HOME/.volt/config" |
| 399 | PATH = "$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
| 400 | DIAGS_PROFILE = 'VOLTHA_PROFILE' |
| 401 | SSHPASS = 'karaf' |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 402 | } |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 403 | stages { |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 404 | stage('Download Code') { |
| 405 | steps { |
| 406 | getVolthaCode([ |
| 407 | branch: "${branch}", |
| 408 | gerritProject: "${gerritProject}", |
| 409 | gerritRefspec: "${gerritRefspec}", |
| 410 | volthaSystemTestsChange: "${volthaSystemTestsChange}", |
| 411 | volthaHelmChartsChange: "${volthaHelmChartsChange}", |
| 412 | ]) |
| 413 | } |
| 414 | } |
Joey Armstrong | 84adc54 | 2023-04-11 14:47:34 -0400 | [diff] [blame] | 415 | |
| 416 | stage('Build patch v1.1') |
| 417 | { |
| 418 | // build the patch only if gerritProject is specified |
| 419 | when |
| 420 | { |
| 421 | expression |
| 422 | { |
| 423 | return !gerritProject.isEmpty() |
| 424 | } |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 425 | } |
Joey Armstrong | 06a6837 | 2023-07-24 16:37:16 -0400 | [diff] [blame] | 426 | |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 427 | steps |
| 428 | { |
| 429 | // NOTE that the correct patch has already been checked out |
| 430 | // during the getVolthaCode step |
| 431 | buildVolthaComponent("${gerritProject}") |
Joey Armstrong | 06a6837 | 2023-07-24 16:37:16 -0400 | [diff] [blame] | 432 | } |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 433 | } |
Joey Armstrong | ed161f7 | 2023-04-11 13:16:59 -0400 | [diff] [blame] | 434 | |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 435 | // ----------------------------------------------------------------------- |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 436 | // ----------------------------------------------------------------------- |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 437 | stage('Install Kail') |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 438 | { |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 439 | steps |
| 440 | { |
| 441 | script |
| 442 | { |
| 443 | String cmd = [ |
| 444 | 'make', |
Joey Armstrong | 9f184d3 | 2023-08-03 11:34:48 -0400 | [diff] [blame] | 445 | '--no-print-directory', |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 446 | '-C', "$WORKSPACE/voltha-system-tests", |
| 447 | "KAIL_PATH=\"$WORKSPACE/bin\"", |
| 448 | 'kail', |
| 449 | ].join(' ') |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 450 | |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 451 | println(" ** Running: ${cmd}:\n") |
| 452 | sh("${cmd}") |
| 453 | } // script |
| 454 | } // steps |
| 455 | } // stage |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 456 | |
| 457 | // ----------------------------------------------------------------------- |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 458 | // ----------------------------------------------------------------------- |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 459 | stage('Install Kind') |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 460 | { |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 461 | steps |
| 462 | { |
| 463 | script |
| 464 | { |
Joey Armstrong | 0e0a42b | 2023-08-02 21:04:21 -0400 | [diff] [blame] | 465 | |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 466 | String cmd = [ |
| 467 | 'make', |
Joey Armstrong | 9f184d3 | 2023-08-03 11:34:48 -0400 | [diff] [blame] | 468 | '--no-print-directory', |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 469 | '-C', "$WORKSPACE/voltha-system-tests", |
| 470 | "KIND_PATH=\"$WORKSPACE/bin\"", |
| 471 | 'install-command-kind', |
| 472 | ].join(' ') |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 473 | |
Joey Armstrong | 2b2010d | 2023-08-02 21:47:20 -0400 | [diff] [blame] | 474 | println(" ** Running: ${cmd}:\n") |
| 475 | sh("${cmd}") |
| 476 | } // script |
| 477 | } // steps |
| 478 | } // stage |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 479 | |
| 480 | // ----------------------------------------------------------------------- |
| 481 | // ----------------------------------------------------------------------- |
Joey Armstrong | e5aae1c | 2023-07-24 14:11:20 -0400 | [diff] [blame] | 482 | stage('Create K8s Cluster') |
| 483 | { |
Joey Armstrong | f076c31 | 2023-08-01 17:17:10 -0400 | [diff] [blame] | 484 | steps |
| 485 | { |
| 486 | script |
Joey Armstrong | 84adc54 | 2023-04-11 14:47:34 -0400 | [diff] [blame] | 487 | { |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 488 | def clusterExists = sh( |
Joey Armstrong | f076c31 | 2023-08-01 17:17:10 -0400 | [diff] [blame] | 489 | returnStdout: true, |
| 490 | script: """kind get clusters | grep "${clusterName}" | wc -l""") |
Joey Armstrong | bf49292 | 2023-04-13 17:05:09 -0400 | [diff] [blame] | 491 | |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 492 | if (clusterExists.trim() == '0') |
Joey Armstrong | f076c31 | 2023-08-01 17:17:10 -0400 | [diff] [blame] | 493 | { |
| 494 | createKubernetesCluster([nodes: 3, name: clusterName]) |
| 495 | } |
| 496 | } // script |
| 497 | } // steps |
| 498 | } // stage('Create K8s Cluster') |
Joey Armstrong | 84adc54 | 2023-04-11 14:47:34 -0400 | [diff] [blame] | 499 | |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 500 | // ----------------------------------------------------------------------- |
| 501 | // ----------------------------------------------------------------------- |
| 502 | stage('Replace voltctl') |
| 503 | { |
| 504 | // if the project is voltctl, override the downloaded one with the built one |
| 505 | when { |
| 506 | expression { |
| 507 | return gerritProject == 'voltctl' |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 508 | } |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 509 | } |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 510 | |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 511 | // Hmmmm(?) where did the voltctl download happen ? |
| 512 | // Likely Makefile but would be helpful to document here. |
| 513 | steps |
| 514 | { |
| 515 | println("${iam} Running: installVoltctl($branch)") |
| 516 | installVoltctl("$branch") |
| 517 | } // steps |
| 518 | } // stage |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 519 | |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 520 | // ----------------------------------------------------------------------- |
| 521 | // ----------------------------------------------------------------------- |
Joey Armstrong | 38a8783 | 2023-08-23 17:02:50 -0400 | [diff] [blame] | 522 | stage('voltctl [DEBUG]') { |
| 523 | steps { |
| 524 | script { |
| 525 | String iam = getIam('execute_test') |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 526 | |
Joey Armstrong | 38a8783 | 2023-08-23 17:02:50 -0400 | [diff] [blame] | 527 | println("${iam} Display umask") |
| 528 | sh('umask') |
| 529 | |
| 530 | println("${iam} Checking voltctl config permissions") |
| 531 | sh('/bin/ls -ld ~/.volt ~/.volt/* || true') |
| 532 | } // script |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 533 | } // steps |
| 534 | } // stage |
| 535 | |
| 536 | // ----------------------------------------------------------------------- |
| 537 | // ----------------------------------------------------------------------- |
| 538 | stage('Load image in kind nodes') |
| 539 | { |
| 540 | when { |
| 541 | expression { |
| 542 | return !gerritProject.isEmpty() |
| 543 | } |
| 544 | } |
| 545 | steps { |
| 546 | loadToKind() |
| 547 | } // steps |
| 548 | } // stage |
Joey Armstrong | 97a8b88 | 2023-08-02 16:08:52 -0400 | [diff] [blame] | 549 | |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 550 | // ----------------------------------------------------------------------- |
| 551 | // ----------------------------------------------------------------------- |
| 552 | stage('Parse and execute tests') |
| 553 | { |
| 554 | steps { |
| 555 | script { |
| 556 | def tests = readYaml text: testTargets |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 557 | |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 558 | tests.eachWithIndex { test, idx -> |
| 559 | println "** readYaml test suite[$idx]) test=[${test}]" |
| 560 | // def test = tests[i] |
| 561 | String target = test['target'] |
| 562 | String workflow = test['workflow'] |
| 563 | String flags = test['flags'] |
| 564 | Boolean teardown = test['teardown'].toBoolean() |
| 565 | Boolean logging = test['logging'].toBoolean() |
| 566 | String testLogging = (logging) ? 'True' : 'False' |
| 567 | |
Joey Armstrong | 268442d | 2023-08-22 17:16:10 -0400 | [diff] [blame] | 568 | print(""" |
| 569 | |
| 570 | ** ----------------------------------------------------------------------- |
| 571 | ** Executing test ${target} on workflow ${workflow} with logging ${testLogging} and extra flags ${flags}" |
| 572 | ** ----------------------------------------------------------------------- |
| 573 | |
| 574 | """) |
| 575 | |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 576 | println "Executing test ${target}: ENTER" |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 577 | execute_test(target, workflow, testLogging, teardown, flags) |
Joey Armstrong | 54dec09 | 2023-08-03 18:21:38 -0400 | [diff] [blame] | 578 | println "Executing test ${target}: LEAVE" |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 579 | } // for |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 580 | |
Joey Armstrong | cd41912 | 2023-08-07 14:56:39 -0400 | [diff] [blame] | 581 | String iam = getIam('Parse and execute tests') |
Joey Armstrong | f404b64 | 2023-08-04 14:39:13 -0400 | [diff] [blame] | 582 | println("** ${iam} ran to completion") |
Joey Armstrong | b65ada3 | 2023-08-03 12:50:20 -0400 | [diff] [blame] | 583 | } // script |
| 584 | } // steps |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 585 | } // stage |
| 586 | } // stages |
Joey Armstrong | 84adc54 | 2023-04-11 14:47:34 -0400 | [diff] [blame] | 587 | |
| 588 | post |
| 589 | { |
| 590 | aborted { collectArtifacts('aborted') } |
| 591 | failure { collectArtifacts('failed') } |
Joey Armstrong | bf49292 | 2023-04-13 17:05:09 -0400 | [diff] [blame] | 592 | always { collectArtifacts('always') } |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 593 | } |
Joey Armstrong | 2d5a7c1 | 2023-04-13 09:37:42 -0400 | [diff] [blame] | 594 | } // pipeline |
Joey Armstrong | ed161f7 | 2023-04-11 13:16:59 -0400 | [diff] [blame] | 595 | |
| 596 | // EOF |