forked from opencord/cord-tester
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkinsfile-rcordlite-control-plane
More file actions
177 lines (175 loc) · 8.06 KB
/
Jenkinsfile-rcordlite-control-plane
File metadata and controls
177 lines (175 loc) · 8.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
// Copyright 2017-present Open Networking Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
node ("${TestNodeName}") {
timeout (time: 240) {
stage ("Parse deployment configuration file") {
sh returnStdout: true, script: 'rm -rf ${configRepoBaseDir}'
sh returnStdout: true, script: 'git clone -b ${branch} ${configRepoUrl}'
deployment_config = readYaml file: "${configRepoBaseDir}${configRepoFile}"
}
stage('Export pod config') {
timeout(10) {
try {
sh """
cd /home/cord
rm -rf /home/cord/helm-charts
git clone -b ${branch} https://gerrit.opencord.org/helm-charts
export KUBECONFIG=/home/cord/${deployment_config.pod_config}
kubectl get pods
"""
} catch(error) { currentBuild.result = 'FAILURE' }
}
}
stage('Clean up') {
timeout(10) {
sh returnStdout: true, script: """
rm -rf helm-charts cord-tester
git clone -b ${branch} ${cordRepoUrl}/helm-charts
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet');
do
echo "Purging chart: \${hchart}"
helm delete --purge "\${hchart}"
done
"""
timeout(5) {
waitUntil {
helm_deleted = sh returnStdout: true, script: """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
helm ls -q | grep -E -v 'docker-registry|mavenrepo|ponnet' | wc -l
"""
return helm_deleted.toInteger() == 0
}
}
timeout(5) {
waitUntil {
kubectl_deleted = sh returnStdout: true, script: """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
kubectl get pods --all-namespaces --no-headers | grep -E -v 'kube-system|docker-registry|mavenrepo|ponnet' | wc -l
"""
return kubectl_deleted.toInteger() == 0
}
}
}
}
stage('Install xos-core and rcord-lite') {
timeout(10) {
try {
sh """
export KUBECONFIG=/home/cord/${deployment_config.pod_config}
cd /home/cord/helm-charts
helm dep update xos-core
helm install -n xos-core xos-core
helm dep update xos-profiles/rcord-lite
helm install -n rcord-lite xos-profiles/rcord-lite
"""
} catch(error) { currentBuild.result = 'FAILURE' }
}
}
stage('Install voltha') {
timeout(10) {
try {
sh """
export KUBECONFIG=/home/cord/${deployment_config.pod_config}
cd /home/cord/helm-charts/voltha
helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
helm dep build
cd /home/cord/helm-charts
helm install -n voltha --set etcd-operator.customResources.createEtcdClusterCRD=false voltha
helm upgrade --set etcd-operator.customResources.createEtcdClusterCRD=true voltha ./voltha
"""
} catch(error) { currentBuild.result = 'FAILURE' }
}
}
stage('Install ONOS-Voltha and ONOS-Fabric') {
timeout(10) {
try {
sh """
export KUBECONFIG=/home/cord/${deployment_config.pod_config}
cd /home/cord/helm-charts
helm install -n onos-fabric -f configs/onos-fabric.yaml onos
helm install -n onos-voltha -f configs/onos-voltha.yaml onos
sleep 60
"""
} catch(error) { currentBuild.result = 'FAILURE' }
}
}
stage('Download cord-tester repo') {
timeout(10) {
try {
sh """
rm -rf /home/cord/cord-tester
cd /home/cord/
git clone -b ${branch} https://gerrit.opencord.org/cord-tester
"""
} catch(error) { currentBuild.result = 'FAILURE' }
}
}
stage('Validate Helm Chart Install') {
timeout(10) {
try {
sh """
export KUBECONFIG=/home/cord/${deployment_config.pod_config}
cd /home/cord/cord-tester/src/test/robot/
rm -rf Log/ || true
robot -d Log -T -l log-SanityK8POD SanityK8POD.robot || true
"""
} catch(error) { currentBuild.result = 'FAILURE' }
}
}
stage('Verify E2E XOS') {
timeout(10) {
try {
sh """
export KUBECONFIG=/home/cord/${deployment_config.pod_config}
chameleon=\$(kubectl get pods | grep chameleon | cut -d' ' -f1)
echo \$chameleon
kubectl delete pod \$chameleon
sleep 120
kubectl get pods
cd /home/cord/cord-tester/src/test/cord-api/Properties/
sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'${deployment_config.node1.ip}\'/\" RestApiProperties.py
sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'30006\'/\" RestApiProperties.py
sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py
sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py
cd /home/cord/cord-tester/src/test/cord-api/Tests
rm -rf Log/ || true
robot -d Log -T -l log-VOLTDevice_Test VOLTDevice_Test.txt || true
robot -d Log -T -l log-RCORDLite_E2ETest RCORDLite_E2ETest.txt || true
"""
} catch(error) { currentBuild.result = 'FAILURE' }
}
}
stage('Publish') {
try {
sh """
if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs;
mkdir RobotLogs/TestDoc || true
cp -r /home/cord/cord-tester/src/test/robot/Log/* ./RobotLogs || true
cp -r /home/cord/cord-tester/src/test/cord-api/Tests/Log/* ./RobotLogs || true
"""
step([$class: 'RobotPublisher',
disableArchiveOutput: false,
logFileName: 'RobotLogs/log*.html',
otherFiles: '',
outputFileName: 'RobotLogs/output*.xml',
outputPath: '.',
passThreshold: 100,
reportFileName: 'RobotLogs/report*.html',
unstableThreshold: 0])
} catch(error) {}
}
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
}
}