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 | 7eba41c | 2020-12-15 08:59:36 -1000 | [diff] [blame] | 36 | EXTRA_HELM_FLAGS=" --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 { |
| 135 | sh """ |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 136 | if [ "${branch}" != "master" ]; then |
| 137 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 138 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 139 | else |
| 140 | echo "on master, using default settings for kind-voltha" |
| 141 | fi |
| 142 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 143 | cd $WORKSPACE/kind-voltha/ |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 144 | JUST_K8S=y ./voltha up |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 145 | bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/kind-voltha/bin" |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 146 | """ |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | stage('Build Images') { |
| 151 | steps { |
| 152 | sh """ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 153 | make-local () { |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 154 | make -C $WORKSPACE/\$1 DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest docker-build |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 155 | } |
Andy Bavier | 0ed7706 | 2020-02-18 10:09:19 -0700 | [diff] [blame] | 156 | if [ "${gerritProject}" = "pyvoltha" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 157 | make -C $WORKSPACE/pyvoltha/ dist |
| 158 | export LOCAL_PYVOLTHA=$WORKSPACE/pyvoltha/ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 159 | make-local voltha-openonu-adapter |
| 160 | elif [ "${gerritProject}" = "voltha-lib-go" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 161 | make -C $WORKSPACE/voltha-lib-go/ build |
| 162 | export LOCAL_LIB_GO=$WORKSPACE/voltha-lib-go/ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 163 | make-local voltha-go |
| 164 | make-local voltha-openolt-adapter |
| 165 | elif [ "${gerritProject}" = "voltha-protos" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 166 | make -C $WORKSPACE/voltha-protos/ build |
| 167 | export LOCAL_PROTOS=$WORKSPACE/voltha-protos/ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 168 | make-local voltha-go |
| 169 | make-local voltha-openolt-adapter |
| 170 | make-local voltha-openonu-adapter |
| 171 | make-local ofagent-py |
Andy Bavier | 178c47b | 2020-04-01 13:05:43 -0700 | [diff] [blame] | 172 | elif [ "${gerritProject}" = "voltctl" ]; then |
Andy Bavier | decde3f | 2020-04-01 15:29:43 -0700 | [diff] [blame] | 173 | # Set and handle GOPATH and PATH |
| 174 | export GOPATH=\${GOPATH:-$WORKSPACE/go} |
| 175 | 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] | 176 | make -C $WORKSPACE/voltctl/ build |
Andy Bavier | 4318f8d | 2020-04-09 13:50:53 -0700 | [diff] [blame] | 177 | elif ! [[ "${gerritProject}" =~ ^(voltha-helm-charts|voltha-system-tests|kind-voltha)\$ ]]; then |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 178 | make-local ${gerritProject} |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 179 | fi |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 180 | """ |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | stage('Push Images') { |
| 185 | steps { |
| 186 | sh ''' |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 187 | if [ "${branch}" != "master" ]; then |
| 188 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 189 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 190 | else |
| 191 | echo "on master, using default settings for kind-voltha" |
| 192 | fi |
| 193 | |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 194 | if ! [[ "${gerritProject}" =~ ^(voltha-helm-charts|voltha-system-tests|voltctl|kind-voltha)\$ ]]; then |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 195 | export GOROOT=/usr/local/go |
| 196 | export GOPATH=\$(pwd) |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 197 | docker images | grep citest |
Matteo Scandolo | 2e64c10 | 2020-07-29 19:41:02 -0700 | [diff] [blame] | 198 | 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] | 199 | fi |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 200 | ''' |
| 201 | } |
| 202 | } |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 203 | |
| 204 | stage('ATT workflow') { |
| 205 | environment { |
| 206 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ATTWorkflow" |
| 207 | } |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 208 | steps { |
Kailash Khalasi | af3a2a6 | 2019-10-02 09:44:08 -0700 | [diff] [blame] | 209 | sh ''' |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 210 | if [ "${branch}" != "master" ]; then |
| 211 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 212 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 213 | else |
| 214 | echo "on master, using default settings for kind-voltha" |
| 215 | fi |
| 216 | |
Matteo Scandolo | f72f4d1 | 2020-12-14 09:53:28 -1000 | [diff] [blame] | 217 | if [[ "${gerritProject}" == voltha-helm-charts ]]; then |
| 218 | export EXTRA_HELM_FLAGS+="--set defaults.image_tag=null " |
| 219 | fi |
| 220 | |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 221 | # Workflow-specific flags |
| 222 | export WITH_RADIUS=yes |
| 223 | export WITH_BBSIM=yes |
| 224 | export DEPLOY_K8S=yes |
Matteo Scandolo | 3d6a21d | 2020-09-04 07:34:24 -0700 | [diff] [blame] | 225 | export CONFIG_SADIS="external" |
| 226 | export BBSIM_CFG="configs/bbsim-sadis-att.yaml" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 227 | |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 228 | export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} " |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 229 | |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 230 | IMAGES="" |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 231 | if [ "${gerritProject}" = "voltha-go" ]; then |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 232 | IMAGES="rw_core ro_core " |
| 233 | elif [ "${gerritProject}" = "ofagent-py" ]; then |
Andy Bavier | 8d81642 | 2020-03-23 15:34:26 -0700 | [diff] [blame] | 234 | IMAGES="ofagent_py " |
| 235 | EXTRA_HELM_FLAGS+="--set use_ofagent_go=false " |
Andy Bavier | 9c412a8 | 2020-03-23 12:00:28 -0700 | [diff] [blame] | 236 | elif [ "${gerritProject}" = "ofagent-go" ]; then |
Andy Bavier | 8d81642 | 2020-03-23 15:34:26 -0700 | [diff] [blame] | 237 | IMAGES="ofagent_go " |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 238 | elif [ "${gerritProject}" = "voltha-onos" ]; then |
| 239 | IMAGES="onos " |
| 240 | elif [ "${gerritProject}" = "voltha-openolt-adapter" ]; then |
| 241 | IMAGES="adapter_open_olt " |
| 242 | elif [ "${gerritProject}" = "voltha-openonu-adapter" ]; then |
| 243 | IMAGES="adapter_open_onu " |
| 244 | elif [ "${gerritProject}" = "voltha-api-server" ]; then |
| 245 | IMAGES="afrouter afrouterd " |
| 246 | elif [ "${gerritProject}" = "bbsim" ]; then |
| 247 | IMAGES="bbsim " |
Andy Bavier | ec0c10d | 2020-02-14 13:06:27 -0700 | [diff] [blame] | 248 | elif [ "${gerritProject}" = "pyvoltha" ]; then |
| 249 | IMAGES="adapter_open_onu " |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 250 | elif [ "${gerritProject}" = "voltha-lib-go" ]; then |
| 251 | IMAGES="rw_core ro_core adapter_open_olt " |
| 252 | elif [ "${gerritProject}" = "voltha-protos" ]; then |
| 253 | IMAGES="rw_core ro_core adapter_open_olt adapter_open_onu ofagent " |
Zack Williams | 0499750 | 2019-10-04 14:32:20 -0700 | [diff] [blame] | 254 | else |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 255 | echo "No images to push" |
Scott Baker | 9ac2371 | 2019-10-02 09:26:50 -0700 | [diff] [blame] | 256 | fi |
| 257 | |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 258 | for I in \$IMAGES |
| 259 | do |
| 260 | EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never " |
| 261 | done |
| 262 | |
Kailash Khalasi | af3a2a6 | 2019-10-02 09:44:08 -0700 | [diff] [blame] | 263 | if [ "${gerritProject}" = "voltha-helm-charts" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 264 | export CHART_PATH=$WORKSPACE/voltha-helm-charts |
Andy Bavier | 4540634 | 2019-10-02 16:45:40 -0700 | [diff] [blame] | 265 | export VOLTHA_CHART=\$CHART_PATH/voltha |
| 266 | export VOLTHA_ADAPTER_OPEN_OLT_CHART=\$CHART_PATH/voltha-adapter-openolt |
| 267 | export VOLTHA_ADAPTER_OPEN_ONU_CHART=\$CHART_PATH/voltha-adapter-openonu |
Kailash Khalasi | af3a2a6 | 2019-10-02 09:44:08 -0700 | [diff] [blame] | 268 | helm dep update \$VOLTHA_CHART |
| 269 | helm dep update \$VOLTHA_ADAPTER_OPEN_OLT_CHART |
| 270 | helm dep update \$VOLTHA_ADAPTER_OPEN_ONU_CHART |
| 271 | fi |
| 272 | |
Andy Bavier | 178c47b | 2020-04-01 13:05:43 -0700 | [diff] [blame] | 273 | if [ "${gerritProject}" = "voltctl" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 274 | export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION) |
| 275 | cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl |
| 276 | md5sum $WORKSPACE/kind-voltha/bin/voltctl |
Andy Bavier | 178c47b | 2020-04-01 13:05:43 -0700 | [diff] [blame] | 277 | fi |
| 278 | |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 279 | printenv |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 280 | |
| 281 | # start logging |
| 282 | mkdir -p $WORKSPACE/att |
| 283 | _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] | 284 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 285 | cd $WORKSPACE/kind-voltha/ |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 286 | ./voltha up |
| 287 | |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 288 | # $NAME-env.sh contains the environment we used |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 289 | # Save value of EXTRA_HELM_FLAGS there to use in subsequent stages |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 290 | echo export EXTRA_HELM_FLAGS=\\"\$EXTRA_HELM_FLAGS\\" >> $NAME-env.sh |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 291 | |
| 292 | mkdir -p $ROBOT_LOGS_DIR |
Andy Bavier | d987004 | 2020-06-23 13:16:47 -0700 | [diff] [blame] | 293 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
Andy Bavier | db00308 | 2020-02-04 11:57:36 -0700 | [diff] [blame] | 294 | |
| 295 | # By default, all tests tagged 'sanity' are run. This covers basic functionality |
| 296 | # like running through the ATT workflow for a single subscriber. |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 297 | export TARGET=sanity-single-kind |
Andy Bavier | db00308 | 2020-02-04 11:57:36 -0700 | [diff] [blame] | 298 | |
| 299 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 300 | # functional test suite. This covers tests tagged either 'sanity' or 'functional'. |
| 301 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 302 | REGEX="functional tests" |
| 303 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 304 | TARGET=functional-single-kind |
Andy Bavier | db00308 | 2020-02-04 11:57:36 -0700 | [diff] [blame] | 305 | fi |
| 306 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 307 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 308 | |
| 309 | # stop logging |
| 310 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-att" | grep -v grep | awk '{print $1}')" |
| 311 | if [ -n "$P_IDS" ]; then |
| 312 | echo $P_IDS |
| 313 | for P_ID in $P_IDS; do |
| 314 | kill -9 $P_ID |
| 315 | done |
| 316 | fi |
| 317 | |
| 318 | # get pods information |
| 319 | kubectl get pods -o wide > $WORKSPACE/att/pods.txt || true |
| 320 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/att/pod-images.txt || true |
| 321 | 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] | 322 | ''' |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | stage('DT workflow') { |
| 327 | environment { |
| 328 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/DTWorkflow" |
| 329 | } |
| 330 | steps { |
| 331 | sh ''' |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 332 | cd $WORKSPACE/kind-voltha/ |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 333 | source $NAME-env.sh |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 334 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
| 335 | |
| 336 | # Workflow-specific flags |
| 337 | export WITH_RADIUS=no |
| 338 | export WITH_EAPOL=no |
| 339 | export WITH_DHCP=no |
| 340 | export WITH_IGMP=no |
Matteo Scandolo | 3d6a21d | 2020-09-04 07:34:24 -0700 | [diff] [blame] | 341 | export CONFIG_SADIS="external" |
| 342 | export BBSIM_CFG="configs/bbsim-sadis-dt.yaml" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 343 | |
Matteo Scandolo | f72f4d1 | 2020-12-14 09:53:28 -1000 | [diff] [blame] | 344 | if [[ "${gerritProject}" == voltha-helm-charts ]]; then |
| 345 | export EXTRA_HELM_FLAGS+="--set defaults.image_tag=null " |
| 346 | fi |
| 347 | |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 348 | # start logging |
| 349 | mkdir -p $WORKSPACE/dt |
| 350 | _TAG=kail-dt kail -n voltha -n default > $WORKSPACE/dt/onos-voltha-combined.log & |
| 351 | |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 352 | DEPLOY_K8S=n ./voltha up |
| 353 | |
| 354 | mkdir -p $ROBOT_LOGS_DIR |
Andy Bavier | d987004 | 2020-06-23 13:16:47 -0700 | [diff] [blame] | 355 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 356 | |
| 357 | # By default, all tests tagged 'sanityDt' are run. This covers basic functionality |
| 358 | # like running through the DT workflow for a single subscriber. |
| 359 | export TARGET=sanity-kind-dt |
| 360 | |
| 361 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 362 | # functional test suite. This covers tests tagged either 'sanityDt' or 'functionalDt'. |
| 363 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 364 | REGEX="functional tests" |
| 365 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 366 | TARGET=functional-single-kind-dt |
| 367 | fi |
| 368 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 369 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 370 | |
| 371 | # stop logging |
| 372 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-dt" | grep -v grep | awk '{print $1}')" |
| 373 | if [ -n "$P_IDS" ]; then |
| 374 | echo $P_IDS |
| 375 | for P_ID in $P_IDS; do |
| 376 | kill -9 $P_ID |
| 377 | done |
| 378 | fi |
| 379 | |
| 380 | # get pods information |
| 381 | kubectl get pods -o wide > $WORKSPACE/dt/pods.txt || true |
| 382 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/dt/pod-images.txt || true |
| 383 | 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] | 384 | ''' |
| 385 | } |
| 386 | } |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 387 | |
| 388 | stage('TT workflow') { |
| 389 | environment { |
| 390 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/TTWorkflow" |
| 391 | } |
| 392 | steps { |
| 393 | sh ''' |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 394 | cd $WORKSPACE/kind-voltha/ |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 395 | source $NAME-env.sh |
| 396 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
| 397 | |
| 398 | # Workflow-specific flags |
| 399 | export WITH_RADIUS=no |
| 400 | export WITH_EAPOL=no |
| 401 | export WITH_DHCP=yes |
| 402 | export WITH_IGMP=yes |
| 403 | export CONFIG_SADIS="external" |
| 404 | export BBSIM_CFG="configs/bbsim-sadis-tt.yaml" |
| 405 | |
Matteo Scandolo | f72f4d1 | 2020-12-14 09:53:28 -1000 | [diff] [blame] | 406 | if [[ "${gerritProject}" == voltha-helm-charts ]]; then |
| 407 | export EXTRA_HELM_FLAGS+="--set defaults.image_tag=null " |
| 408 | fi |
| 409 | |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 410 | # start logging |
| 411 | mkdir -p $WORKSPACE/tt |
| 412 | _TAG=kail-tt kail -n voltha -n default > $WORKSPACE/tt/onos-voltha-combined.log & |
| 413 | |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 414 | DEPLOY_K8S=n ./voltha up |
| 415 | |
| 416 | mkdir -p $ROBOT_LOGS_DIR |
| 417 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
| 418 | |
| 419 | # By default, all tests tagged 'sanityTt' are run. This covers basic functionality |
| 420 | # like running through the TT workflow for a single subscriber. |
| 421 | export TARGET=sanity-kind-tt |
| 422 | |
| 423 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 424 | # functional test suite. This covers tests tagged either 'sanityTt' or 'functionalTt'. |
| 425 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 426 | REGEX="functional tests" |
| 427 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 428 | TARGET=functional-single-kind-tt |
| 429 | fi |
| 430 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 431 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 432 | |
| 433 | # stop logging |
| 434 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-att" | grep -v grep | awk '{print $1}')" |
| 435 | if [ -n "$P_IDS" ]; then |
| 436 | echo $P_IDS |
| 437 | for P_ID in $P_IDS; do |
| 438 | kill -9 $P_ID |
| 439 | done |
| 440 | fi |
| 441 | |
| 442 | # get pods information |
| 443 | kubectl get pods -o wide > $WORKSPACE/tt/pods.txt || true |
| 444 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/tt/pod-images.txt || true |
| 445 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $WORKSPACE/tt/pod-imagesId.txt || true |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 446 | ''' |
| 447 | } |
| 448 | } |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 449 | } |
| 450 | |
| 451 | post { |
| 452 | always { |
| 453 | sh ''' |
Matteo Scandolo | 7eba41c | 2020-12-15 08:59:36 -1000 | [diff] [blame] | 454 | |
| 455 | # get pods information |
| 456 | kubectl get pods -o wide |
| 457 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" |
| 458 | helm ls |
| 459 | |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 460 | set +e |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 461 | cp $WORKSPACE/kind-voltha/install-$NAME.log $WORKSPACE/ |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 462 | |
| 463 | sync |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 464 | md5sum $WORKSPACE/kind-voltha/bin/voltctl |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 465 | |
| 466 | ## Pull out errors from log files |
| 467 | extract_errors_go() { |
| 468 | echo |
| 469 | echo "Error summary for $1:" |
| 470 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg' |
| 471 | echo |
| 472 | } |
| 473 | |
| 474 | extract_errors_python() { |
| 475 | echo |
| 476 | echo "Error summary for $1:" |
| 477 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2- |
| 478 | echo |
| 479 | } |
| 480 | |
Matteo Scandolo | 7eba41c | 2020-12-15 08:59:36 -1000 | [diff] [blame] | 481 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log || true |
| 482 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log || true |
| 483 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log || true |
| 484 | extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log || true |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 485 | |
Matteo Scandolo | 7eba41c | 2020-12-15 08:59:36 -1000 | [diff] [blame] | 486 | gzip $WORKSPACE/att/onos-voltha-combined.log || true |
| 487 | gzip $WORKSPACE/dt/onos-voltha-combined.log || true |
| 488 | gzip $WORKSPACE/tt/onos-voltha-combined.log || true |
| 489 | |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 490 | ''' |
| 491 | step([$class: 'RobotPublisher', |
| 492 | disableArchiveOutput: false, |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 493 | logFileName: 'RobotLogs/*/log*.html', |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 494 | otherFiles: '', |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 495 | outputFileName: 'RobotLogs/*/output*.xml', |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 496 | outputPath: '.', |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 497 | passThreshold: 100, |
| 498 | reportFileName: 'RobotLogs/*/report*.html', |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 499 | unstableThreshold: 0]); |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 500 | archiveArtifacts artifacts: '*.log,**/*.log,**/*.gz,*.gz' |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 501 | } |
| 502 | } |
| 503 | } |