3b3bb29f1f82df5ad061839bf2b7aaa91be6bc3e
[releng.git] / jjb / releng / compass4nfv-docker.yml
1 ---
2 ##############################################
3 # job configuration for docker build and push
4 ##############################################
5 - project:
6
7     name: compass-docker
8
9     project: compass-containers
10
11     stream:
12       - master:
13           branch: '{stream}'
14           disabled: false
15       - euphrates:
16           branch: 'stable/{stream}'
17           disabled: true
18
19     arch_tag:
20       - 'amd64':
21           slave_label: 'opnfv-build-ubuntu'
22
23     # yamllint disable rule:key-duplicates
24     image:
25       - 'tasks'
26       - 'cobbler'
27       - 'db'
28       - 'deck'
29       - 'tasks-k8s'
30       - 'tasks-osa'
31
32     # settings for jobs run in multijob phases
33     build-job-settings: &build-job-settings
34       current-parameters: false
35       git-revision: true
36       node-parameters: false
37       predefined-parameters: |
38         PUSH_IMAGE=$PUSH_IMAGE
39         COMMIT_ID=$COMMIT_ID
40         GERRIT_REFNAME=$GERRIT_REFNAME
41         DOCKERFILE=$DOCKERFILE
42       kill-phase-on: FAILURE
43       abort-all-jobs: false
44
45     # yamllint enable rule:key-duplicates
46     jobs:
47       - "compass-docker-{stream}"
48       - "compass-{image}-build-{arch_tag}-{stream}"
49
50 ########################
51 # job templates
52 ########################
53 - job-template:
54     name: 'compass-docker-{stream}'
55
56     project-type: multijob
57
58     disabled: '{obj:disabled}'
59
60     parameters:
61       - compass-job-parameters:
62           project: '{project}'
63           branch: '{branch}'
64           slave_label: 'opnfv-build-ubuntu'
65           arch_tag: 'amd64'
66
67     properties:
68       - throttle:
69           max-per-node: 1
70           option: 'project'
71
72     scm:
73       - git-scm
74
75     triggers:
76       - pollscm:
77           cron: "*/30 * * * *"
78
79     builders:
80       - multijob:
81           name: 'build compass-tasks images'
82           execution-type: PARALLEL
83           projects:
84             - name: 'compass-tasks-build-amd64-{stream}'
85               <<: *build-job-settings
86       - multijob:
87           name: 'build all compass images'
88           condition: SUCCESSFUL
89           execution-type: PARALLEL
90           projects:
91             - name: 'compass-cobbler-build-amd64-{stream}'
92               <<: *build-job-settings
93             - name: 'compass-db-build-amd64-{stream}'
94               <<: *build-job-settings
95             - name: 'compass-deck-build-amd64-{stream}'
96               <<: *build-job-settings
97             - name: 'compass-tasks-k8s-build-amd64-{stream}'
98               <<: *build-job-settings
99             - name: 'compass-tasks-osa-build-amd64-{stream}'
100               <<: *build-job-settings
101
102     publishers:
103       - 'compass-amd64-recipients'
104
105 - job-template:
106     name: 'compass-{image}-build-{arch_tag}-{stream}'
107     disabled: '{obj:disabled}'
108     parameters:
109       - compass-job-parameters:
110           project: '{project}'
111           branch: '{branch}'
112           slave_label: '{slave_label}'
113           arch_tag: '{arch_tag}'
114       - string:
115           name: DOCKER_REPO_NAME
116           default: "opnfv/compass-{image}"
117           description: "Dockerhub repo to be pushed to."
118       - string:
119           name: DOCKER_DIR
120           default: "compass-{image}"
121           description: "Directory containing files needed by the Dockerfile"
122     scm:
123       - git-scm
124     builders:
125       - shell:
126           !include-raw-escape: ./opnfv-docker.sh
127
128 # parameter macro
129 - parameter:
130     name: compass-job-parameters
131     parameters:
132       - project-parameter:
133           project: '{project}'
134           branch: '{branch}'
135       - label:
136           name: SLAVE_LABEL
137           default: '{slave_label}'
138           description: 'Slave label on Jenkins'
139       - string:
140           name: GIT_BASE
141           default: https://gerrit.opnfv.org/gerrit/$PROJECT
142           description: 'Git URL to use on this Jenkins Slave'
143       - string:
144           name: PUSH_IMAGE
145           default: "true"
146           description: "To enable/disable pushing the image to Dockerhub."
147       - string:
148           name: COMMIT_ID
149           default: ""
150           description: "commit id to make a snapshot docker image"
151       - string:
152           name: GERRIT_REFNAME
153           default: ""
154           description: "Docker tag to be built, e.g. refs/tags/5.0.0, refs/tags/opnfv-5.0.0, refs/tags/5.0.RC1"
155       - string:
156           name: DOCKERFILE
157           default: "Dockerfile"
158           description: "Dockerfile to use for creating the image."
159       - string:
160           name: ARCH_TAG
161           default: ""
162           description: "If set, this value will be added to the docker image tag as a prefix"
163       - string:
164           name: PROJECT
165           default: "{project}"
166           description: "Project name used to enable job conditions"
167
168 # publisher macros
169 - publisher:
170     name: 'compass-amd64-recipients'
171     publishers:
172       - email:
173           recipients: >
174             chigang@huawei.com
175             huangxiangyui5@huawei.com
176             xueyifei@huawei.com
177             wutianwei1@huawei.com