blob: a5a6ba7f463525c520860b44bae7d09efc956b10 [file] [log] [blame]
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -07001// 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
15node {
16 // Need this so that deployment_config has global scope when it's read later
17 deployment_config = null
18}
19
20pipeline {
21 /* no label, executor is determined by JJB */
22 agent {
23 label "${params.buildNode}"
24 }
25 options {
Suchitra Vemuri6ec07572021-02-22 10:47:05 -080026 timeout(time: 640, unit: 'MINUTES')
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -070027 }
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 Scandolo3dce2a12020-09-15 14:21:14 -070036 stage('Clone kind-voltha') {
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -070037 steps {
38 step([$class: 'WsCleanup'])
Matteo Scandolo3dce2a12020-09-15 14:21:14 -070039 checkout([
40 $class: 'GitSCM',
41 userRemoteConfigs: [[
42 url: "https://gerrit.opencord.org/kind-voltha",
Matteo Scandoloa42c6f52020-09-19 01:35:12 +000043 refspec: "${kindVolthaChange}"
Matteo Scandolo3dce2a12020-09-15 14:21:14 -070044 ]],
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 Scandoloa42c6f52020-09-19 01:35:12 +000060 refspec: "${volthaSystemTestsChange}"
Matteo Scandolo3dce2a12020-09-15 14:21:14 -070061 ]],
Suchitra Vemuri1143ae32021-03-26 01:08:37 +000062 branches: [[ name: "${branch}", ]],
Matteo Scandolo3dce2a12020-09-15 14:21:14 -070063 extensions: [
64 [$class: 'WipeWorkspace'],
65 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
66 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
67 ],
68 ])
Suchitra Vemuria38e5412021-02-23 15:28:28 -080069 script {
70 sh(script:"""
71 if [ '${volthaSystemTestsChange}' != '' ] ; then
72 cd $WORKSPACE/voltha-system-tests;
73 git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
74 fi
75 """)
76 }
Matteo Scandolo3dce2a12020-09-15 14:21:14 -070077 }
78 }
79 stage('Clone cord-tester') {
80 steps {
81 checkout([
82 $class: 'GitSCM',
83 userRemoteConfigs: [[
84 url: "https://gerrit.opencord.org/cord-tester",
Matteo Scandoloa42c6f52020-09-19 01:35:12 +000085 refspec: "${cordTesterChange}"
Matteo Scandolo3dce2a12020-09-15 14:21:14 -070086 ]],
87 branches: [[ name: "master", ]],
88 extensions: [
89 [$class: 'WipeWorkspace'],
90 [$class: 'RelativeTargetDirectory', relativeTargetDir: "cord-tester"],
91 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
92 ],
93 ])
94 }
95 }
Matteo Scandolo92a5cb62020-09-15 16:02:08 -070096 // This checkout allows us to show changes in Jenkins
97 // we only do this on master as we don't branch all the repos for all the releases
98 // (we should compute the difference by tracking the container version, not the code)
99 stage('Download All the VOLTHA repos') {
100 when {
101 expression {
102 return "${branch}" == 'master';
103 }
104 }
105 steps {
106 checkout(changelog: true,
107 poll: false,
108 scm: [$class: 'RepoScm',
109 manifestRepositoryUrl: "${params.manifestUrl}",
110 manifestBranch: "${params.branch}",
111 currentBranch: true,
112 destinationDir: 'voltha',
113 forceSync: true,
114 resetFirst: true,
115 quiet: true,
116 jobs: 4,
117 showAllChanges: true]
118 )
119 }
120 }
Matteo Scandolo3dce2a12020-09-15 14:21:14 -0700121 stage ('Initialize') {
122 steps {
Suchitra Vemuri2a5a5ea2020-03-27 22:53:11 -0700123 sh returnStdout: false, script: "git clone -b master ${cordRepoUrl}/${configBaseDir}"
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700124 script {
125 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
126 }
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700127 sh returnStdout: false, script: """
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700128 mkdir -p $WORKSPACE/bin
129 bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/bin"
130 cd $WORKSPACE
Suchitra Vemuri13421432020-06-05 17:34:33 -0700131 if [ "${params.branch}" != "master" ]; then
132 cd $WORKSPACE/kind-voltha
133 source releases/${params.branch}
Suchitra Vemuri13421432020-06-05 17:34:33 -0700134 else
Matteo Scandolo3dce2a12020-09-15 14:21:14 -0700135 VOLTCTL_VERSION=\$(curl -sSL https://api.github.com/repos/opencord/voltctl/releases/latest | jq -r .tag_name | sed -e 's/^v//g')
Suchitra Vemuri13421432020-06-05 17:34:33 -0700136 fi
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700137
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700138 HOSTOS=\$(uname -s | tr "[:upper:]" "[:lower:"])
139 HOSTARCH=\$(uname -m | tr "[:upper:]" "[:lower:"])
140 if [ \$HOSTARCH == "x86_64" ]; then
141 HOSTARCH="amd64"
142 fi
Matteo Scandolo3dce2a12020-09-15 14:21:14 -0700143 curl -o $WORKSPACE/bin/voltctl -sSL https://github.com/opencord/voltctl/releases/download/v\${VOLTCTL_VERSION}/voltctl-\${VOLTCTL_VERSION}-\${HOSTOS}-\${HOSTARCH}
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700144 chmod 755 $WORKSPACE/bin/voltctl
145 voltctl version --clientonly
Andrea Campanella9b234332020-04-24 12:22:18 +0200146
Matteo Scandolo3fbb0652020-07-22 08:50:02 -0700147
Andrea Campanella9b234332020-04-24 12:22:18 +0200148 # Default kind-voltha config doesn't work on ONF demo pod for accessing kvstore.
149 # The issue is that the mgmt node is also one of the k8s nodes and so port forwarding doesn't work.
150 # We should change this. In the meantime here is a workaround.
Suchitra Vemuri13421432020-06-05 17:34:33 -0700151 if [ "${params.branch}" == "master" ]; then
152 set +e
Andrea Campanella9b234332020-04-24 12:22:18 +0200153
Andrea Campanella9b234332020-04-24 12:22:18 +0200154
155 # Remove noise from voltha-core logs
Suchitra Vemuria2a7f2c2020-06-08 14:05:06 -0700156 voltctl log level set WARN read-write-core#github.com/opencord/voltha-go/db/model
157 voltctl log level set WARN read-write-core#github.com/opencord/voltha-lib-go/v3/pkg/kafka
Andrea Campanella9b234332020-04-24 12:22:18 +0200158 # Remove noise from openolt logs
Suchitra Vemuria2a7f2c2020-06-08 14:05:06 -0700159 voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/db
160 voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/probe
161 voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/kafka
Suchitra Vemuri13421432020-06-05 17:34:33 -0700162 fi
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700163 """
164 }
165 }
166
167 stage('Functional Tests') {
168 environment {
Suchitra Vemurie4a5bcc2020-03-16 12:43:03 -0700169 ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700170 ROBOT_FILE="Voltha_DT_PODTests.robot"
Andrea Campanellad924ce22020-04-20 16:40:41 +0200171 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/FunctionalTests"
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700172 }
173 steps {
174 sh """
Matteo Scandolo3dce2a12020-09-15 14:21:14 -0700175 cd $WORKSPACE/kind-voltha/scripts
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700176 ./log-collector.sh > /dev/null &
177 ./log-combine.sh > /dev/null &
178
179 mkdir -p $ROBOT_LOGS_DIR
Suchitra Vemuri627786a2020-06-18 16:52:05 -0700180 if ( ${powerSwitch} ); then
Andrea Campanella0d3110c2021-01-20 12:25:45 +0100181 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 -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
Suchitra Vemuri627786a2020-06-18 16:52:05 -0700182 else
Andrea Campanella0d3110c2021-01-20 12:25:45 +0100183 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 -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
Suchitra Vemuri627786a2020-06-18 16:52:05 -0700184 fi
Matteo Scandolo3dce2a12020-09-15 14:21:14 -0700185 make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700186 """
187 }
188 }
Andrea Campanellad924ce22020-04-20 16:40:41 +0200189
Andrea Campanellaf47a1982020-04-21 11:53:31 +0200190 stage('Failure/Recovery Tests') {
191 environment {
192 ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
193 ROBOT_FILE="Voltha_DT_FailureScenarios.robot"
194 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/FailureScenarios"
195 }
196 steps {
197 sh """
198 mkdir -p $ROBOT_LOGS_DIR
199 if ( ${powerSwitch} ); then
Andrea Campanella0d3110c2021-01-20 12:25:45 +0100200 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 -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
Andrea Campanellaf47a1982020-04-21 11:53:31 +0200201 else
Andrea Campanella0d3110c2021-01-20 12:25:45 +0100202 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 -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
Andrea Campanellaf47a1982020-04-21 11:53:31 +0200203 fi
Matteo Scandolo3dce2a12020-09-15 14:21:14 -0700204 make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true
Andrea Campanellaf47a1982020-04-21 11:53:31 +0200205 """
206 }
207 }
208
Andy Bavier5ad87c92020-05-11 16:31:35 -0700209 stage('Dataplane Tests') {
210 environment {
Andy Bavier1541da82020-05-15 09:41:38 -0700211 ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
Andy Bavier5ad87c92020-05-11 16:31:35 -0700212 ROBOT_FILE="Voltha_DT_PODTests.robot"
213 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/DataplaneTests"
214 }
215 steps {
216 sh """
217 mkdir -p $ROBOT_LOGS_DIR
Andrea Campanella0d3110c2021-01-20 12:25:45 +0100218 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 -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
Matteo Scandolo3dce2a12020-09-15 14:21:14 -0700219 make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true
Andy Bavier5ad87c92020-05-11 16:31:35 -0700220 """
221 }
222 }
Suchitra Vemuri5e8e7892020-09-14 16:04:12 -0700223 stage('HA Tests') {
224 environment {
225 ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
226 ROBOT_FILE="Voltha_ONOSHATests.robot"
227 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ONOSHAScenarios"
228 }
229 steps {
230 sh """
231 mkdir -p $ROBOT_LOGS_DIR
Andrea Campanella0d3110c2021-01-20 12:25:45 +0100232 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 -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
Matteo Scandolo3dce2a12020-09-15 14:21:14 -0700233 make -C $WORKSPACE/voltha-system-tests voltha-test || true
Suchitra Vemuri5e8e7892020-09-14 16:04:12 -0700234 """
235 }
236 }
Andy Bavier5ad87c92020-05-11 16:31:35 -0700237
Suchitra Vemuri0a9c8c62020-12-07 18:24:31 -0800238 stage('Multiple OLT Tests') {
239 environment {
240 ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
241 ROBOT_FILE="Voltha_DT_MultiOLT_Tests.robot"
242 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/MultipleOLTScenarios"
243 }
244 steps {
245 sh """
246 mkdir -p $ROBOT_LOGS_DIR
247 if ( ${powerSwitch} ); then
Andrea Campanella0d3110c2021-01-20 12:25:45 +0100248 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 -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
Suchitra Vemuri0a9c8c62020-12-07 18:24:31 -0800249 else
Andrea Campanella0d3110c2021-01-20 12:25:45 +0100250 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 -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
Suchitra Vemuri0a9c8c62020-12-07 18:24:31 -0800251 fi
252 make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true
253 """
254 }
255 }
256
257
Andrea Campanellad924ce22020-04-20 16:40:41 +0200258 stage('Error Scenario Tests') {
259 environment {
260 ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
261 ROBOT_FILE="Voltha_ErrorScenarios.robot"
262 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/ErrorScenarios"
263 }
264 steps {
265 sh """
266 mkdir -p $ROBOT_LOGS_DIR
Andrea Campanella0d3110c2021-01-20 12:25:45 +0100267 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 -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
Matteo Scandolo3dce2a12020-09-15 14:21:14 -0700268 make -C $WORKSPACE/voltha-system-tests voltha-test || true
Andrea Campanellad924ce22020-04-20 16:40:41 +0200269 """
270 }
Andrea Campanella71666372020-04-21 10:56:17 +0200271 }
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700272 }
273 post {
274 always {
275 sh returnStdout: false, script: '''
276 set +e
Matteo Scandolo97b12572020-04-13 12:44:46 -0700277 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
278 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700279 kubectl get nodes -o wide
280 kubectl get pods -n voltha -o wide
Suchitra Vemuri179643b2020-11-02 10:06:20 -0800281 kubectl get pods -o wide
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700282
283 sleep 60 # Wait for log-collector and log-combine to complete
284
285 # Clean up "announcer" pod used by the tests if present
286 kubectl delete pod announcer || true
287
288 ## Pull out errors from log files
289 extract_errors_go() {
290 echo
291 echo "Error summary for $1:"
Matteo Scandolo3dce2a12020-09-15 14:21:14 -0700292 grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700293 echo
294 }
295
296 extract_errors_python() {
297 echo
298 echo "Error summary for $1:"
Matteo Scandolo3dce2a12020-09-15 14:21:14 -0700299 grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700300 echo
301 }
302
303 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
304 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
305 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
306 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log
307 extract_errors_python onos >> $WORKSPACE/error-report.log
308
Andrea Campanella9a95cb72020-09-03 11:28:35 +0200309 gzip error-report.log || true
Andrea Campanellac9c80682020-09-30 12:02:01 +0200310 rm error-report.log || true
Andrea Campanella9a95cb72020-09-03 11:28:35 +0200311
Matteo Scandolo3dce2a12020-09-15 14:21:14 -0700312 cd $WORKSPACE/kind-voltha/scripts/logger/combined/
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700313 tar czf $WORKSPACE/container-logs.tgz *
Andrea Campanellac9c80682020-09-30 12:02:01 +0200314 rm * || true
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700315
316 cd $WORKSPACE
317 gzip *-combined.log || true
Andrea Campanellac9c80682020-09-30 12:02:01 +0200318 rm *-combined.log || true
Matteo Scandolo3fbb0652020-07-22 08:50:02 -0700319
Andrea Campanellaa20a9332021-03-09 09:18:42 +0100320 # store information on running charts
321 helm ls > $WORKSPACE/helm-list.txt || true
322
323 # store information on the running pods
Andrea Campanellae0c839f2021-03-16 17:53:40 +0100324 kubectl get pods --all-namespaces -o wide > $WORKSPACE/pods.txt || true
Andrea Campanellaa20a9332021-03-09 09:18:42 +0100325 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/pod-images.txt || true
326 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $WORKSPACE/pod-imagesId.txt || true
327
Matteo Scandolo3fbb0652020-07-22 08:50:02 -0700328 # collect ETCD cluster logs
329 mkdir -p $WORKSPACE/etcd
Girish Gowdra3eb96f62020-10-15 12:48:34 -0700330 printf '%s\n' $(kubectl get pods -l app=etcd -o=jsonpath="{.items[*]['metadata.name']}") | xargs -I% bash -c "kubectl logs % > $WORKSPACE/etcd/%.log"
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700331 '''
332 script {
333 deployment_config.olts.each { olt ->
Andrea Campanella0d3110c2021-01-20 12:25:45 +0100334 if (olt.type == null || olt.type == "" || olt.type == "openolt") {
335 sh returnStdout: false, script: """
336 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
337 sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/openolt-${olt.sship}.log # Remove escape sequences
338 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
339 sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/dev_mgmt_daemon-${olt.sship}.log # Remove escape sequences
340 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
341 sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/startup-${olt.sship}.log || true # Remove escape sequences
342 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
343 sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/openolt_process_watchdog-${olt.sship}.log || true # Remove escape sequences
344 """
345 }
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700346 }
347 }
348 step([$class: 'RobotPublisher',
349 disableArchiveOutput: false,
350 logFileName: '**/log*.html',
351 otherFiles: '',
352 outputFileName: '**/output*.xml',
353 outputPath: 'RobotLogs',
354 passThreshold: 100,
355 reportFileName: '**/report*.html',
Andrea Campanellaabc09772021-06-16 12:08:57 +0200356 unstableThreshold: 0,
357 onlyCritical: true
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700358 ]);
Andrea Campanella82bed262021-03-10 10:06:26 +0100359 archiveArtifacts artifacts: '*.log,*.gz,*.tgz,etcd/*.log,*.txt'
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700360 }
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700361 }
362}