blob: d00fdd64e02a380c3a4435e7b67cf8cff6e0bbd5 [file] [log] [blame]
Brian Freeman48d30542019-08-20 13:13:58 -05001---
2- builder:
3 name: run-rke-ete
4 builders:
5 - shell: |
6 #!/bin/bash
7 set +x
8 . $WORKSPACE/deployment/heat/onap-rke/env/{lab-name}/{tenant-name}-openrc
9 . $JENKINS_HOME/onap-lab-ci/labs/{lab-name}-openrc
10 source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh
11
12 set -x
13 rm -rf $WORKSPACE/archives
14 mkdir -p $WORKSPACE/archives
15
16 SSH_KEY=~/.ssh/onap_key
17 ENV_FILE=./env/{lab-name}/onap-oom.env
18 STACK_NAME={stack-name}
19
20 cd $WORKSPACE/deployment/heat/onap-rke/
21 ./scripts/deploy.sh -s $STACK_NAME -d {stack-name}.{lab-name}.onapci.org -i {integration-branch} -o {oom-branch} -q $ENV_FILE
22
23 NFS_IP=$(openstack stack output show $STACK_NAME nfs_vm_ip -c output_value -f value)
24 K8S_IP=$(openstack stack output show $STACK_NAME k8s_01_vm_ip -c output_value -f value)
25
26 set +x
27 ~/onap-lab-ci/labs/set-dns-record.sh "{stack-name}.{lab-name}" $K8S_IP
28 set -x
29
30 # deploy log and pomba at the end since they're by default disabled in integration-override
31 ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -c "helm deploy dev local/onap -f ~/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f ~/integration-override.yaml --namespace onap --verbose --set log.enabled=true --set pomba.enabled=true"'
32
33 PREV_RESULT=999
34 for n in $(seq 1 8); do
35 echo "Wait for pods to be up, $n of 8"
36 RESULT=$(ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -c "kubectl -n onap get pods"' | grep -vE 'NAME|Completed|Error|1/1|2/2' | wc -l)
37 if [[ $? -eq 0 && ( $RESULT -eq 0 || $RESULT -ge $PREV_RESULT ) ]]; then
38 break
39 fi
40 sleep 15m
41 PREV_RESULT=$RESULT
42 done
43
44 PREV_RESULT=127
45 for n in $(seq 1 8); do
46 echo "Wait for HEALTHCHECK, $n of 8"
47 ROBOT_POD=$(ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -c "kubectl --namespace onap get pods"' | grep robot | sed 's/ .*//')
48 ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap health"'
49 RESULT=$?
50 if [[ $RESULT -lt 20 && ( $RESULT -eq 0 || $RESULT -ge $PREV_RESULT ) ]]; then
51 break
52 fi
53 sleep 15m
54 PREV_RESULT=$RESULT
55 done
56 if [ "$ROBOT_POD" == "" ]; then
57 exit 1
58 fi
59
60 LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep health | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su)
61 echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/"
62 mkdir -p $WORKSPACE/archives/healthcheck
63 rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$NFS_IP:/dockerdata-nfs/dev-robot/robot/logs/$LOG_DIR/ $WORKSPACE/archives/healthcheck
64
65 # record states of pods and containers
66 ssh -i $SSH_KEY root@$NFS_IP 'kubectl get pods -n onap'
67 ssh -i $SSH_KEY root@$NFS_IP "kubectl get pods -n onap -o json" > $WORKSPACE/archives/onap-pods.json
68 ssh -i $SSH_KEY root@$NFS_IP "/root/integration/deployment/heat/onap-rke/scripts/get-image-tags.sh | tee image-tags.log" > $WORKSPACE/archives/image-tags.log
69
70 # demo init
71 ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/demo-k8s.sh onap init"'
72 LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep demo_init | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su)
73 echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/"
74 mkdir -p $WORKSPACE/archives/demo-init
75 rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$NFS_IP:/dockerdata-nfs/dev-robot/robot/logs/$LOG_DIR/ $WORKSPACE/archives/demo-init
76
77 # ete ete
78 ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap ete execscript"'
79 LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep ete_ete | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su)
80 echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/"
81 mkdir -p $WORKSPACE/archives/ete
82 rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$NFS_IP:/dockerdata-nfs/dev-robot/robot/logs/$LOG_DIR/ $WORKSPACE/archives/ete
83
84 # ete instantiate
85 ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap instantiate"'
86 LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep instantiate | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su)
87 echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/"
88 mkdir -p $WORKSPACE/archives/instantiate
89 rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$NFS_IP:/dockerdata-nfs/dev-robot/robot/logs/$LOG_DIR/ $WORKSPACE/archives/instantiate
90
91 # ete portal
92 ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap portal"'
93 LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep portal | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su)
94 echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/"
95 mkdir -p $WORKSPACE/archives/portal
96 rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$NFS_IP:/dockerdata-nfs/dev-robot/robot/logs/$LOG_DIR/ $WORKSPACE/archives/portal
97
98 # ete instantiateDemoVFWCL
99 ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap instantiateDemoVFWCL"'
100 LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep instantiateDemoVFWCL | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su)
101 echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/"
102 mkdir -p $WORKSPACE/archives/instantiateDemoVFWCL
103 rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$NFS_IP:/dockerdata-nfs/dev-robot/robot/logs/$LOG_DIR/ $WORKSPACE/archives/instantiateDemoVFWCL
104
105 # ete sdc-dcae-d
106 ssh -i $SSH_KEY ubuntu@$NFS_IP 'sudo su -l root -c "/root/oom/kubernetes/robot/ete-k8s.sh onap sdc-dcae-d"'
107 LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep sdc-dcae-d | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su)
108 echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/"
109 mkdir -p $WORKSPACE/archives/sdc-dcae-d
110 rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$NFS_IP:/dockerdata-nfs/dev-robot/robot/logs/$LOG_DIR/ $WORKSPACE/archives/sdc-dcae-d
111
112
113 # demo vfwclosedloop
114 PKG_STACK=$(openstack stack list -f value -c "Stack Name" --sort creation_time:desc | grep Vfmodule_Demo_vFWCLvPKG | head -1)
115 PUBLIC_NET_ID=$(openstack stack show $STACK_NAME -f json | jq -r '.parameters.public_net_id')
116 PUBLIC_NET_NAME=$(openstack network show $PUBLIC_NET_ID -f value -c name)
117 PKG_IP=$(openstack stack resource show $PKG_STACK vpg_server_0 -f json | jq -r ".attributes.addresses.$PUBLIC_NET_NAME[0].addr")
118 echo "/root/oom/kubernetes/robot/demo-k8s.sh onap vfwclosedloop $PKG_IP" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su
119 LOG_DIR=$(echo "kubectl exec -n onap $ROBOT_POD -- ls -1t /share/logs | grep vfwclosedloop | head -1" | ssh -i $SSH_KEY ubuntu@$NFS_IP sudo su)
120 echo "Browse Robot results at http://$K8S_IP:30209/logs/$LOG_DIR/"
121 mkdir -p $WORKSPACE/archives/vfwclosedloop
122 rsync -e "ssh -i $SSH_KEY" -avtz ubuntu@$NFS_IP:/dockerdata-nfs/dev-robot/robot/logs/$LOG_DIR/ $WORKSPACE/archives/vfwclosedloop
123
124
125 cd $WORKSPACE/archives
126 rebot -N "ONAP CI" --removekeywords wuks --output output.xml --merge $(ls -rt */output.xml)
127
128 exit 0
129
130- job-template:
131 disabled_var:
132 triggers_var:
133 name: '{env}-staging-{frequency}'
134 description: 'Staging deployment to {lab-name} {tenant-name}'
135 disabled: '{obj:disabled_var}'
136 project-type: freestyle
137 lab-name: ''
138 tenant-name: ''
139 scm:
140 - git-integration:
141 branch: "{integration-branch}"
142 wrappers:
143 - timestamps
144 - timeout:
145 timeout: 720
146 fail: true
147 triggers: '{obj:triggers_var}'
148 builders:
149 - run-rke-ete:
150 stack-name: '{stack-name}'
151 lab-name: '{lab-name}'
152 tenant-name: '{tenant-name}'
153 integration-branch: '{integration-branch}'
154 oom-branch: '{oom-branch}'
155 publishers:
156 - integration-robot
157 - pods-influxdb
158 - archive-logs
159 - trigger-lf-lab-job:
160 lab-name: '{lab-name}'
161
162- job-template:
163 disabled_var:
164 triggers_var:
165 name: '{env}-release-{frequency}'
166 description: 'Release deployment to {lab-name} {tenant-name}'
167 disabled: '{obj:disabled_var}'
168 project-type: freestyle
169 lab-name: ''
170 tenant-name: ''
171 scm:
172 - git-integration:
173 branch: "{integration-branch}"
174 wrappers:
175 - timestamps
176 - timeout:
177 timeout: 720
178 fail: true
179 triggers: '{obj:triggers_var}'
180 builders:
181 - run-rke-ete:
182 stack-name: '{stack-name}'
183 lab-name: '{lab-name}'
184 tenant-name: '{tenant-name}'
185 integration-branch: '{integration-branch}'
186 oom-branch: '{oom-branch}'
187 publishers:
188 - integration-robot
189 - pods-influxdb
190 - archive-logs
191 - trigger-lf-lab-job:
192 lab-name: '{lab-name}'
193
194- builder:
195 name: run-cleanup
196 builders:
197 - shell: |
198 #!/bin/bash
199 set +x
200 . $WORKSPACE/deployment/heat/onap-rke/env/{lab-name}/{tenant-name}-openrc
201 . $JENKINS_HOME/onap-lab-ci/labs/{lab-name}-openrc
202
203 set -x
204 rm -rf $WORKSPACE/archives
205 mkdir -p $WORKSPACE/archives
206
207 SSH_KEY=~/.ssh/onap_key
208
209 openstack project list -f value | while read line; do
210 OS_PROJECT_ID=$(echo $line | cut -d' ' -f1)
211 OS_PROJECT_NAME=$(echo $line | cut -d' ' -f2-)
212
213 openstack stack list -f value -c 'Stack Name' | while read STACK_NAME; do
214 NFS_IP=$(openstack stack output show $STACK_NAME nfs_vm_ip -c output_value -f value)
215 if [ ! -z "$NFS_IP" ]; then
216 # timeout 20 ssh -i $SSH_KEY root@$NFS_IP "helm delete dev-log"
217 # timeout 20 ssh -i $SSH_KEY root@$NFS_IP "helm delete dev-pomba"
218 timeout 20 ssh -i $SSH_KEY root@$NFS_IP "kubectl top pod | sort --reverse --key 2 --numeric | head -20"
219 fi
220 done
221 done
222
223 exit 0
224
225- job-template:
226 name: '{env}-cleanup'
227 description: 'Clean up {lab-name} tenants'
228 project-type: freestyle
229 lab-name: ''
230 tenant-name: ''
231 scm:
232 - git-integration:
233 branch: "{integration-branch}"
234 wrappers:
235 - timestamps
236 builders:
237 - run-cleanup:
238 lab-name: '{lab-name}'
239 tenant-name: '{tenant-name}'
240 publishers:
241 - archive-logs