21725ea9823ded20b041c4877902a4fc5496d373
[releng.git] / jjb / releng / opnfv-utils.yaml
1 ---
2 - project:
3
4     name: opnfv-utils
5
6     jobs:
7       - 'prune-docker-images'
8       - 'check-status-of-slaves'
9       - 'ansible-build-server'
10       - 'generate-artifacts-index-pages'
11
12 ########################
13 # job templates
14 ########################
15 - job-template:
16     name: 'prune-docker-images'
17
18     disabled: false
19
20     concurrent: true
21
22     parameters:
23       - node:
24           name: SLAVE_NAME
25           description: Slaves to prune docker images
26           default-slaves:
27             - lf-build5
28             - lf-build6
29           allowed-multiselect: true
30           ignore-offline-nodes: true
31
32     builders:
33       - description-setter:
34           description: "Built on $NODE_NAME"
35       # yamllint disable rule:line-length
36       - shell: |
37           #!/bin/bash
38           sudo systemctl restart docker
39           (docker ps -q; docker ps -aq) | sort | uniq -u | xargs --no-run-if-empty docker rm
40           docker images -f dangling=true -q | xargs --no-run-if-empty docker rmi
41
42
43     # yamllint enable rule:line-length
44     triggers:
45       - timed: '@midnight'
46
47 - job-template:
48     name: 'check-status-of-slaves'
49
50     disabled: false
51     concurrent: true
52
53     parameters:
54       - node:
55           name: SLAVE_NAME
56           description: 'script lives on master node'
57           default-slaves:
58             - lf-build5
59           allowed-multiselect: false
60           ignore-offline-nodes: true
61       - project-parameter:
62           project: releng
63           branch: master
64
65     scm:
66       - git-scm
67
68     triggers:
69       - timed: '@midnight'
70
71     builders:
72       - shell: |
73           cd $WORKSPACE/utils/
74           bash slave-monitor-0.1.sh
75
76 - job-template:
77     name: 'ansible-build-server'
78
79     project-type: freestyle
80
81     disabled: true
82     concurrent: true
83
84     parameters:
85       - node:
86           name: SLAVE_NAME
87           description: Build Servers
88           default-slaves:
89             - lf-build5
90             - lf-build6
91           allowed-multiselect: true
92           ignore-offline-nodes: true
93       - project-parameter:
94           project: releng
95           branch: master
96
97     scm:
98       - git-scm
99
100     triggers:
101       - timed: '@midnight'
102
103     builders:
104       - description-setter:
105           description: '$NODE_NAME'
106       - install-ansible
107       - run-ansible-build-server-playbook
108
109
110 - builder:
111     name: install-ansible
112     builders:
113       - shell: |
114           # Install ansible here
115           if [ -f /etc/centos-release ] \
116           || [ -f /etc/redhat-release ] \
117           || [ -f /etc/system-release ]; then
118           sudo yum -y install ansible
119           fi
120           if [ -f /etc/debian_version ] \
121           || grep -qi ubuntu /etc/lsb-release \
122           || grep -qi ubuntu /etc/os-release; then
123           sudo apt-get -y install ansible
124           fi
125
126
127 - builder:
128     name: run-ansible-build-server-playbook
129     builders:
130       - shell: |
131           # run playbook
132           sudo ansible-playbook -i \
133           $WORKSPACE/utils/build-server-ansible/inventory.ini \
134           $WORKSPACE/utils/build-server-ansible/main.yml
135
136
137 - job-template:
138     name: 'generate-artifacts-index-pages'
139
140     project-type: freestyle
141
142     disabled: false
143
144     concurrent: false
145
146     parameters:
147       - node:
148           name: SLAVE_NAME
149           description: Build Servers
150           default-slaves:
151             - lf-build5
152       - project-parameter:
153           project: releng
154           branch: master
155
156     scm:
157       - git-scm
158
159     triggers:
160       - timed: '@hourly'
161
162     builders:
163       - generate-artifact-html
164
165
166 - builder:
167     name: generate-artifact-html
168     builders:
169       - shell: |
170           cd $WORKSPACE/utils/
171           ./artifacts.opnfv.org.sh