blob: 163b2df0b680e7df84717f1e205bdde6be211b67 [file] [log] [blame]
Kailash Khalasie43352e2018-06-15 18:46:40 -07001/* mcord-in-a-box 6.0 pipeline build and test*/
2
3pipeline {
4
5 /* no label, executor is determined by JJB */
6 agent {
7 label "${params.executorNode}"
8 }
9
10 stages {
11
12 stage ('Checkout Automation-Tools Repo') {
13 steps {
14 sh '''
15 pushd $WORKSPACE
16 git clone https://gerrit.opencord.org/automation-tools
17 popd
18 '''
19 }
20 }
21
22 stage ('Install MCORD') {
23 steps {
24 sh '''
25 pushd $WORKSPACE
26 ./automation-tools/mcord/mcord-in-a-box.sh
27 popd
28 '''
29 }
30 }
Kailash Khalasib3445fa2018-06-21 17:05:56 -070031 stage ('Configure K8 Compute Node DNS') {
32 steps {
33 sh '''
34 pushd $WORKSPACE
35 HOSTNAME=\$(cat /etc/hostname)
36 IPADDRESS=\$(ip route get 8.8.8.8 | head -1 | cut -d' ' -f8)
37 cat <<EOF > /tmp/\$HOSTNAME-dns.yaml
38 kind: Service
39 apiVersion: v1
40 metadata:
41 name: \$HOSTNAME
42 namespace: default
43 spec:
44 type: ExternalName
45 externalName: \$IPADDRESS
46EOF
47 popd
48 kubectl create -f /tmp/\$HOSTNAME-dns.yaml
49 '''
50 }
51 }
Kailash Khalasie43352e2018-06-15 18:46:40 -070052
53 stage ('Test MCORD') {
54 steps {
55 sh '''
56 pushd $WORKSPACE
57 git clone https://gerrit.opencord.org/mcord
58 cd mcord/test
Kailash Khalasib3445fa2018-06-21 17:05:56 -070059 ansible-playbook -i localhost, -c local mcord-cavium-test-playbook.yml
Kailash Khalasie43352e2018-06-15 18:46:40 -070060 popd
61 '''
62 }
63 }
64 }
65
66 post {
67 always {
68 sh '''
69 pushd $WORKSPACE
70 kubectl get pods --all-namespaces
71 if [ -x "/usr/bin/helm" ]; then
72 helm list
73 helm delete --purge xos-core
74 helm delete --purge mcord
75 helm delete --purge base-openstack
Kailash Khalasib3445fa2018-06-21 17:05:56 -070076 helm delete --purge onos-cord
77
78 for NS in openstack ceph nfs libvirt; do
79 helm ls --namespace $NS --short | xargs -r -L1 -P2 helm delete --purge
80 done
81
82 # delete any helm chart left
83 helm ls --short | xargs -r -L1 -P2 helm delete --purge || true
84
85 #delete all kubectl pods
86 kubectl delete pods --all
87
88 sudo docker ps -aq | xargs -r -L1 -P16 sudo docker rm -f
89
90 sudo rm -rf /var/lib/openstack-helm/*
91
92 # NOTE(portdirect): These directories are used by nova and libvirt
93 sudo rm -rf /var/lib/nova/*
94 sudo rm -rf /var/lib/libvirt/*
95 sudo rm -rf /etc/libvirt/qemu/*
96
97 #remove all docker images
98 sudo docker rmi $(sudo docker images -q) || true
99
Kailash Khalasie43352e2018-06-15 18:46:40 -0700100 fi
Kailash Khalasib3445fa2018-06-21 17:05:56 -0700101 kubectl get pods || true
102 helm ls || true
103 sudo rm -rf $WORKSPACE/*
Kailash Khalasie43352e2018-06-15 18:46:40 -0700104 popd
105 '''
106 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
107 }
108 }
109}