Enable qtip daily test job in zte-pod1
[releng.git] / jjb / qtip / qtip-ci-jobs.yml
1 ####################################
2 # job configuration for qtip
3 ####################################
4 - project:
5     name: qtip-ci-jobs
6
7     project: 'qtip'
8
9 #--------------------------------
10 # BRANCH ANCHORS
11 #--------------------------------
12     master: &master
13         stream: master
14         branch: '{stream}'
15         gs-pathname: ''
16     brahmaputra: &brahmaputra
17         stream: brahmaputra
18         branch: 'stable/{stream}'
19         gs-pathname: '{stream}'
20 #--------------------------------
21 # POD, INSTALLER, AND BRANCH MAPPING
22 #--------------------------------
23 #        brahmaputra
24 #--------------------------------
25     pod:
26         - dell-pod1:
27             installer: compass
28             auto-trigger-name: 'qtip-daily-dell-pod1-trigger'
29             <<: *brahmaputra
30         - orange-pod2:
31             installer: joid
32             auto-trigger-name: 'daily-trigger-disabled'
33             <<: *brahmaputra
34 #--------------------------------
35 #        master
36 #--------------------------------
37         - juniper-pod1:
38             installer: joid
39             <<: *master
40             auto-trigger-name: 'daily-trigger-disabled'
41         - zte-pod1:
42             installer: fuel
43             auto-trigger-name: 'qtip-daily-zte-pod1-trigger'
44             <<: *master
45
46 #--------------------------------
47     jobs:
48         - 'qtip-{installer}-{pod}-daily-{stream}'
49
50 ################################
51 # job templates
52 ################################
53 - job-template:
54     name: 'qtip-{installer}-{pod}-daily-{stream}'
55
56     disabled: false
57
58     parameters:
59         - project-parameter:
60             project: '{project}'
61         - '{pod}-defaults'
62         - '{installer}-defaults'
63         - string:
64             name: DEPLOY_SCENARIO
65             default: 'os-nosdn-nofeature-ha'
66
67     scm:
68         - git-scm:
69               credentials-id: '{ssh-credentials}'
70               refspec: ''
71               branch: '{branch}'
72
73     triggers:
74         - '{auto-trigger-name}'
75
76     builders:
77         - 'qtip-cleanup'
78         - 'qtip-set-env'
79         - 'qtip-run-suite'
80         - 'qtip-pushtoDB'
81
82     publishers:
83         - email:
84             recipients: nauman.ahad@xflowresearch.com, mofassir.arif@xflowresearch.com, vikram@nvirters.com
85
86 ###########################
87 #biuilder macros
88 ###########################
89 - builder:
90     name: qtip-set-env
91     builders:
92         - shell: |
93             #!/bin/bash
94             echo "Qtip: Start Docker and prepare environment"
95             envs="INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} -e NODE_NAME=${NODE_NAME}"
96             suite="TEST_CASE=all"
97             docker pull opnfv/qtip:latest
98             cmd=" docker run -id -e $envs -e $suite opnfv/qtip:latest /bin/bash"
99             echo "Qtip: Running docker run command: ${cmd}"
100             ${cmd}
101             docker ps -a
102             container_id=$(docker ps | grep 'opnfv/qtip:latest' | awk '{print $1}' | head -1)
103              if [ $(docker ps | grep 'opnfv/qtip' | wc -l) == 0 ]; then
104                 echo "The container opnfv/qtip with ID=${container_id} has not been properly started. Exiting..."
105                 exit 1
106             fi
107 - builder:
108     name: qtip-run-suite
109     builders:
110         - shell: |
111             #!/bin/bash
112             container_id=$(docker ps | grep 'opnfv/qtip:latest' | awk '{print $1}' | head -1)
113             if [[ ! -z ${container_id} ]]; then
114                 echo "The container ID is: ${container_id}"
115                 QTIP_REPO=/home/opnfv/repos/qtip
116                 docker exec -t ${container_id} $QTIP_REPO/docker/run_qtip.sh
117             else
118                 echo "Container ID not available"
119             fi
120
121 - builder:
122     name: qtip-pushtoDB
123     builders:
124         - shell: |
125             #!/bin/bash
126
127             echo "Pushing available results to DB"
128             echo "The container id is:"
129             container_id=$(docker ps | grep 'opnfv/qtip:latest' | awk '{print $1}' | head -1)
130             if [[ ! -z ${container_id} ]]; then
131                 echo "The condiner ID is: ${container_id}"
132                 QTIP_REPO=/home/opnfv/repos/qtip
133                 docker exec -t ${container_id} $QTIP_REPO/docker/push_db.sh
134             else
135                 echo "Container ID not available"
136             fi
137
138 - builder:
139     name: qtip-cleanup
140     builders:
141         - shell: |
142             #!/bin/bash
143
144             echo "Cleaning up QTIP  docker containers/images..."
145             # Remove previous running containers if exist
146             if [[ ! -z $(docker ps -a | grep opnfv/qtip) ]]; then
147                 echo "Removing existing opnfv/qtip containers..."
148                 running_containers=$(docker ps | grep opnfv/qtip | awk '{print $1}')
149                 docker stop ${running_containers}
150                 all_containers=$(docker ps -a | grep opnfv/qtip | awk '{print $1}')
151                 docker rm ${all_containers}
152             fi
153
154             # Remove existing images if exist
155             if [[ ! -z $(docker images | grep opnfv/qtip) ]]; then
156                 echo "Docker images to remove:"
157                 docker images | head -1 && docker images | grep opnfv/qtip
158                 image_tags=($(docker images | grep opnfv/qtip | awk '{print $2}'))
159                 for tag in "${image_tags[@]}"; do
160                     echo "Removing docker image opnfv/qtip:$tag..."
161                     docker rmi opnfv/qtip:$tag
162                 done
163             fi
164
165 #################
166 #trigger macros
167 #################
168
169 - trigger:
170     name: 'qtip-daily-dell-pod1-trigger'
171     triggers:
172         - timed: '0 3 * * *'
173
174 #- trigger:
175 #    name: 'qtip-daily-juniper-pod1-trigger'
176 #    triggers:
177 #        - timed : '0 0 * * *'
178
179 #- trigger:
180 #   name: 'qtip-dailty-orange-pod2-trigger'
181 #   triggers:
182 #       - timed : ' 0 0 * * *'
183
184 - trigger:
185     name: 'qtip-daily-zte-pod1-trigger'
186     triggers:
187         - timed: '0 5 * * *'