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