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 | |
Matteo Scandolo | a156b57 | 2021-02-04 11:52:18 -0800 | [diff] [blame] | 18 | library identifier: 'cord-jenkins-libraries@master', |
| 19 | retriever: modernSCM([ |
| 20 | $class: 'GitSCMSource', |
| 21 | remote: 'https://gerrit.opencord.org/ci-management.git' |
| 22 | ]) |
| 23 | |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 24 | def clusterName = "kind-ci" |
| 25 | |
Hardik Windlass | 60fc0da | 2021-10-14 07:02:40 +0000 | [diff] [blame] | 26 | def execute_test(testTarget, workflow, testLogging, teardown, testSpecificHelmFlags = "") { |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 27 | def infraNamespace = "default" |
| 28 | def volthaNamespace = "voltha" |
| 29 | def logsDir = "$WORKSPACE/${testTarget}" |
Joey Armstrong | 293e16b | 2022-11-26 20:16:33 -0500 | [diff] [blame] | 30 | |
| 31 | stage('IAM') |
| 32 | { |
| 33 | script |
| 34 | { |
| 35 | String iam = [ |
| 36 | 'ci-management', |
| 37 | 'jjb', |
| 38 | 'pipeline', |
| 39 | 'voltha', |
| 40 | 'master', |
| 41 | 'bbsim-tests.groovy' |
| 42 | ].join('/') |
| 43 | println("** ${iam}: ENTER") |
| 44 | |
| 45 | String cmd = "which pkill" |
| 46 | def stream = sh( |
| 47 | returnStatus:false, |
| 48 | returnStdout: true, |
| 49 | script: cmd) |
| 50 | println(" ** ${cmd}:\n${stream}") |
| 51 | |
| 52 | println("** ${iam}: LEAVE") |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | stage('Cleanup') { |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 57 | if (teardown) { |
| 58 | timeout(15) { |
| 59 | script { |
| 60 | helmTeardown(["default", infraNamespace, volthaNamespace]) |
| 61 | } |
| 62 | timeout(1) { |
| 63 | sh returnStdout: false, script: ''' |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 64 | # remove orphaned port-forward from different namespaces |
| 65 | ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true |
| 66 | ''' |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 67 | } |
| 68 | } |
| 69 | } |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 70 | } |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 71 | |
| 72 | stage ('Initialize') |
| 73 | { |
| 74 | // VOL-4926 - Is voltha-system-tests available ? |
| 75 | String cmd = [ |
| 76 | 'make', |
| 77 | '-C', "$WORKSPACE/voltha-system-tests", |
| 78 | "KAIL_PATH=\"$WORKSPACE/bin\"", |
| 79 | 'kail', |
Joey Armstrong | beef4cd | 2023-01-18 09:59:58 -0500 | [diff] [blame] | 80 | ].join(' ') |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 81 | println(" ** Running: ${cmd}:\n") |
Joey Armstrong | beef4cd | 2023-01-18 09:59:58 -0500 | [diff] [blame] | 82 | sh("${cmd}") |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | stage('Deploy common infrastructure') { |
| 86 | sh ''' |
Hardik Windlass | e166049 | 2022-03-14 15:12:46 +0000 | [diff] [blame] | 87 | helm repo add onf https://charts.opencord.org |
| 88 | helm repo update |
| 89 | if [ ${withMonitoring} = true ] ; then |
| 90 | helm install nem-monitoring onf/nem-monitoring \ |
| 91 | --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \ |
| 92 | --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false |
| 93 | fi |
| 94 | ''' |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | stage('Deploy Voltha') { |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 98 | if (teardown) { |
Matteo Scandolo | ea6348e | 2021-06-10 18:44:58 +0200 | [diff] [blame] | 99 | timeout(10) { |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 100 | script { |
| 101 | |
| 102 | sh """ |
Matteo Scandolo | 9c230bb | 2021-10-22 12:48:39 -0700 | [diff] [blame] | 103 | mkdir -p ${logsDir} |
| 104 | _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] | 105 | """ |
| 106 | |
| 107 | // if we're downloading a voltha-helm-charts patch, then install from a local copy of the charts |
| 108 | def localCharts = false |
Matteo Scandolo | ea6348e | 2021-06-10 18:44:58 +0200 | [diff] [blame] | 109 | if (volthaHelmChartsChange != "" || gerritProject == "voltha-helm-charts") { |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 110 | localCharts = true |
| 111 | } |
| 112 | |
| 113 | // NOTE temporary workaround expose ONOS node ports |
Andrea Campanella | 9e41a60 | 2021-09-14 14:45:11 +0200 | [diff] [blame] | 114 | def localHelmFlags = extraHelmFlags.trim() + " --set global.log_level=${logLevel.toUpperCase()} " + |
Matteo Scandolo | 9114c89 | 2021-05-20 11:41:55 -0700 | [diff] [blame] | 115 | " --set onos-classic.onosSshPort=30115 " + |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 116 | " --set onos-classic.onosApiPort=30120 " + |
| 117 | " --set onos-classic.onosOfPort=31653 " + |
| 118 | " --set onos-classic.individualOpenFlowNodePorts=true " + testSpecificHelmFlags |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 119 | |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 120 | if (gerritProject != "") { |
| 121 | localHelmFlags = "${localHelmFlags} " + getVolthaImageFlags("${gerritProject}") |
| 122 | } |
| 123 | |
| 124 | volthaDeploy([ |
| 125 | infraNamespace: infraNamespace, |
| 126 | volthaNamespace: volthaNamespace, |
| 127 | workflow: workflow.toLowerCase(), |
Hardik Windlass | 2b16434 | 2022-02-28 03:50:48 +0000 | [diff] [blame] | 128 | withMacLearning: enableMacLearning.toBoolean(), |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 129 | extraHelmFlags: localHelmFlags, |
| 130 | localCharts: localCharts, |
| 131 | bbsimReplica: olts.toInteger(), |
| 132 | dockerRegistry: registry, |
| 133 | ]) |
Matteo Scandolo | d17de3a | 2021-04-09 15:47:52 -0700 | [diff] [blame] | 134 | } |
Matteo Scandolo | fcfc60d | 2021-02-24 09:06:48 -0800 | [diff] [blame] | 135 | |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 136 | // stop logging |
Matteo Scandolo | d17de3a | 2021-04-09 15:47:52 -0700 | [diff] [blame] | 137 | sh """ |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 138 | P_IDS="\$(ps e -ww -A | grep "_TAG=kail-startup" | grep -v grep | awk '{print \$1}')" |
| 139 | if [ -n "\$P_IDS" ]; then |
| 140 | echo \$P_IDS |
| 141 | for P_ID in \$P_IDS; do |
| 142 | kill -9 \$P_ID |
| 143 | done |
| 144 | fi |
Matteo Scandolo | 9c230bb | 2021-10-22 12:48:39 -0700 | [diff] [blame] | 145 | cd ${logsDir} |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 146 | gzip -k onos-voltha-startup-combined.log |
| 147 | rm onos-voltha-startup-combined.log |
Matteo Scandolo | d17de3a | 2021-04-09 15:47:52 -0700 | [diff] [blame] | 148 | """ |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 149 | } |
| 150 | sh """ |
| 151 | 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"& |
| 152 | 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"& |
| 153 | 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"& |
| 154 | bbsimDmiPortFwd=50075 |
| 155 | for i in {0..${olts.toInteger() - 1}}; do |
| 156 | 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"& |
| 157 | ((bbsimDmiPortFwd++)) |
| 158 | done |
Hardik Windlass | 3bb089a | 2022-03-22 17:56:03 +0000 | [diff] [blame] | 159 | if [ ${withMonitoring} = true ] ; then |
| 160 | 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"& |
| 161 | fi |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 162 | ps aux | grep port-forward |
| 163 | """ |
Matteo Scandolo | 35ac782 | 2021-10-28 18:08:54 -0700 | [diff] [blame] | 164 | // setting ONOS log level |
Matteo Scandolo | 9e8ba50 | 2021-11-17 13:56:56 -0800 | [diff] [blame] | 165 | script { |
| 166 | setOnosLogLevels([ |
| 167 | onosNamespace: infraNamespace, |
| 168 | apps: [ |
| 169 | 'org.opencord.dhcpl2relay', |
| 170 | 'org.opencord.olt', |
| 171 | 'org.opencord.aaa', |
Andrea Campanella | c076239 | 2022-03-11 15:01:13 +0100 | [diff] [blame] | 172 | 'org.opencord.maclearner', |
Matteo Scandolo | 9e8ba50 | 2021-11-17 13:56:56 -0800 | [diff] [blame] | 173 | 'org.onosproject.net.flowobjective.impl.FlowObjectiveManager', |
| 174 | 'org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager' |
| 175 | ], |
| 176 | logLevel: logLevel |
| 177 | ]) |
| 178 | } |
Matteo Scandolo | d17de3a | 2021-04-09 15:47:52 -0700 | [diff] [blame] | 179 | } |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 180 | } |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 181 | |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 182 | stage('Run test ' + testTarget + ' on ' + workflow + ' workFlow') { |
Hardik Windlass | 7294730 | 2021-06-14 10:36:57 +0000 | [diff] [blame] | 183 | sh """ |
Hardik Windlass | 8cd517c | 2022-03-22 04:01:40 +0000 | [diff] [blame] | 184 | if [ ${withMonitoring} = true ] ; then |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 185 | mkdir -p "$WORKSPACE/voltha-pods-mem-consumption-${workflow}" |
| 186 | cd "$WORKSPACE/voltha-system-tests" |
Hardik Windlass | 8cd517c | 2022-03-22 04:01:40 +0000 | [diff] [blame] | 187 | make vst_venv |
| 188 | source ./vst_venv/bin/activate || true |
| 189 | # Collect initial memory consumption |
| 190 | python scripts/mem_consumption.py -o $WORKSPACE/voltha-pods-mem-consumption-${workflow} -a 0.0.0.0:31301 -n ${volthaNamespace} || true |
| 191 | fi |
Hardik Windlass | e166049 | 2022-03-14 15:12:46 +0000 | [diff] [blame] | 192 | """ |
| 193 | sh """ |
Matteo Scandolo | 9c230bb | 2021-10-22 12:48:39 -0700 | [diff] [blame] | 194 | mkdir -p ${logsDir} |
Hardik Windlass | d62442d | 2021-11-30 10:51:20 +0000 | [diff] [blame] | 195 | export ROBOT_MISC_ARGS="-d ${logsDir} ${params.extraRobotArgs} " |
Matteo Scandolo | 9c230bb | 2021-10-22 12:48:39 -0700 | [diff] [blame] | 196 | 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] | 197 | export KVSTOREPREFIX=voltha/voltha_voltha |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 198 | |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 199 | make -C "$WORKSPACE/voltha-system-tests" ${testTarget} || true |
Hardik Windlass | 7294730 | 2021-06-14 10:36:57 +0000 | [diff] [blame] | 200 | """ |
Matteo Scandolo | 9c230bb | 2021-10-22 12:48:39 -0700 | [diff] [blame] | 201 | getPodsInfo("${logsDir}") |
Hardik Windlass | dad8e5c | 2021-11-11 05:19:47 +0000 | [diff] [blame] | 202 | sh """ |
| 203 | set +e |
| 204 | # collect logs collected in the Robot Framework StartLogging keyword |
| 205 | cd ${logsDir} |
| 206 | gzip *-combined.log || true |
| 207 | rm *-combined.log || true |
| 208 | """ |
Hardik Windlass | 8cd517c | 2022-03-22 04:01:40 +0000 | [diff] [blame] | 209 | sh """ |
| 210 | if [ ${withMonitoring} = true ] ; then |
Joey Armstrong | 8c6f648 | 2023-01-12 12:31:44 -0500 | [diff] [blame] | 211 | cd "$WORKSPACE/voltha-system-tests" |
Hardik Windlass | 8cd517c | 2022-03-22 04:01:40 +0000 | [diff] [blame] | 212 | source ./vst_venv/bin/activate || true |
| 213 | # Collect memory consumption of voltha pods once all the tests are complete |
| 214 | python scripts/mem_consumption.py -o $WORKSPACE/voltha-pods-mem-consumption-${workflow} -a 0.0.0.0:31301 -n ${volthaNamespace} || true |
| 215 | fi |
| 216 | """ |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 217 | } |
| 218 | } |
| 219 | |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 220 | def collectArtifacts(exitStatus) { |
| 221 | getPodsInfo("$WORKSPACE/${exitStatus}") |
| 222 | sh """ |
| 223 | kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/${exitStatus}/voltha.log || true |
| 224 | """ |
Hardik Windlass | 8cd517c | 2022-03-22 04:01:40 +0000 | [diff] [blame] | 225 | archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt,**/*.html,**/voltha-pods-mem-consumption-att/*,**/voltha-pods-mem-consumption-dt/*,**/voltha-pods-mem-consumption-tt/*' |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 226 | sh ''' |
| 227 | sync |
| 228 | pkill kail || true |
| 229 | which voltctl |
| 230 | md5sum $(which voltctl) |
| 231 | ''' |
| 232 | step([$class: 'RobotPublisher', |
| 233 | disableArchiveOutput: false, |
Matteo Scandolo | 9c230bb | 2021-10-22 12:48:39 -0700 | [diff] [blame] | 234 | logFileName: "**/*/log*.html", |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 235 | otherFiles: '', |
Matteo Scandolo | 9c230bb | 2021-10-22 12:48:39 -0700 | [diff] [blame] | 236 | outputFileName: "**/*/output*.xml", |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 237 | outputPath: '.', |
| 238 | passThreshold: 100, |
Matteo Scandolo | 9c230bb | 2021-10-22 12:48:39 -0700 | [diff] [blame] | 239 | reportFileName: "**/*/report*.html", |
Andrea Campanella | abc0977 | 2021-06-16 12:08:57 +0200 | [diff] [blame] | 240 | unstableThreshold: 0, |
| 241 | onlyCritical: true]); |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 242 | } |
| 243 | |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 244 | pipeline { |
| 245 | |
| 246 | /* no label, executor is determined by JJB */ |
| 247 | agent { |
| 248 | label "${params.buildNode}" |
| 249 | } |
| 250 | options { |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 251 | timeout(time: "${timeout}", unit: 'MINUTES') |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 252 | } |
| 253 | environment { |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 254 | KUBECONFIG="$HOME/.kube/kind-${clusterName}" |
| 255 | VOLTCONFIG="$HOME/.volt/config" |
| 256 | PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 257 | DIAGS_PROFILE="VOLTHA_PROFILE" |
Matteo Scandolo | 35ac782 | 2021-10-28 18:08:54 -0700 | [diff] [blame] | 258 | SSHPASS="karaf" |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 259 | } |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 260 | stages { |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 261 | stage('Download Code') { |
| 262 | steps { |
| 263 | getVolthaCode([ |
| 264 | branch: "${branch}", |
| 265 | gerritProject: "${gerritProject}", |
| 266 | gerritRefspec: "${gerritRefspec}", |
| 267 | volthaSystemTestsChange: "${volthaSystemTestsChange}", |
| 268 | volthaHelmChartsChange: "${volthaHelmChartsChange}", |
| 269 | ]) |
| 270 | } |
| 271 | } |
| 272 | stage('Build patch') { |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 273 | // build the patch only if gerritProject is specified |
| 274 | when { |
| 275 | expression { |
| 276 | return !gerritProject.isEmpty() |
| 277 | } |
| 278 | } |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 279 | steps { |
| 280 | // NOTE that the correct patch has already been checked out |
| 281 | // during the getVolthaCode step |
| 282 | buildVolthaComponent("${gerritProject}") |
| 283 | } |
| 284 | } |
| 285 | stage('Create K8s Cluster') { |
| 286 | steps { |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 287 | script { |
| 288 | def clusterExists = sh returnStdout: true, script: """ |
| 289 | kind get clusters | grep ${clusterName} | wc -l |
| 290 | """ |
| 291 | if (clusterExists.trim() == "0") { |
| 292 | createKubernetesCluster([nodes: 3, name: clusterName]) |
| 293 | } |
| 294 | } |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 295 | } |
| 296 | } |
Hardik Windlass | c6ba23e | 2021-06-08 08:19:52 +0000 | [diff] [blame] | 297 | stage('Replace voltctl') { |
| 298 | // if the project is voltctl override the downloaded one with the built one |
| 299 | when { |
| 300 | expression { |
| 301 | return gerritProject == "voltctl" |
| 302 | } |
| 303 | } |
| 304 | steps{ |
| 305 | sh """ |
Joey Armstrong | 93c8273 | 2023-02-07 03:01:25 -0500 | [diff] [blame] | 306 | # [TODO] - why is this platform specific (?) |
| 307 | # [TODO] - revisit, command alteration has masked an error (see: voltha-2.11). |
| 308 | # find will fail when no filsystem matches are found. |
| 309 | # mv(ls) succeded simply by accident/invoked at a different time. |
Hardik Windlass | c6ba23e | 2021-06-08 08:19:52 +0000 | [diff] [blame] | 310 | mv `ls $WORKSPACE/voltctl/release/voltctl-*-linux-amd*` $WORKSPACE/bin/voltctl |
| 311 | chmod +x $WORKSPACE/bin/voltctl |
| 312 | """ |
| 313 | } |
| 314 | } |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 315 | stage('Load image in kind nodes') { |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 316 | when { |
| 317 | expression { |
| 318 | return !gerritProject.isEmpty() |
| 319 | } |
| 320 | } |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 321 | steps { |
| 322 | loadToKind() |
| 323 | } |
| 324 | } |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 325 | stage('Parse and execute tests') { |
| 326 | steps { |
| 327 | script { |
| 328 | def tests = readYaml text: testTargets |
| 329 | |
| 330 | for(int i = 0;i<tests.size();i++) { |
| 331 | def test = tests[i] |
| 332 | def target = test["target"] |
| 333 | def workflow = test["workflow"] |
| 334 | def flags = test["flags"] |
| 335 | def teardown = test["teardown"].toBoolean() |
Hardik Windlass | 24e275f | 2021-10-19 08:19:06 +0000 | [diff] [blame] | 336 | def logging = test["logging"].toBoolean() |
| 337 | def testLogging = 'False' |
| 338 | if (logging) { |
| 339 | testLogging = 'True' |
| 340 | } |
| 341 | println "Executing test ${target} on workflow ${workflow} with logging ${testLogging} and extra flags ${flags}" |
| 342 | execute_test(target, workflow, testLogging, teardown, flags) |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 343 | } |
| 344 | } |
Matteo Scandolo | 29597f0 | 2021-02-12 10:53:57 -0800 | [diff] [blame] | 345 | } |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 346 | } |
| 347 | } |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 348 | post { |
Matteo Scandolo | e543c4c | 2021-03-09 07:34:29 -0800 | [diff] [blame] | 349 | aborted { |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 350 | collectArtifacts("aborted") |
Matteo Scandolo | e543c4c | 2021-03-09 07:34:29 -0800 | [diff] [blame] | 351 | } |
| 352 | failure { |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 353 | collectArtifacts("failed") |
Matteo Scandolo | e543c4c | 2021-03-09 07:34:29 -0800 | [diff] [blame] | 354 | } |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 355 | always { |
Hardik Windlass | ec9341b | 2021-06-07 11:58:29 +0000 | [diff] [blame] | 356 | collectArtifacts("always") |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 357 | } |
| 358 | } |
| 359 | } |