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 | // voltha-2.x e2e tests |
| 15 | // uses bbsim to simulate OLT/ONUs |
| 16 | // NOTE we are importing the library even if it's global so that it's |
| 17 | // easier to change the keywords during a replay |
| 18 | library identifier: 'cord-jenkins-libraries@master', |
| 19 | retriever: modernSCM([ |
| 20 | $class: 'GitSCMSource', |
| 21 | remote: 'https://gerrit.opencord.org/ci-management.git' |
| 22 | ]) |
| 23 | |
Joey Armstrong | 39f9038 | 2023-08-24 20:37:40 -0400 | [diff] [blame] | 24 | // ----------------------------------------------------------------------- |
| 25 | // Intent: |
| 26 | // ----------------------------------------------------------------------- |
| 27 | String branchName() { |
| 28 | String name = 'voltha-2.12' |
| 29 | |
| 30 | // [TODO] Sanity check the target branch |
| 31 | // if (name != jenkins.branch) { fatal } |
| 32 | return(name) |
| 33 | } |
| 34 | |
| 35 | // ----------------------------------------------------------------------- |
| 36 | // Intent: Due to lack of a reliable stack trace, construct a literal. |
| 37 | // Jenkins will re-write the call stack for serialization. |
| 38 | // ----------------------------------------------------------------------- |
| 39 | String getIam(String func) { |
| 40 | String branchName = branchName() |
| 41 | String src = [ |
| 42 | 'ci-management', |
| 43 | 'jjb', |
| 44 | 'pipeline', |
| 45 | 'voltha', |
| 46 | branchName, |
| 47 | 'software-upgrades.groovy' |
| 48 | ].join('/') |
| 49 | |
| 50 | String name = [src, func].join('::') |
| 51 | return(name) |
| 52 | } |
| 53 | |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 54 | // ----------------------------------------------------------------------- |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 55 | // fetches the versions/tags of the voltha component |
| 56 | // returns the deployment version which is one less than the latest available tag of the repo, first voltha stack gets deployed using this; |
| 57 | // returns the test version which is the latest tag of the repo, the component upgrade gets tested on this. |
| 58 | // Note: if there is a major version change between deployment and test tags, then deployment tag will be same as test tag, i.e. both as latest. |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 59 | // ----------------------------------------------------------------------- |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 60 | def get_voltha_comp_versions(component, base_deploy_tag) { |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 61 | def comp_test_tag = sh( |
| 62 | script: "git ls-remote --refs --tags https://github.com/opencord/${component} | cut --delimiter='/' --fields=3 | tr '-' '~' | sort --version-sort | tail --lines=1 | sed 's/v//'", |
| 63 | returnStdout: true |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 64 | ).trim() |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 65 | def comp_deploy_tag = sh( |
| 66 | script: "git ls-remote --refs --tags https://github.com/opencord/${component} | cut --delimiter='/' --fields=3 | tr '-' '~' | sort --version-sort | tail --lines=2 | head -n 1 | sed 's/v//'", |
| 67 | returnStdout: true |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 68 | ).trim() |
| 69 | def comp_deploy_major = comp_deploy_tag.substring(0, comp_deploy_tag.indexOf('.')) |
| 70 | def comp_test_major = comp_test_tag.substring(0, comp_test_tag.indexOf('.')) |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 71 | if ("${comp_deploy_major.trim()}" != "${comp_test_major.trim()}") { |
| 72 | comp_deploy_tag = comp_test_tag |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 73 | } |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 74 | if ("${comp_test_tag.trim()}" == "${base_deploy_tag.trim()}") { |
| 75 | comp_deploy_tag = comp_test_tag |
| 76 | comp_test_tag = "master" |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 77 | } |
| 78 | println "${component}: deploy_tag: ${comp_deploy_tag}, test_tag: ${comp_test_tag}" |
| 79 | return [comp_deploy_tag, comp_test_tag] |
| 80 | } |
| 81 | |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 82 | // ----------------------------------------------------------------------- |
| 83 | // ----------------------------------------------------------------------- |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 84 | def test_software_upgrade(name) { |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 85 | def infraNamespace = "infra" |
| 86 | def volthaNamespace = "voltha" |
| 87 | def openolt_adapter_deploy_tag = '' |
| 88 | def openolt_adapter_test_tag = '' |
| 89 | def openonu_adapter_deploy_tag = '' |
| 90 | def openonu_adapter_test_tag = '' |
| 91 | def rw_core_deploy_tag = '' |
| 92 | def rw_core_test_tag = '' |
| 93 | def ofagent_deploy_tag = '' |
| 94 | def ofagent_test_tag = '' |
| 95 | def logsDir = "$WORKSPACE/${name}" |
| 96 | stage('Deploy Voltha - ' + name) { |
| 97 | timeout(10) { |
| 98 | // start logging |
| 99 | sh """ |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 100 | rm -rf ${logsDir} || true |
| 101 | mkdir -p ${logsDir} |
| 102 | _TAG=kail-${name} kail -n ${infraNamespace} -n ${volthaNamespace} > ${logsDir}/onos-voltha-startup-combined.log & |
| 103 | """ |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 104 | def extraHelmFlags = extraHelmFlags.trim() |
| 105 | if ("${name}" == "onos-app-upgrade" || "${name}" == "onu-software-upgrade" || "${name}" == "onu-software-upgrade-omci-extended-msg" || "${name}" == "voltha-component-upgrade" || "${name}" == "voltha-component-rolling-upgrade") { |
| 106 | extraHelmFlags = " --set global.log_level=${logLevel.toUpperCase()},onu=1,pon=1 --set onos-classic.replicas=3,onos-classic.atomix.replicas=3 " + extraHelmFlags |
| 107 | } |
| 108 | if ("${name}" == "onu-software-upgrade" || "${name}" == "onu-software-upgrade-omci-extended-msg") { |
| 109 | extraHelmFlags = " --set global.extended_omci_support.enabled=true " + extraHelmFlags |
| 110 | } |
| 111 | if ("${name}" == "onu-software-upgrade-omci-extended-msg") { |
| 112 | extraHelmFlags = " --set omccVersion=180 " + extraHelmFlags |
| 113 | } |
| 114 | if ("${name}" == "onu-image-dwl-simultaneously") { |
| 115 | extraHelmFlags = " --set global.log_level=${logLevel.toUpperCase()},onu=2,pon=2 --set onos-classic.replicas=3,onos-classic.atomix.replicas=3 " + extraHelmFlags |
| 116 | } |
| 117 | if ("${name}" == "onos-app-upgrade" || "${name}" == "onu-software-upgrade" || "${name}" == "onu-software-upgrade-omci-extended-msg" || "${name}" == "onu-image-dwl-simultaneously") { |
| 118 | extraHelmFlags = " --set global.image_tag=master --set onos-classic.image.tag=master " + extraHelmFlags |
| 119 | } |
| 120 | if ("${name}" == "voltha-component-upgrade" || "${name}" == "voltha-component-rolling-upgrade") { |
| 121 | extraHelmFlags = " --set images.onos_config_loader.tag=master-onos-config-loader --set onos-classic.image.tag=master " + extraHelmFlags |
| 122 | } |
| 123 | extraHelmFlags += " --set onos-classic.onosSshPort=30115 --set onos-classic.onosApiPort=30120 " |
| 124 | extraHelmFlags += " --set voltha.onos_classic.replicas=3" |
| 125 | //ONOS custom image handling |
| 126 | if ( onosImg.trim() != '' ) { |
| 127 | String[] split; |
| 128 | onosImg = onosImg.trim() |
| 129 | split = onosImg.split(':') |
| 130 | extraHelmFlags += " --set onos-classic.image.repository=" + split[0] +",onos-classic.image.tag=" + split[1] + " " |
| 131 | } |
| 132 | Integer olts = 1 |
| 133 | if ("${name}" == 'onu-image-dwl-simultaneously') { |
| 134 | olts = 2 |
| 135 | } |
| 136 | if ("${name}" == 'voltha-component-upgrade' || "${name}" == 'voltha-component-rolling-upgrade') { |
| 137 | // fetch voltha components versions/tags |
| 138 | (openolt_adapter_deploy_tag, openolt_adapter_test_tag) = get_voltha_comp_versions('voltha-openolt-adapter', openoltAdapterDeployBaseTag.trim()) |
| 139 | extraHelmFlags += " --set voltha-adapter-openolt.images.adapter_open_olt.tag=${openolt_adapter_deploy_tag} " |
| 140 | (openonu_adapter_deploy_tag, openonu_adapter_test_tag) = get_voltha_comp_versions('voltha-openonu-adapter-go', openonuAdapterDeployBaseTag.trim()) |
| 141 | extraHelmFlags += " --set voltha-adapter-openonu.images.adapter_open_onu_go.tag=${openonu_adapter_deploy_tag} " |
| 142 | (rw_core_deploy_tag, rw_core_test_tag) = get_voltha_comp_versions('voltha-go', rwCoreDeployBaseTag.trim()) |
| 143 | extraHelmFlags += " --set voltha.images.rw_core.tag=${rw_core_deploy_tag} " |
| 144 | (ofagent_deploy_tag, ofagent_test_tag) = get_voltha_comp_versions('ofagent-go', ofagentDeployBaseTag.trim()) |
| 145 | extraHelmFlags += " --set voltha.images.ofagent.tag=${ofagent_deploy_tag} " |
| 146 | } |
| 147 | def localCharts = false |
| 148 | // Currently only testing with ATT workflow |
| 149 | // TODO: Support for other workflows |
| 150 | volthaDeploy([bbsimReplica: olts.toInteger(), workflow: 'att', extraHelmFlags: extraHelmFlags, localCharts: localCharts]) |
| 151 | // stop logging |
| 152 | sh """ |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 153 | P_IDS="\$(ps e -ww -A | grep "_TAG=kail-${name}" | grep -v grep | awk '{print \$1}')" |
| 154 | if [ -n "\$P_IDS" ]; then |
| 155 | echo \$P_IDS |
| 156 | for P_ID in \$P_IDS; do |
| 157 | kill -9 \$P_ID |
| 158 | done |
| 159 | fi |
| 160 | cd ${logsDir} |
| 161 | gzip -k onos-voltha-startup-combined.log |
| 162 | rm onos-voltha-startup-combined.log |
| 163 | """ |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 164 | // forward ONOS and VOLTHA ports |
| 165 | sh(''' |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 166 | JENKINS_NODE_COOKIE="dontKillMe" _TAG=onos-port-forward /bin/bash -c "while true; do kubectl -n infra port-forward --address 0.0.0.0 service/voltha-infra-onos-classic-hs 8101:8101; done 2>&1 " & |
| 167 | JENKINS_NODE_COOKIE="dontKillMe" _TAG=onos-port-forward /bin/bash -c "while true; do kubectl -n infra port-forward --address 0.0.0.0 service/voltha-infra-onos-classic-hs 8181:8181; done 2>&1 " & |
| 168 | JENKINS_NODE_COOKIE="dontKillMe" _TAG=port-forward-voltha-api /bin/bash -c "while true; do kubectl -n voltha port-forward --address 0.0.0.0 service/voltha-voltha-api 55555:55555; done 2>&1 " & |
Joey Armstrong | deb7529 | 2023-08-24 17:06:33 -0400 | [diff] [blame] | 169 | ''') |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 170 | sh(''' |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 171 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set DEBUG org.opencord |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 172 | ''') |
| 173 | } |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 174 | } |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 175 | |
| 176 | stage('Test - ' + name) { |
| 177 | timeout(75) { |
| 178 | sh """ |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 179 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/${name}" |
| 180 | mkdir -p \$ROBOT_LOGS_DIR |
| 181 | if [[ ${name} == 'onos-app-upgrade' ]]; then |
| 182 | export ONOS_APPS_UNDER_TEST+='' |
| 183 | if [ ${aaaVer.trim()} != '' ] && [ ${aaaOarUrl.trim()} != '' ]; then |
| 184 | ONOS_APPS_UNDER_TEST+="org.opencord.aaa,${aaaVer.trim()},${aaaOarUrl.trim()}*" |
| 185 | fi |
| 186 | if [ ${oltVer.trim()} != '' ] && [ ${oltOarUrl.trim()} != '' ]; then |
| 187 | ONOS_APPS_UNDER_TEST+="org.opencord.olt,${oltVer.trim()},${oltOarUrl.trim()}*" |
| 188 | fi |
| 189 | if [ ${dhcpl2relayVer.trim()} != '' ] && [ ${dhcpl2relayOarUrl.trim()} != '' ]; then |
| 190 | ONOS_APPS_UNDER_TEST+="org.opencord.dhcpl2relay,${dhcpl2relayVer.trim()},${dhcpl2relayOarUrl.trim()}*" |
| 191 | fi |
| 192 | if [ ${igmpproxyVer.trim()} != '' ] && [ ${igmpproxyOarUrl.trim()} != '' ]; then |
| 193 | ONOS_APPS_UNDER_TEST+="org.opencord.igmpproxy,${igmpproxyVer.trim()},${igmpproxyOarUrl.trim()}*" |
| 194 | fi |
| 195 | if [ ${sadisVer.trim()} != '' ] && [ ${sadisOarUrl.trim()} != '' ]; then |
| 196 | ONOS_APPS_UNDER_TEST+="org.opencord.sadis,${sadisVer.trim()},${sadisOarUrl.trim()}*" |
| 197 | fi |
| 198 | if [ ${mcastVer.trim()} != '' ] && [ ${mcastOarUrl.trim()} != '' ]; then |
| 199 | ONOS_APPS_UNDER_TEST+="org.opencord.mcast,${mcastVer.trim()},${mcastOarUrl.trim()}*" |
| 200 | fi |
| 201 | if [ ${kafkaVer.trim()} != '' ] && [ ${kafkaOarUrl.trim()} != '' ]; then |
| 202 | ONOS_APPS_UNDER_TEST+="org.opencord.kafka,${kafkaVer.trim()},${kafkaOarUrl.trim()}*" |
| 203 | fi |
| 204 | export ROBOT_MISC_ARGS="-d \$ROBOT_LOGS_DIR -v onos_apps_under_test:\$ONOS_APPS_UNDER_TEST -e PowerSwitch" |
| 205 | export TARGET=onos-app-upgrade-test |
| 206 | fi |
| 207 | if [ ${name} == 'voltha-component-upgrade' ] || [ ${name} == 'voltha-component-rolling-upgrade' ]; then |
| 208 | export VOLTHA_COMPS_UNDER_TEST+='' |
| 209 | VOLTHA_COMPS_UNDER_TEST+="adapter-open-olt,adapter-open-olt,voltha/voltha-openolt-adapter:${openolt_adapter_test_tag}*" |
| 210 | VOLTHA_COMPS_UNDER_TEST+="adapter-open-onu,adapter-open-onu,voltha/voltha-openonu-adapter-go:${openonu_adapter_test_tag}*" |
| 211 | VOLTHA_COMPS_UNDER_TEST+="rw-core,voltha,voltha/voltha-rw-core:${rw_core_test_tag}*" |
| 212 | VOLTHA_COMPS_UNDER_TEST+="ofagent,ofagent,voltha/voltha-ofagent-go:${ofagent_test_tag}*" |
| 213 | export ROBOT_MISC_ARGS="-d \$ROBOT_LOGS_DIR -v voltha_comps_under_test:\$VOLTHA_COMPS_UNDER_TEST -e PowerSwitch" |
| 214 | fi |
| 215 | if [[ ${name} == 'voltha-component-upgrade' ]]; then |
| 216 | export TARGET=voltha-comp-upgrade-test |
| 217 | fi |
| 218 | if [[ ${name} == 'voltha-component-rolling-upgrade' ]]; then |
| 219 | export TARGET=voltha-comp-rolling-upgrade-test |
| 220 | fi |
| 221 | if [ ${name} == 'onu-software-upgrade' ] || [ ${name} == 'onu-software-upgrade-omci-extended-msg' ]; then |
| 222 | export ROBOT_MISC_ARGS="-d \$ROBOT_LOGS_DIR -v image_version:${onuImageVersion.trim()} -v image_url:${onuImageUrl.trim()} -v image_vendor:${onuImageVendor.trim()} -v image_activate_on_success:${onuImageActivateOnSuccess.trim()} -v image_commit_on_success:${onuImageCommitOnSuccess.trim()} -v image_crc:${onuImageCrc.trim()} -e PowerSwitch" |
| 223 | export TARGET=onu-upgrade-test |
| 224 | fi |
| 225 | if [[ ${name} == 'onu-image-dwl-simultaneously' ]]; then |
| 226 | export ROBOT_MISC_ARGS="-d \$ROBOT_LOGS_DIR -v image_version:${onuImageVersion.trim()} -v image_url:${onuImageUrl.trim()} -v image_vendor:${onuImageVendor.trim()} -v image_activate_on_success:${onuImageActivateOnSuccess.trim()} -v image_commit_on_success:${onuImageCommitOnSuccess.trim()} -v image_crc:${onuImageCrc.trim()} -e PowerSwitch" |
| 227 | export TARGET=onu-upgrade-test-multiolt-kind-att |
| 228 | fi |
| 229 | testLogging='False' |
| 230 | if [ ${logging} = true ]; then |
| 231 | testLogging='True' |
| 232 | fi |
| 233 | export VOLTCONFIG=$HOME/.volt/config-minimal |
| 234 | export KUBECONFIG=$HOME/.kube/kind-config-voltha-minimal |
| 235 | 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" |
| 236 | # Run the specified tests |
| 237 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
| 238 | """ |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 239 | // remove port-forwarding |
| 240 | sh """ |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 241 | # remove orphaned port-forward from different namespaces |
| 242 | ps aux | grep port-forw | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 || true |
| 243 | """ |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 244 | // collect pod details |
| 245 | get_pods_info("$WORKSPACE/${name}") |
| 246 | sh """ |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 247 | set +e |
| 248 | # collect logs collected in the Robot Framework StartLogging keyword |
| 249 | cd ${logsDir} |
| 250 | gzip *-combined.log || true |
| 251 | rm *-combined.log || true |
| 252 | """ |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 253 | helmTeardown(['infra', 'voltha']) |
| 254 | } |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 255 | } |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 256 | } |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 257 | |
| 258 | // ----------------------------------------------------------------------- |
| 259 | // ----------------------------------------------------------------------- |
| 260 | void get_pods_info(dest) { |
| 261 | // collect pod details, this is here in case of failure |
| 262 | sh """ |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 263 | mkdir -p ${dest} || true |
| 264 | kubectl get pods --all-namespaces -o wide > ${dest}/pods.txt || true |
| 265 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee ${dest}/pod-images.txt || true |
| 266 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee ${dest}/pod-imagesId.txt || true |
| 267 | kubectl describe pods --all-namespaces -l app.kubernetes.io/part-of=voltha > ${dest}/voltha-pods-describe.txt |
| 268 | kubectl describe pods -n infra -l app=onos-classic > ${dest}/onos-pods-describe.txt |
| 269 | helm ls --all-namespaces > ${dest}/helm-charts.txt |
| 270 | """ |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 271 | sh ''' |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 272 | # copy the ONOS logs directly from the container to avoid the color codes |
| 273 | printf '%s\\n' $(kubectl get pods -n infra -l app=onos-classic -o=jsonpath="{.items[*]['metadata.name']}") | xargs --no-run-if-empty -I# bash -c 'kubectl -n infra cp #:apache-karaf-4.2.14/data/log/karaf.log ''' + dest + '''/#.log' || true |
| 274 | ''' |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 275 | return |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 276 | } |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 277 | |
| 278 | // ----------------------------------------------------------------------- |
| 279 | // ----------------------------------------------------------------------- |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 280 | pipeline { |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 281 | /* no label, executor is determined by JJB */ |
| 282 | agent { |
| 283 | label "${params.buildNode}" |
Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 284 | } |
Joey Armstrong | deb7529 | 2023-08-24 17:06:33 -0400 | [diff] [blame] | 285 | |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 286 | options { |
| 287 | timeout(time: 220, unit: 'MINUTES') |
| 288 | } |
| 289 | |
| 290 | environment { |
| 291 | PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" |
| 292 | KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal" |
| 293 | SSHPASS="karaf" |
| 294 | } |
| 295 | |
| 296 | stages { |
| 297 | stage('Download Code') { |
| 298 | steps { |
| 299 | getVolthaCode([ |
| 300 | branch: "${branch}", |
| 301 | volthaSystemTestsChange: "${volthaSystemTestsChange}", |
| 302 | volthaHelmChartsChange: "${volthaHelmChartsChange}", |
| 303 | ]) |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | // ----------------------------------------------------------------------- |
| 308 | // ----------------------------------------------------------------------- |
| 309 | stage('Install Tools') |
Joey Armstrong | dd0cd6b | 2023-08-25 17:27:56 -0400 | [diff] [blame] | 310 | { |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 311 | steps |
Joey Armstrong | dd0cd6b | 2023-08-25 17:27:56 -0400 | [diff] [blame] | 312 | { |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 313 | script |
| 314 | { |
| 315 | String iam = getIam('Install Kind') |
| 316 | println("${iam}: ENTER") |
| 317 | installKind("$branch") // needed early by stage(Cleanup) |
| 318 | println("${iam}: LEAVE") |
| 319 | } // script |
| 320 | } // steps |
| 321 | } // stage |
| 322 | |
| 323 | // ----------------------------------------------------------------------- |
| 324 | // ----------------------------------------------------------------------- |
| 325 | stage('Cleanup') { |
| 326 | steps { |
| 327 | // remove port-forwarding |
| 328 | sh(label : 'Remove port forwarding', |
| 329 | script : """ |
| 330 | if [[ \$(pgrep --count 'port-forw') -gt 0 ]]; then |
| 331 | pkill --uid "\$(id -u)" --echo --full 'port-forw' |
| 332 | fi |
| 333 | """) |
| 334 | helmTeardown(['infra', 'voltha']) |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | // ----------------------------------------------------------------------- |
| 339 | // ----------------------------------------------------------------------- |
| 340 | stage('Create K8s Cluster') { |
| 341 | steps { |
| 342 | createKubernetesCluster([nodes: 3]) |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | // ----------------------------------------------------------------------- |
| 347 | // ----------------------------------------------------------------------- |
| 348 | stage('Run Test') { |
| 349 | steps { |
| 350 | test_software_upgrade('onos-app-upgrade') |
| 351 | test_software_upgrade('voltha-component-upgrade') |
| 352 | test_software_upgrade('voltha-component-rolling-upgrade') |
| 353 | test_software_upgrade('onu-software-upgrade') |
| 354 | test_software_upgrade('onu-software-upgrade-omci-extended-msg') |
| 355 | test_software_upgrade('onu-image-dwl-simultaneously') |
| 356 | } |
| 357 | } |
| 358 | } |
Joey Armstrong | deb7529 | 2023-08-24 17:06:33 -0400 | [diff] [blame] | 359 | |
| 360 | // ----------------------------------------------------------------------- |
| 361 | // ----------------------------------------------------------------------- |
Joey Armstrong | c63186b | 2023-08-30 12:39:40 -0400 | [diff] [blame] | 362 | post { |
| 363 | aborted { |
| 364 | get_pods_info("$WORKSPACE/failed") |
| 365 | } |
| 366 | failure { |
| 367 | get_pods_info("$WORKSPACE/failed") |
| 368 | } |
| 369 | always { |
| 370 | step([$class: 'RobotPublisher', |
| 371 | disableArchiveOutput: false, |
| 372 | logFileName: 'RobotLogs/*/log*.html', |
| 373 | otherFiles: '', |
| 374 | outputFileName: 'RobotLogs/*/output*.xml', |
| 375 | outputPath: '.', |
| 376 | passThreshold: 100, |
| 377 | reportFileName: 'RobotLogs/*/report*.html', |
| 378 | unstableThreshold: 0, |
| 379 | onlyCritical: true]) |
| 380 | archiveArtifacts artifacts: '*.log,**/*.log,**/*.gz,*.gz,*.txt,**/*.txt' |
| 381 | } // always |
| 382 | } // post |
| 383 | } // pipeline |