Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -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 | node { |
| 16 | // Need this so that deployment_config has global scope when it's read later |
| 17 | deployment_config = null |
| 18 | } |
| 19 | |
| 20 | pipeline { |
| 21 | /* no label, executor is determined by JJB */ |
| 22 | agent { |
| 23 | label "${params.buildNode}" |
| 24 | } |
| 25 | options { |
Suchitra Vemuri | eccd4a2 | 2020-10-07 15:26:39 -0700 | [diff] [blame] | 26 | timeout(time: 340, unit: 'MINUTES') |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | environment { |
| 30 | KUBECONFIG="$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf" |
| 31 | VOLTCONFIG="$HOME/.volt/config-minimal" |
| 32 | PATH="$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
| 33 | } |
| 34 | |
| 35 | stages { |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 36 | stage('Clone kind-voltha') { |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 37 | steps { |
| 38 | step([$class: 'WsCleanup']) |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 39 | checkout([ |
| 40 | $class: 'GitSCM', |
| 41 | userRemoteConfigs: [[ |
| 42 | url: "https://gerrit.opencord.org/kind-voltha", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 43 | refspec: "${kindVolthaChange}" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 44 | ]], |
| 45 | branches: [[ name: "master", ]], |
| 46 | extensions: [ |
| 47 | [$class: 'WipeWorkspace'], |
| 48 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
| 49 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 50 | ], |
| 51 | ]) |
| 52 | } |
| 53 | } |
| 54 | stage('Clone voltha-system-tests') { |
| 55 | steps { |
| 56 | checkout([ |
| 57 | $class: 'GitSCM', |
| 58 | userRemoteConfigs: [[ |
| 59 | url: "https://gerrit.opencord.org/voltha-system-tests", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 60 | refspec: "${volthaSystemTestsChange}" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 61 | ]], |
| 62 | branches: [[ name: "${branch}", ]], |
| 63 | extensions: [ |
| 64 | [$class: 'WipeWorkspace'], |
| 65 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"], |
| 66 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 67 | ], |
| 68 | ]) |
| 69 | } |
| 70 | } |
| 71 | stage('Clone cord-tester') { |
| 72 | steps { |
| 73 | checkout([ |
| 74 | $class: 'GitSCM', |
| 75 | userRemoteConfigs: [[ |
| 76 | url: "https://gerrit.opencord.org/cord-tester", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 77 | refspec: "${cordTesterChange}" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 78 | ]], |
| 79 | branches: [[ name: "master", ]], |
| 80 | extensions: [ |
| 81 | [$class: 'WipeWorkspace'], |
| 82 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "cord-tester"], |
| 83 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 84 | ], |
| 85 | ]) |
| 86 | } |
| 87 | } |
Matteo Scandolo | 92a5cb6 | 2020-09-15 16:02:08 -0700 | [diff] [blame] | 88 | // This checkout allows us to show changes in Jenkins |
| 89 | // we only do this on master as we don't branch all the repos for all the releases |
| 90 | // (we should compute the difference by tracking the container version, not the code) |
| 91 | stage('Download All the VOLTHA repos') { |
| 92 | when { |
| 93 | expression { |
| 94 | return "${branch}" == 'master'; |
| 95 | } |
| 96 | } |
| 97 | steps { |
| 98 | checkout(changelog: true, |
| 99 | poll: false, |
| 100 | scm: [$class: 'RepoScm', |
| 101 | manifestRepositoryUrl: "${params.manifestUrl}", |
| 102 | manifestBranch: "${params.branch}", |
| 103 | currentBranch: true, |
| 104 | destinationDir: 'voltha', |
| 105 | forceSync: true, |
| 106 | resetFirst: true, |
| 107 | quiet: true, |
| 108 | jobs: 4, |
| 109 | showAllChanges: true] |
| 110 | ) |
| 111 | } |
| 112 | } |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 113 | stage ('Initialize') { |
| 114 | steps { |
Suchitra Vemuri | 2a5a5ea | 2020-03-27 22:53:11 -0700 | [diff] [blame] | 115 | sh returnStdout: false, script: "git clone -b master ${cordRepoUrl}/${configBaseDir}" |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 116 | script { |
| 117 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
| 118 | } |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 119 | sh returnStdout: false, script: """ |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 120 | mkdir -p $WORKSPACE/bin |
| 121 | bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/bin" |
| 122 | cd $WORKSPACE |
Suchitra Vemuri | 1342143 | 2020-06-05 17:34:33 -0700 | [diff] [blame] | 123 | if [ "${params.branch}" != "master" ]; then |
| 124 | cd $WORKSPACE/kind-voltha |
| 125 | source releases/${params.branch} |
Suchitra Vemuri | 1342143 | 2020-06-05 17:34:33 -0700 | [diff] [blame] | 126 | else |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 127 | VOLTCTL_VERSION=\$(curl -sSL https://api.github.com/repos/opencord/voltctl/releases/latest | jq -r .tag_name | sed -e 's/^v//g') |
Suchitra Vemuri | 1342143 | 2020-06-05 17:34:33 -0700 | [diff] [blame] | 128 | fi |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 129 | |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 130 | HOSTOS=\$(uname -s | tr "[:upper:]" "[:lower:"]) |
| 131 | HOSTARCH=\$(uname -m | tr "[:upper:]" "[:lower:"]) |
| 132 | if [ \$HOSTARCH == "x86_64" ]; then |
| 133 | HOSTARCH="amd64" |
| 134 | fi |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 135 | curl -o $WORKSPACE/bin/voltctl -sSL https://github.com/opencord/voltctl/releases/download/v\${VOLTCTL_VERSION}/voltctl-\${VOLTCTL_VERSION}-\${HOSTOS}-\${HOSTARCH} |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 136 | chmod 755 $WORKSPACE/bin/voltctl |
| 137 | voltctl version --clientonly |
Andrea Campanella | 9b23433 | 2020-04-24 12:22:18 +0200 | [diff] [blame] | 138 | |
Matteo Scandolo | 3fbb065 | 2020-07-22 08:50:02 -0700 | [diff] [blame] | 139 | |
Andrea Campanella | 9b23433 | 2020-04-24 12:22:18 +0200 | [diff] [blame] | 140 | # Default kind-voltha config doesn't work on ONF demo pod for accessing kvstore. |
| 141 | # The issue is that the mgmt node is also one of the k8s nodes and so port forwarding doesn't work. |
| 142 | # We should change this. In the meantime here is a workaround. |
Suchitra Vemuri | 1342143 | 2020-06-05 17:34:33 -0700 | [diff] [blame] | 143 | if [ "${params.branch}" == "master" ]; then |
| 144 | set +e |
Andrea Campanella | 9b23433 | 2020-04-24 12:22:18 +0200 | [diff] [blame] | 145 | |
Andrea Campanella | 9b23433 | 2020-04-24 12:22:18 +0200 | [diff] [blame] | 146 | |
| 147 | # Remove noise from voltha-core logs |
Suchitra Vemuri | a2a7f2c | 2020-06-08 14:05:06 -0700 | [diff] [blame] | 148 | voltctl log level set WARN read-write-core#github.com/opencord/voltha-go/db/model |
| 149 | voltctl log level set WARN read-write-core#github.com/opencord/voltha-lib-go/v3/pkg/kafka |
Andrea Campanella | 9b23433 | 2020-04-24 12:22:18 +0200 | [diff] [blame] | 150 | # Remove noise from openolt logs |
Suchitra Vemuri | a2a7f2c | 2020-06-08 14:05:06 -0700 | [diff] [blame] | 151 | voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/db |
| 152 | voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/probe |
| 153 | voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/kafka |
Suchitra Vemuri | 1342143 | 2020-06-05 17:34:33 -0700 | [diff] [blame] | 154 | fi |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 155 | """ |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | stage('Functional Tests') { |
| 160 | environment { |
Suchitra Vemuri | e4a5bcc | 2020-03-16 12:43:03 -0700 | [diff] [blame] | 161 | ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 162 | ROBOT_FILE="Voltha_DT_PODTests.robot" |
Andrea Campanella | d924ce2 | 2020-04-20 16:40:41 +0200 | [diff] [blame] | 163 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/FunctionalTests" |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 164 | } |
| 165 | steps { |
| 166 | sh """ |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 167 | cd $WORKSPACE/kind-voltha/scripts |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 168 | ./log-collector.sh > /dev/null & |
| 169 | ./log-combine.sh > /dev/null & |
| 170 | |
| 171 | mkdir -p $ROBOT_LOGS_DIR |
Suchitra Vemuri | 627786a | 2020-06-18 16:52:05 -0700 | [diff] [blame] | 172 | if ( ${powerSwitch} ); then |
| 173 | export ROBOT_MISC_ARGS="--removekeywords wuks -i PowerSwitch -i sanityDt -i functionalDt -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE" |
| 174 | else |
| 175 | export ROBOT_MISC_ARGS="--removekeywords wuks -e PowerSwitch -i sanityDt -i functionalDt -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE" |
| 176 | fi |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 177 | make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 178 | """ |
| 179 | } |
| 180 | } |
Andrea Campanella | d924ce2 | 2020-04-20 16:40:41 +0200 | [diff] [blame] | 181 | |
Andrea Campanella | f47a198 | 2020-04-21 11:53:31 +0200 | [diff] [blame] | 182 | stage('Failure/Recovery Tests') { |
| 183 | environment { |
| 184 | ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
| 185 | ROBOT_FILE="Voltha_DT_FailureScenarios.robot" |
| 186 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/FailureScenarios" |
| 187 | } |
| 188 | steps { |
| 189 | sh """ |
| 190 | mkdir -p $ROBOT_LOGS_DIR |
| 191 | if ( ${powerSwitch} ); then |
| 192 | export ROBOT_MISC_ARGS="--removekeywords wuks -L TRACE -i functionalDt -i PowerSwitch -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE" |
| 193 | else |
| 194 | export ROBOT_MISC_ARGS="--removekeywords wuks -L TRACE -i functionalDt -e PowerSwitch -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE" |
| 195 | fi |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 196 | make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true |
Andrea Campanella | f47a198 | 2020-04-21 11:53:31 +0200 | [diff] [blame] | 197 | """ |
| 198 | } |
| 199 | } |
| 200 | |
Andy Bavier | 5ad87c9 | 2020-05-11 16:31:35 -0700 | [diff] [blame] | 201 | stage('Dataplane Tests') { |
| 202 | environment { |
Andy Bavier | 1541da8 | 2020-05-15 09:41:38 -0700 | [diff] [blame] | 203 | ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
Andy Bavier | 5ad87c9 | 2020-05-11 16:31:35 -0700 | [diff] [blame] | 204 | ROBOT_FILE="Voltha_DT_PODTests.robot" |
| 205 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/DataplaneTests" |
| 206 | } |
| 207 | steps { |
| 208 | sh """ |
| 209 | mkdir -p $ROBOT_LOGS_DIR |
Andy Bavier | 2dac06b | 2020-05-27 16:58:32 -0700 | [diff] [blame] | 210 | export ROBOT_MISC_ARGS="--removekeywords wuks -i dataplaneDt -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 211 | make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true |
Andy Bavier | 5ad87c9 | 2020-05-11 16:31:35 -0700 | [diff] [blame] | 212 | """ |
| 213 | } |
| 214 | } |
Suchitra Vemuri | 5e8e789 | 2020-09-14 16:04:12 -0700 | [diff] [blame] | 215 | stage('HA Tests') { |
| 216 | environment { |
| 217 | ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
| 218 | ROBOT_FILE="Voltha_ONOSHATests.robot" |
| 219 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ONOSHAScenarios" |
| 220 | } |
| 221 | steps { |
| 222 | sh """ |
| 223 | mkdir -p $ROBOT_LOGS_DIR |
| 224 | export ROBOT_MISC_ARGS="--removekeywords wuks -L TRACE -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v workflow:${params.workFlow} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 225 | make -C $WORKSPACE/voltha-system-tests voltha-test || true |
Suchitra Vemuri | 5e8e789 | 2020-09-14 16:04:12 -0700 | [diff] [blame] | 226 | """ |
| 227 | } |
| 228 | } |
Andy Bavier | 5ad87c9 | 2020-05-11 16:31:35 -0700 | [diff] [blame] | 229 | |
Andrea Campanella | d924ce2 | 2020-04-20 16:40:41 +0200 | [diff] [blame] | 230 | stage('Error Scenario Tests') { |
| 231 | environment { |
| 232 | ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
| 233 | ROBOT_FILE="Voltha_ErrorScenarios.robot" |
| 234 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/ErrorScenarios" |
| 235 | } |
| 236 | steps { |
| 237 | sh """ |
| 238 | mkdir -p $ROBOT_LOGS_DIR |
| 239 | export ROBOT_MISC_ARGS="--removekeywords wuks -L TRACE -i functional -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v workflow:${params.workFlow} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 240 | make -C $WORKSPACE/voltha-system-tests voltha-test || true |
Andrea Campanella | d924ce2 | 2020-04-20 16:40:41 +0200 | [diff] [blame] | 241 | """ |
| 242 | } |
Andrea Campanella | 7166637 | 2020-04-21 10:56:17 +0200 | [diff] [blame] | 243 | } |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 244 | } |
| 245 | post { |
| 246 | always { |
| 247 | sh returnStdout: false, script: ''' |
| 248 | set +e |
Matteo Scandolo | 97b1257 | 2020-04-13 12:44:46 -0700 | [diff] [blame] | 249 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq |
| 250 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 251 | kubectl get nodes -o wide |
| 252 | kubectl get pods -n voltha -o wide |
Suchitra Vemuri | 179643b | 2020-11-02 10:06:20 -0800 | [diff] [blame] | 253 | kubectl get pods -o wide |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 254 | |
| 255 | sleep 60 # Wait for log-collector and log-combine to complete |
| 256 | |
| 257 | # Clean up "announcer" pod used by the tests if present |
| 258 | kubectl delete pod announcer || true |
| 259 | |
| 260 | ## Pull out errors from log files |
| 261 | extract_errors_go() { |
| 262 | echo |
| 263 | echo "Error summary for $1:" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 264 | grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1* |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 265 | echo |
| 266 | } |
| 267 | |
| 268 | extract_errors_python() { |
| 269 | echo |
| 270 | echo "Error summary for $1:" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 271 | grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1* |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 272 | echo |
| 273 | } |
| 274 | |
| 275 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 276 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 277 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
| 278 | extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log |
| 279 | extract_errors_python onos >> $WORKSPACE/error-report.log |
| 280 | |
Andrea Campanella | 9a95cb7 | 2020-09-03 11:28:35 +0200 | [diff] [blame] | 281 | gzip error-report.log || true |
Andrea Campanella | c9c8068 | 2020-09-30 12:02:01 +0200 | [diff] [blame] | 282 | rm error-report.log || true |
Andrea Campanella | 9a95cb7 | 2020-09-03 11:28:35 +0200 | [diff] [blame] | 283 | |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 284 | cd $WORKSPACE/kind-voltha/scripts/logger/combined/ |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 285 | tar czf $WORKSPACE/container-logs.tgz * |
Andrea Campanella | c9c8068 | 2020-09-30 12:02:01 +0200 | [diff] [blame] | 286 | rm * || true |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 287 | |
| 288 | cd $WORKSPACE |
| 289 | gzip *-combined.log || true |
Andrea Campanella | c9c8068 | 2020-09-30 12:02:01 +0200 | [diff] [blame] | 290 | rm *-combined.log || true |
Matteo Scandolo | 3fbb065 | 2020-07-22 08:50:02 -0700 | [diff] [blame] | 291 | |
| 292 | # collect ETCD cluster logs |
| 293 | mkdir -p $WORKSPACE/etcd |
Girish Gowdra | 3eb96f6 | 2020-10-15 12:48:34 -0700 | [diff] [blame] | 294 | printf '%s\n' $(kubectl get pods -l app=etcd -o=jsonpath="{.items[*]['metadata.name']}") | xargs -I% bash -c "kubectl logs % > $WORKSPACE/etcd/%.log" |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 295 | ''' |
| 296 | script { |
| 297 | deployment_config.olts.each { olt -> |
| 298 | sh returnStdout: false, script: """ |
Matteo Scandolo | 3fbb065 | 2020-07-22 08:50:02 -0700 | [diff] [blame] | 299 | sshpass -p ${olt.pass} scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${olt.user}@${olt.sship}:/var/log/openolt.log $WORKSPACE/openolt-${olt.sship}.log || true |
Suchitra Vemuri | a069566 | 2020-07-17 09:41:49 -0700 | [diff] [blame] | 300 | sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/openolt-${olt.sship}.log # Remove escape sequences |
Matteo Scandolo | 3fbb065 | 2020-07-22 08:50:02 -0700 | [diff] [blame] | 301 | sshpass -p ${olt.pass} scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${olt.user}@${olt.sship}:/var/log/dev_mgmt_daemon.log $WORKSPACE/dev_mgmt_daemon-${olt.sship}.log || true |
Suchitra Vemuri | 8228c16 | 2020-07-19 13:55:11 -0700 | [diff] [blame] | 302 | sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/dev_mgmt_daemon-${olt.sship}.log # Remove escape sequences |
Matteo Scandolo | 3fbb065 | 2020-07-22 08:50:02 -0700 | [diff] [blame] | 303 | sshpass -p ${olt.pass} scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${olt.user}@${olt.sship}:/var/log/startup.log $WORKSPACE/startup-${olt.sship}.log || true |
Matteo Scandolo | 43fe780 | 2020-07-22 09:17:38 -0700 | [diff] [blame] | 304 | sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/startup-${olt.sship}.log || true # Remove escape sequences |
Girish Gowdra | 201b7e4 | 2020-07-28 15:58:07 -0700 | [diff] [blame] | 305 | sshpass -p ${olt.pass} scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${olt.user}@${olt.sship}:/var/log/openolt_process_watchdog.log $WORKSPACE/openolt_process_watchdog-${olt.sship}.log || true |
| 306 | sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/openolt_process_watchdog-${olt.sship}.log || true # Remove escape sequences |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 307 | """ |
| 308 | } |
| 309 | } |
| 310 | step([$class: 'RobotPublisher', |
| 311 | disableArchiveOutput: false, |
| 312 | logFileName: '**/log*.html', |
| 313 | otherFiles: '', |
| 314 | outputFileName: '**/output*.xml', |
| 315 | outputPath: 'RobotLogs', |
| 316 | passThreshold: 100, |
| 317 | reportFileName: '**/report*.html', |
| 318 | unstableThreshold: 0 |
| 319 | ]); |
Matteo Scandolo | 3fbb065 | 2020-07-22 08:50:02 -0700 | [diff] [blame] | 320 | archiveArtifacts artifacts: '*.log,*.gz,*.tgz,etcd/*.log' |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 321 | } |
| 322 | unstable { |
| 323 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
| 324 | } |
| 325 | } |
| 326 | } |