Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 1 | // Copyright 2017-present Open Networking Foundation |
| 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 |
| 16 | // uses kind-voltha to deploy voltha-2.X |
| 17 | // uses bbsim to simulate OLT/ONUs |
| 18 | |
| 19 | pipeline { |
| 20 | |
| 21 | /* no label, executor is determined by JJB */ |
| 22 | agent { |
Zack Williams | b329208 | 2019-10-11 17:15:18 -0700 | [diff] [blame] | 23 | label "${params.buildNode}" |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 24 | } |
| 25 | options { |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 26 | timeout(time: 90, unit: 'MINUTES') |
| 27 | } |
| 28 | environment { |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 29 | PATH="$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 30 | VOLTHA_LOG_LEVEL="DEBUG" |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 31 | FANCY=0 |
| 32 | WITH_SIM_ADAPTERS="n" |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 33 | NAME="test" |
| 34 | VOLTCONFIG="$HOME/.volt/config-$NAME" |
| 35 | KUBECONFIG="$HOME/.kube/kind-config-voltha-$NAME" |
Matteo Scandolo | 697b8b8 | 2021-01-27 13:07:59 -0800 | [diff] [blame] | 36 | EXTRA_HELM_FLAGS=" --set global.image_registry=mirror.registry.opennetworking.org/ --set defaults.image_registry=mirror.registry.opennetworking.org/ " |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | stages { |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 40 | stage('Clone kind-voltha') { |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 41 | steps { |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 42 | checkout([ |
| 43 | $class: 'GitSCM', |
| 44 | userRemoteConfigs: [[ |
| 45 | url: "https://gerrit.opencord.org/kind-voltha", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 46 | refspec: "${kindVolthaChange}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 47 | ]], |
| 48 | branches: [[ name: "master", ]], |
| 49 | extensions: [ |
| 50 | [$class: 'WipeWorkspace'], |
| 51 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
| 52 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 53 | ], |
| 54 | ]) |
Matteo Scandolo | 57a0663 | 2020-09-18 18:38:54 -0700 | [diff] [blame] | 55 | sh """ |
| 56 | if [ '${kindVolthaChange}' != '' ] ; then |
| 57 | cd $WORKSPACE/kind-voltha |
| 58 | git fetch https://gerrit.opencord.org/kind-voltha ${kindVolthaChange} && git checkout FETCH_HEAD |
| 59 | fi |
| 60 | """ |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 61 | } |
| 62 | } |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 63 | stage('Clone voltha-system-tests') { |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 64 | steps { |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 65 | checkout([ |
| 66 | $class: 'GitSCM', |
| 67 | userRemoteConfigs: [[ |
| 68 | url: "https://gerrit.opencord.org/voltha-system-tests", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 69 | refspec: "${volthaSystemTestsChange}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 70 | ]], |
| 71 | branches: [[ name: "${branch}", ]], |
| 72 | extensions: [ |
| 73 | [$class: 'WipeWorkspace'], |
| 74 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"], |
| 75 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 76 | ], |
| 77 | ]) |
Matteo Scandolo | 57a0663 | 2020-09-18 18:38:54 -0700 | [diff] [blame] | 78 | sh """ |
| 79 | if [ '${volthaSystemTestsChange}' != '' ] ; then |
| 80 | cd $WORKSPACE/voltha-system-tests |
| 81 | git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD |
| 82 | fi |
| 83 | """ |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 84 | } |
| 85 | } |
Matteo Scandolo | 8fc674c | 2020-09-14 18:05:37 -0700 | [diff] [blame] | 86 | // If the repo under test is not kind-voltha |
| 87 | // then download it and checkout the patch |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 88 | stage('Download Patch') { |
Matteo Scandolo | 8fc674c | 2020-09-14 18:05:37 -0700 | [diff] [blame] | 89 | when { |
| 90 | expression { |
| 91 | return "${gerritProject}" != 'kind-voltha'; |
| 92 | } |
| 93 | } |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 94 | steps { |
| 95 | checkout([ |
| 96 | $class: 'GitSCM', |
| 97 | userRemoteConfigs: [[ |
| 98 | url: "https://gerrit.opencord.org/${gerritProject}", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 99 | refspec: "${gerritRefspec}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 100 | ]], |
| 101 | branches: [[ name: "${branch}", ]], |
| 102 | extensions: [ |
| 103 | [$class: 'WipeWorkspace'], |
| 104 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "${gerritProject}"], |
| 105 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 106 | ], |
| 107 | ]) |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 108 | sh """ |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 109 | pushd $WORKSPACE/${gerritProject} |
Matteo Scandolo | 57a0663 | 2020-09-18 18:38:54 -0700 | [diff] [blame] | 110 | git fetch https://gerrit.opencord.org/${gerritProject} ${gerritRefspec} && git checkout FETCH_HEAD |
| 111 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 112 | echo "Currently on commit: \n" |
| 113 | git log -1 --oneline |
| 114 | popd |
| 115 | """ |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 116 | } |
| 117 | } |
Matteo Scandolo | 8fc674c | 2020-09-14 18:05:37 -0700 | [diff] [blame] | 118 | // If the repo under test is kind-voltha we don't need to download it again, |
| 119 | // as we already have it, simply checkout the patch |
| 120 | stage('Checkout kind-voltha patch') { |
| 121 | when { |
| 122 | expression { |
| 123 | return "${gerritProject}" == 'kind-voltha'; |
| 124 | } |
| 125 | } |
| 126 | steps { |
| 127 | sh """ |
| 128 | cd $WORKSPACE/kind-voltha |
| 129 | git fetch https://gerrit.opencord.org/kind-voltha ${gerritRefspec} && git checkout FETCH_HEAD |
| 130 | """ |
| 131 | } |
| 132 | } |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 133 | stage('Create K8s Cluster') { |
| 134 | steps { |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 135 | timeout(time: 10, unit: 'MINUTES') { |
| 136 | sh """ |
| 137 | if [ "${branch}" != "master" ]; then |
| 138 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 139 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 140 | else |
| 141 | echo "on master, using default settings for kind-voltha" |
| 142 | fi |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 143 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 144 | cd $WORKSPACE/kind-voltha/ |
| 145 | JUST_K8S=y ./voltha up |
| 146 | bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/kind-voltha/bin" |
| 147 | """ |
| 148 | } |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 149 | } |
| 150 | } |
| 151 | |
| 152 | stage('Build Images') { |
| 153 | steps { |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 154 | timeout(time: 10, unit: 'MINUTES') { |
| 155 | sh """ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 156 | make-local () { |
Matteo Scandolo | 4adf119 | 2020-12-15 09:44:14 -1000 | [diff] [blame] | 157 | make -C $WORKSPACE/\$1 DOCKER_REGISTRY=mirror.registry.opennetworking.org/ DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest docker-build |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 158 | } |
Andy Bavier | 0ed7706 | 2020-02-18 10:09:19 -0700 | [diff] [blame] | 159 | if [ "${gerritProject}" = "pyvoltha" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 160 | make -C $WORKSPACE/pyvoltha/ dist |
| 161 | export LOCAL_PYVOLTHA=$WORKSPACE/pyvoltha/ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 162 | make-local voltha-openonu-adapter |
| 163 | elif [ "${gerritProject}" = "voltha-lib-go" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 164 | make -C $WORKSPACE/voltha-lib-go/ build |
| 165 | export LOCAL_LIB_GO=$WORKSPACE/voltha-lib-go/ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 166 | make-local voltha-go |
| 167 | make-local voltha-openolt-adapter |
| 168 | elif [ "${gerritProject}" = "voltha-protos" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 169 | make -C $WORKSPACE/voltha-protos/ build |
| 170 | export LOCAL_PROTOS=$WORKSPACE/voltha-protos/ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 171 | make-local voltha-go |
| 172 | make-local voltha-openolt-adapter |
| 173 | make-local voltha-openonu-adapter |
| 174 | make-local ofagent-py |
Andy Bavier | 178c47b | 2020-04-01 13:05:43 -0700 | [diff] [blame] | 175 | elif [ "${gerritProject}" = "voltctl" ]; then |
Andy Bavier | decde3f | 2020-04-01 15:29:43 -0700 | [diff] [blame] | 176 | # Set and handle GOPATH and PATH |
| 177 | export GOPATH=\${GOPATH:-$WORKSPACE/go} |
| 178 | export PATH=\$PATH:/usr/lib/go-1.12/bin:/usr/local/go/bin:\$GOPATH/bin |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 179 | make -C $WORKSPACE/voltctl/ build |
Andy Bavier | 4318f8d | 2020-04-09 13:50:53 -0700 | [diff] [blame] | 180 | elif ! [[ "${gerritProject}" =~ ^(voltha-helm-charts|voltha-system-tests|kind-voltha)\$ ]]; then |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 181 | make-local ${gerritProject} |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 182 | fi |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 183 | """ |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 184 | } |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 185 | } |
| 186 | } |
| 187 | |
| 188 | stage('Push Images') { |
| 189 | steps { |
| 190 | sh ''' |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 191 | if [ "${branch}" != "master" ]; then |
| 192 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 193 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 194 | else |
| 195 | echo "on master, using default settings for kind-voltha" |
| 196 | fi |
| 197 | |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 198 | if ! [[ "${gerritProject}" =~ ^(voltha-helm-charts|voltha-system-tests|voltctl|kind-voltha)\$ ]]; then |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 199 | export GOROOT=/usr/local/go |
| 200 | export GOPATH=\$(pwd) |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 201 | docker images | grep citest |
Matteo Scandolo | 4adf119 | 2020-12-15 09:44:14 -1000 | [diff] [blame] | 202 | for image in \$(docker images -f "reference=*/*/*citest" --format "{{.Repository}}"); do echo "Pushing \$image to nodes"; kind load docker-image \$image:citest --name voltha-\$NAME --nodes voltha-\$NAME-worker,voltha-\$NAME-worker2; done |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 203 | fi |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 204 | ''' |
| 205 | } |
| 206 | } |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 207 | |
| 208 | stage('ATT workflow') { |
| 209 | environment { |
| 210 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ATTWorkflow" |
| 211 | } |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 212 | steps { |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 213 | timeout(time: 15, unit: 'MINUTES') { |
| 214 | sh ''' |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 215 | if [ "${branch}" != "master" ]; then |
| 216 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 217 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 218 | else |
| 219 | echo "on master, using default settings for kind-voltha" |
| 220 | fi |
| 221 | |
Matteo Scandolo | f72f4d1 | 2020-12-14 09:53:28 -1000 | [diff] [blame] | 222 | if [[ "${gerritProject}" == voltha-helm-charts ]]; then |
Andrea Campanella | e8e2e01 | 2021-01-22 10:59:07 +0100 | [diff] [blame] | 223 | export EXTRA_HELM_FLAGS+="--set global.image_tag=null " |
Matteo Scandolo | f72f4d1 | 2020-12-14 09:53:28 -1000 | [diff] [blame] | 224 | fi |
| 225 | |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 226 | # Workflow-specific flags |
| 227 | export WITH_RADIUS=yes |
| 228 | export WITH_BBSIM=yes |
| 229 | export DEPLOY_K8S=yes |
Matteo Scandolo | 3d6a21d | 2020-09-04 07:34:24 -0700 | [diff] [blame] | 230 | export CONFIG_SADIS="external" |
| 231 | export BBSIM_CFG="configs/bbsim-sadis-att.yaml" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 232 | |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 233 | export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} " |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 234 | |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 235 | IMAGES="" |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 236 | if [ "${gerritProject}" = "voltha-go" ]; then |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 237 | IMAGES="rw_core ro_core " |
| 238 | elif [ "${gerritProject}" = "ofagent-py" ]; then |
Andy Bavier | 8d81642 | 2020-03-23 15:34:26 -0700 | [diff] [blame] | 239 | IMAGES="ofagent_py " |
| 240 | EXTRA_HELM_FLAGS+="--set use_ofagent_go=false " |
Andy Bavier | 9c412a8 | 2020-03-23 12:00:28 -0700 | [diff] [blame] | 241 | elif [ "${gerritProject}" = "ofagent-go" ]; then |
Andy Bavier | 8d81642 | 2020-03-23 15:34:26 -0700 | [diff] [blame] | 242 | IMAGES="ofagent_go " |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 243 | elif [ "${gerritProject}" = "voltha-onos" ]; then |
| 244 | IMAGES="onos " |
Andrea Campanella | e39825e | 2020-12-16 21:35:03 +0100 | [diff] [blame] | 245 | EXTRA_HELM_FLAGS+="--set images.onos.repository=mirror.registry.opennetworking.org/voltha/voltha-onos " |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 246 | elif [ "${gerritProject}" = "voltha-openolt-adapter" ]; then |
| 247 | IMAGES="adapter_open_olt " |
| 248 | elif [ "${gerritProject}" = "voltha-openonu-adapter" ]; then |
| 249 | IMAGES="adapter_open_onu " |
| 250 | elif [ "${gerritProject}" = "voltha-api-server" ]; then |
| 251 | IMAGES="afrouter afrouterd " |
| 252 | elif [ "${gerritProject}" = "bbsim" ]; then |
| 253 | IMAGES="bbsim " |
Andy Bavier | ec0c10d | 2020-02-14 13:06:27 -0700 | [diff] [blame] | 254 | elif [ "${gerritProject}" = "pyvoltha" ]; then |
| 255 | IMAGES="adapter_open_onu " |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 256 | elif [ "${gerritProject}" = "voltha-lib-go" ]; then |
| 257 | IMAGES="rw_core ro_core adapter_open_olt " |
| 258 | elif [ "${gerritProject}" = "voltha-protos" ]; then |
| 259 | IMAGES="rw_core ro_core adapter_open_olt adapter_open_onu ofagent " |
Zack Williams | 0499750 | 2019-10-04 14:32:20 -0700 | [diff] [blame] | 260 | else |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 261 | echo "No images to push" |
Scott Baker | 9ac2371 | 2019-10-02 09:26:50 -0700 | [diff] [blame] | 262 | fi |
| 263 | |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 264 | for I in \$IMAGES |
| 265 | do |
| 266 | EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never " |
| 267 | done |
| 268 | |
Kailash Khalasi | af3a2a6 | 2019-10-02 09:44:08 -0700 | [diff] [blame] | 269 | if [ "${gerritProject}" = "voltha-helm-charts" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 270 | export CHART_PATH=$WORKSPACE/voltha-helm-charts |
Andy Bavier | 4540634 | 2019-10-02 16:45:40 -0700 | [diff] [blame] | 271 | export VOLTHA_CHART=\$CHART_PATH/voltha |
| 272 | export VOLTHA_ADAPTER_OPEN_OLT_CHART=\$CHART_PATH/voltha-adapter-openolt |
| 273 | export VOLTHA_ADAPTER_OPEN_ONU_CHART=\$CHART_PATH/voltha-adapter-openonu |
Kailash Khalasi | af3a2a6 | 2019-10-02 09:44:08 -0700 | [diff] [blame] | 274 | helm dep update \$VOLTHA_CHART |
| 275 | helm dep update \$VOLTHA_ADAPTER_OPEN_OLT_CHART |
| 276 | helm dep update \$VOLTHA_ADAPTER_OPEN_ONU_CHART |
| 277 | fi |
| 278 | |
Andy Bavier | 178c47b | 2020-04-01 13:05:43 -0700 | [diff] [blame] | 279 | if [ "${gerritProject}" = "voltctl" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 280 | export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION) |
| 281 | cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl |
| 282 | md5sum $WORKSPACE/kind-voltha/bin/voltctl |
Andy Bavier | 178c47b | 2020-04-01 13:05:43 -0700 | [diff] [blame] | 283 | fi |
| 284 | |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 285 | printenv |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 286 | |
| 287 | # start logging |
| 288 | mkdir -p $WORKSPACE/att |
| 289 | _TAG=kail-att kail -n voltha -n default > $WORKSPACE/att/onos-voltha-combined.log & |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 290 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 291 | cd $WORKSPACE/kind-voltha/ |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 292 | ./voltha up |
| 293 | |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 294 | # $NAME-env.sh contains the environment we used |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 295 | # Save value of EXTRA_HELM_FLAGS there to use in subsequent stages |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 296 | echo export EXTRA_HELM_FLAGS=\\"\$EXTRA_HELM_FLAGS\\" >> $NAME-env.sh |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 297 | |
| 298 | mkdir -p $ROBOT_LOGS_DIR |
Andy Bavier | d987004 | 2020-06-23 13:16:47 -0700 | [diff] [blame] | 299 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
Andy Bavier | db00308 | 2020-02-04 11:57:36 -0700 | [diff] [blame] | 300 | |
| 301 | # By default, all tests tagged 'sanity' are run. This covers basic functionality |
| 302 | # like running through the ATT workflow for a single subscriber. |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 303 | export TARGET=sanity-single-kind |
Andy Bavier | db00308 | 2020-02-04 11:57:36 -0700 | [diff] [blame] | 304 | |
| 305 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 306 | # functional test suite. This covers tests tagged either 'sanity' or 'functional'. |
| 307 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 308 | REGEX="functional tests" |
| 309 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 310 | TARGET=functional-single-kind |
Andy Bavier | db00308 | 2020-02-04 11:57:36 -0700 | [diff] [blame] | 311 | fi |
| 312 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 313 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 314 | |
| 315 | # stop logging |
| 316 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-att" | grep -v grep | awk '{print $1}')" |
| 317 | if [ -n "$P_IDS" ]; then |
| 318 | echo $P_IDS |
| 319 | for P_ID in $P_IDS; do |
| 320 | kill -9 $P_ID |
| 321 | done |
| 322 | fi |
| 323 | |
| 324 | # get pods information |
| 325 | kubectl get pods -o wide > $WORKSPACE/att/pods.txt || true |
| 326 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/att/pod-images.txt || true |
| 327 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $WORKSPACE/att/pod-imagesId.txt || true |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 328 | ''' |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 329 | } |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 330 | } |
| 331 | } |
| 332 | |
| 333 | stage('DT workflow') { |
| 334 | environment { |
| 335 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/DTWorkflow" |
| 336 | } |
| 337 | steps { |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 338 | timeout(time: 15, unit: 'MINUTES') { |
| 339 | sh ''' |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 340 | cd $WORKSPACE/kind-voltha/ |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 341 | source $NAME-env.sh |
Andrea Campanella | 57735a8 | 2021-05-18 13:22:49 +0200 | [diff] [blame] | 342 | if [ "${branch}" != "master" ]; then |
| 343 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 344 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 345 | else |
| 346 | echo "on master, using default settings for kind-voltha" |
| 347 | fi |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 348 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
| 349 | |
| 350 | # Workflow-specific flags |
| 351 | export WITH_RADIUS=no |
| 352 | export WITH_EAPOL=no |
| 353 | export WITH_DHCP=no |
| 354 | export WITH_IGMP=no |
Matteo Scandolo | 3d6a21d | 2020-09-04 07:34:24 -0700 | [diff] [blame] | 355 | export CONFIG_SADIS="external" |
| 356 | export BBSIM_CFG="configs/bbsim-sadis-dt.yaml" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 357 | |
Matteo Scandolo | f72f4d1 | 2020-12-14 09:53:28 -1000 | [diff] [blame] | 358 | if [[ "${gerritProject}" == voltha-helm-charts ]]; then |
Andrea Campanella | e8e2e01 | 2021-01-22 10:59:07 +0100 | [diff] [blame] | 359 | export EXTRA_HELM_FLAGS+="--set global.image_tag=null " |
Matteo Scandolo | f72f4d1 | 2020-12-14 09:53:28 -1000 | [diff] [blame] | 360 | fi |
| 361 | |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 362 | # start logging |
| 363 | mkdir -p $WORKSPACE/dt |
| 364 | _TAG=kail-dt kail -n voltha -n default > $WORKSPACE/dt/onos-voltha-combined.log & |
| 365 | |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 366 | DEPLOY_K8S=n ./voltha up |
| 367 | |
| 368 | mkdir -p $ROBOT_LOGS_DIR |
Andy Bavier | d987004 | 2020-06-23 13:16:47 -0700 | [diff] [blame] | 369 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 370 | |
| 371 | # By default, all tests tagged 'sanityDt' are run. This covers basic functionality |
| 372 | # like running through the DT workflow for a single subscriber. |
| 373 | export TARGET=sanity-kind-dt |
| 374 | |
| 375 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 376 | # functional test suite. This covers tests tagged either 'sanityDt' or 'functionalDt'. |
| 377 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 378 | REGEX="functional tests" |
| 379 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 380 | TARGET=functional-single-kind-dt |
| 381 | fi |
| 382 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 383 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 384 | |
| 385 | # stop logging |
| 386 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-dt" | grep -v grep | awk '{print $1}')" |
| 387 | if [ -n "$P_IDS" ]; then |
| 388 | echo $P_IDS |
| 389 | for P_ID in $P_IDS; do |
| 390 | kill -9 $P_ID |
| 391 | done |
| 392 | fi |
| 393 | |
| 394 | # get pods information |
| 395 | kubectl get pods -o wide > $WORKSPACE/dt/pods.txt || true |
| 396 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/dt/pod-images.txt || true |
| 397 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $WORKSPACE/dt/pod-imagesId.txt || true |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 398 | ''' |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 399 | } |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 400 | } |
| 401 | } |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 402 | |
| 403 | stage('TT workflow') { |
| 404 | environment { |
| 405 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/TTWorkflow" |
| 406 | } |
| 407 | steps { |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 408 | timeout(time: 15, unit: 'MINUTES') { |
| 409 | sh ''' |
| 410 | cd $WORKSPACE/kind-voltha/ |
| 411 | source $NAME-env.sh |
| 412 | if [ "${branch}" != "master" ]; then |
| 413 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 414 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 415 | else |
| 416 | echo "on master, using default settings for kind-voltha" |
| 417 | fi |
| 418 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 419 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 420 | # Workflow-specific flags |
| 421 | export WITH_RADIUS=no |
| 422 | export WITH_EAPOL=no |
| 423 | export WITH_DHCP=yes |
| 424 | export WITH_IGMP=yes |
| 425 | export CONFIG_SADIS="external" |
| 426 | export BBSIM_CFG="configs/bbsim-sadis-tt.yaml" |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 427 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 428 | if [[ "${gerritProject}" == voltha-helm-charts ]]; then |
| 429 | export EXTRA_HELM_FLAGS+="--set global.image_tag=null " |
| 430 | fi |
Matteo Scandolo | f72f4d1 | 2020-12-14 09:53:28 -1000 | [diff] [blame] | 431 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 432 | # start logging |
| 433 | mkdir -p $WORKSPACE/tt |
| 434 | _TAG=kail-tt kail -n voltha -n default > $WORKSPACE/tt/onos-voltha-combined.log & |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 435 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 436 | DEPLOY_K8S=n ./voltha up |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 437 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 438 | mkdir -p $ROBOT_LOGS_DIR |
| 439 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 440 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 441 | # By default, all tests tagged 'sanityTt' are run. This covers basic functionality |
| 442 | # like running through the TT workflow for a single subscriber. |
| 443 | export TARGET=sanity-kind-tt |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 444 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 445 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 446 | # functional test suite. This covers tests tagged either 'sanityTt' or 'functionalTt'. |
| 447 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 448 | REGEX="functional tests" |
| 449 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 450 | TARGET=functional-single-kind-tt |
| 451 | fi |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 452 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 453 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 454 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 455 | # stop logging |
| 456 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-att" | grep -v grep | awk '{print $1}')" |
| 457 | if [ -n "$P_IDS" ]; then |
| 458 | echo $P_IDS |
| 459 | for P_ID in $P_IDS; do |
| 460 | kill -9 $P_ID |
| 461 | done |
| 462 | fi |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 463 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 464 | # get pods information |
| 465 | kubectl get pods -o wide > $WORKSPACE/tt/pods.txt || true |
| 466 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/tt/pod-images.txt || true |
| 467 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $WORKSPACE/tt/pod-imagesId.txt || true |
| 468 | ''' |
| 469 | } |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 470 | } |
| 471 | } |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 472 | } |
| 473 | |
| 474 | post { |
| 475 | always { |
| 476 | sh ''' |
Matteo Scandolo | 7eba41c | 2020-12-15 08:59:36 -1000 | [diff] [blame] | 477 | |
| 478 | # get pods information |
Matteo Scandolo | 52a4cd9 | 2021-01-25 10:17:44 -0800 | [diff] [blame] | 479 | kubectl get pods -o wide --all-namespaces |
Matteo Scandolo | 7eba41c | 2020-12-15 08:59:36 -1000 | [diff] [blame] | 480 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" |
Matteo Scandolo | 52a4cd9 | 2021-01-25 10:17:44 -0800 | [diff] [blame] | 481 | helm ls --all-namespaces |
Matteo Scandolo | 7eba41c | 2020-12-15 08:59:36 -1000 | [diff] [blame] | 482 | |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 483 | set +e |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 484 | cp $WORKSPACE/kind-voltha/install-$NAME.log $WORKSPACE/ |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 485 | |
| 486 | sync |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 487 | md5sum $WORKSPACE/kind-voltha/bin/voltctl |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 488 | |
| 489 | ## Pull out errors from log files |
| 490 | extract_errors_go() { |
| 491 | echo |
| 492 | echo "Error summary for $1:" |
| 493 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg' |
| 494 | echo |
| 495 | } |
| 496 | |
| 497 | extract_errors_python() { |
| 498 | echo |
| 499 | echo "Error summary for $1:" |
| 500 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2- |
| 501 | echo |
| 502 | } |
| 503 | |
Matteo Scandolo | 7eba41c | 2020-12-15 08:59:36 -1000 | [diff] [blame] | 504 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log || true |
| 505 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log || true |
| 506 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log || true |
| 507 | extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log || true |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 508 | |
Matteo Scandolo | 7eba41c | 2020-12-15 08:59:36 -1000 | [diff] [blame] | 509 | gzip $WORKSPACE/att/onos-voltha-combined.log || true |
| 510 | gzip $WORKSPACE/dt/onos-voltha-combined.log || true |
| 511 | gzip $WORKSPACE/tt/onos-voltha-combined.log || true |
| 512 | |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 513 | ''' |
| 514 | step([$class: 'RobotPublisher', |
| 515 | disableArchiveOutput: false, |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 516 | logFileName: 'RobotLogs/*/log*.html', |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 517 | otherFiles: '', |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 518 | outputFileName: 'RobotLogs/*/output*.xml', |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 519 | outputPath: '.', |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 520 | passThreshold: 100, |
| 521 | reportFileName: 'RobotLogs/*/report*.html', |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 522 | unstableThreshold: 0]); |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 523 | archiveArtifacts artifacts: '*.log,**/*.log,**/*.gz,*.gz' |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 524 | } |
| 525 | } |
| 526 | } |