blob: 83bd7f475d2eb30542f8cf28b53dbf5284797722 [file] [log] [blame]
Matteo Scandoloc88d3132020-08-27 15:24:34 -07001// Copyright 2019-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
Matteo Scandolo52749cb2020-08-27 16:33:13 -070015topologies = [
16 ['onu': 1, 'pon': 1],
17 ['onu': 2, 'pon': 1],
18 ['onu': 2, 'pon': 2],
19]
20
Matteo Scandoloc88d3132020-08-27 15:24:34 -070021pipeline {
22
23 agent {
24 label "${params.buildNode}"
25 }
26 options {
27 timeout(time: 30, unit: 'MINUTES')
28 }
29 environment {
Matteo Scandolo52749cb2020-08-27 16:33:13 -070030 JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done
31 KUBECONFIG="$HOME/.kube/config"
32 VOLTCONFIG="$HOME/.volt/config"
33 SCHEDULE_ON_CONTROL_NODES="yes"
Matteo Scandoloc88d3132020-08-27 15:24:34 -070034
Matteo Scandolo52749cb2020-08-27 16:33:13 -070035 WITH_SIM_ADAPTERS="no"
36 WITH_RADIUS="yes"
37 WITH_BBSIM="yes"
38 LEGACY_BBSIM_INDEX="no"
39 DEPLOY_K8S="no"
40 CONFIG_SADIS="external"
Matteo Scandoloc88d3132020-08-27 15:24:34 -070041 }
42
43 stages {
44 stage ('Cleanup') {
45 steps {
46 timeout(time: 11, unit: 'MINUTES') {
47 sh returnStdout: false, script: """
48 helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com
49 helm repo add stable https://kubernetes-charts.storage.googleapis.com
50 helm repo add onf https://charts.opencord.org
51 helm repo add cord https://charts.opencord.org
52 helm repo add onos https://charts.onosproject.org
53 helm repo add atomix https://charts.atomix.io
54 helm repo add bbsim-sadis https://ciena.github.io/bbsim-sadis-server/charts
55 helm repo update
56
57 # removing ETCD port forward
58 P_ID="\$(ps e -ww -A | grep "_TAG=etcd-port-forward" | grep -v grep | awk '{print \$1}')"
59 if [ -n "\$P_ID" ]; then
60 kill -9 \$P_ID
61 fi
62
63 for hchart in \$(helm list -q | grep -E -v 'docker-registry|kafkacat');
64 do
65 echo "Purging chart: \${hchart}"
66 helm delete "\${hchart}"
67 done
68 bash /home/cord/voltha-scale/wait_for_pods.sh
69
70 test -e $WORKSPACE/kind-voltha/voltha && cd $WORKSPACE/kind-voltha && ./voltha down
71
72 cd $WORKSPACE
73 rm -rf $WORKSPACE/*
74 """
75 }
76 }
77 }
78 stage('Clone kind-voltha') {
79 steps {
80 checkout([
81 $class: 'GitSCM',
82 userRemoteConfigs: [[ url: "https://gerrit.opencord.org/kind-voltha", ]],
83 branches: [[ name: "master", ]],
84 extensions: [
85 [$class: 'WipeWorkspace'],
86 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
87 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
88 ],
89 ])
90 script {
91 sh(script:"""
92 if [ '${kindVolthaChange}' != '' ] ; then
93 cd $WORKSPACE/kind-voltha;
94 git fetch https://gerrit.opencord.org/kind-voltha ${volthaSystemTestsChange} && git checkout FETCH_HEAD
95 fi
96 """)
97 }
98 }
99 }
100 stage('Clone voltha-system-tests') {
101 steps {
102 checkout([
103 $class: 'GitSCM',
104 userRemoteConfigs: [[ url: "https://gerrit.opencord.org/voltha-system-tests", ]],
105 branches: [[ name: "${release}", ]],
106 extensions: [
107 [$class: 'WipeWorkspace'],
108 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
109 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
110 ],
111 ])
112 script {
113 sh(script:"""
114 if [ '${volthaSystemTestsChange}' != '' ] ; then
115 cd $WORKSPACE/voltha-system-tests;
116 git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
117 fi
118 """)
119 }
120 }
121 }
122 stage('Deploy and test') {
Matteo Scandolo52749cb2020-08-27 16:33:13 -0700123 steps {
124 repeat_deploy_and_test(topologies)
125 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700126 }
127 }
128}
129
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700130def repeat_deploy_and_test(list) {
131 for (int i = 0; i < list.size(); i++) {
132 sh "echo Setting up with ${list[i]['pon']}x${list[i]['onu']}"
133 }
134}