forked from opencord/cord-tester
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkinsfile-mcord-remote-build
More file actions
141 lines (131 loc) · 7.15 KB
/
Jenkinsfile-mcord-remote-build
File metadata and controls
141 lines (131 loc) · 7.15 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
// 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 (100) {
try {
stage ("Parse deployment configuration file") {
sh returnStdout: true, script: "rm -rf helm-charts helm-repo-tools ${configBaseDir}"
sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/helm-repo-tools"
sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/helm-charts"
sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}"
deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml"
}
stage('Clean up') {
timeout(10) {
sh returnStdout: true, script: """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
helm init --upgrade --force-upgrade
"""
timeout(1) {
waitUntil {
tillerpod_running = sh returnStdout: true, script: """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
kubectl -n kube-system get pods | grep tiller-deploy | grep Running | grep 1/1 | wc -l
"""
return tillerpod_running.toInteger() == 1
}
}
sh returnStdout: true, script: """
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('Add Helm repositories') {
sh returnStdout: true, script: """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
helm repo add cord https://charts.opencord.org
helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
helm repo update
"""
timeout(1) {
waitUntil {
tillerpod_running = sh returnStdout: true, script: """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
kubectl -n kube-system get pods | grep tiller-deploy | grep Running | wc -l
"""
return tillerpod_running.toInteger() == 1
}
}
timeout(1) {
waitUntil {
cord_repo_present = sh returnStdout: true, script: """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
helm repo list | grep cord | wc -l
"""
return cord_repo_present.toInteger() == 1
}
}
}
stage("Install M-CORD Control Plane Services") {
sh returnStdout: true, script: """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
helm install -n mcord-control-plane --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set spgwu_s1u_ip=${dataplane_s1u_ip} --set accelleran_hostname=${accelleran_bbu_ip} cord/mcord-control-plane
"""
timeout(20) {
control_plane = sh returnStdout: true, script: """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
kubectl -n epc get pods | grep -i running | grep 1/1 | wc -l
"""
// We have 4 pods: cassandra, hss, mme and ngic-cp
return control_plane.toInteger() == 4
}
}
// TODO: Use --namespace wowz to create the namespace
stage("Install CDN Remote Services") {
sh returnStdout: true, script: """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
helm install -n cdn-remote cord/mcord-cdn-remote -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml
"""
timeout(3) {
waitUntil {
mcord_remote_cdn_working = sh returnStdout: true, script: """
export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
kubectl -n wowz get pods -o wide | grep -i running | grep 1/1 | wc -l
"""
return mcord_remote_cdn_working.toInteger() == 2
}
}
}
currentBuild.result = 'SUCCESS'
} catch (err) {
println err.message
currentBuild.result = 'FAILURE'
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
}
echo "RESULT: ${currentBuild.result}"
}
}