Fix SCM macro usage of refspec, branches
[ci-management.git] / jjb / akraino-templates / akraino-iec-templates.yaml
1 ---
2 - job-template:
3     id: akraino-iec-install
4     name: 'iec-{iecType}-{installer}-{deploy_type}-{os}-daily-{stream}'
5     disabled: '{obj:disabled}'
6     concurrent: false
7     node: '{slave-label}'
8     properties:
9       - throttle:
10           enabled: true
11           max-total: 4
12           max-per-node: 1
13           option: 'project'
14       - build-blocker:
15           use-build-blocker: true
16           blocking-jobs:
17             - '.*-fuel-{deploy_type}-.*'
18             - '.*-compass-{deploy_type}-.*'
19           block-level: 'NODE'
20
21     wrappers:
22       - build-name:
23           name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO $IEC_TYPE'
24
25     triggers:
26       - 'iec-{iecType}-{installer}-{deploy_type}-{os}-daily-{stream}-trigger'
27
28     parameters:
29       - lf-infra-parameters:
30           project: '{project}'
31           stream: '{stream}'
32           branch: '{branch}'
33       - '{project}-defaults'
34       - '{installer}-{os}-defaults'
35       - string:
36           name: DEPLOY_SCENARIO
37           default: '{scenario}'
38       - string:
39           name: IEC_TYPE
40           default: '{iecType}'
41
42     builders:
43       - trigger-builds:
44           - project: 'iec-{iecType}-deploy-{installer}-{deploy_type}-{os}-daily-{stream}'
45             current-parameters: true
46             predefined-parameters:
47               DEPLOY_SCENARIO={scenario}
48             same-node: true
49             block: true
50           - project: 'validation-enea-daily-{stream}'
51             same-node: true
52             current-parameters: true
53             predefined-parameters: |
54               CLUSTER_MASTER_IP=$K8S_MASTER_IP
55               CLUSTER_SSH_USER=$K8S_SSH_USER
56               CLUSTER_SSH_PASSWORD=$K8S_SSH_PASSWORD
57               CLUSTER_SSH_KEY=$K8S_SSH_KEY
58               BLUEPRINT={project-name}
59               VERSION=master
60               OPTIONAL=false
61             block: true
62           - project:
63               !j2: |
64                 {%- if deploy_type not in ['virtual'] -%}
65                 {%- for uc in usecase -%}
66                 {%- for ph in phase -%}
67                 iec-{{ iecType }}-{{ ph }}-{{ uc }}-{{ installer }}-{{ deploy_type }}-{{ os }}-daily-{{ stream }}
68                 {%- if not loop.last -%},{%- endif -%}
69                 {%- endfor %}
70                 {%- if not loop.last -%},{%- endif -%}
71                 {%- endfor %}
72                 {%- endif -%}
73             current-parameters: true
74             same-node: true
75             block: true
76             block-thresholds:
77               build-step-failure-threshold: 'never'
78               failure-threshold: 'never'
79               unstable-threshold: 'FAILURE'
80           - project: 'iec-{iecType}-destroy-{installer}-{deploy_type}-{os}-daily-{stream}'
81             current-parameters: false
82             predefined-parameters: |
83               DEPLOY_SCENARIO={scenario}
84               IEC_TYPE={iecType}
85             same-node: true
86             block: true
87
88 - job-template:
89     id: akraino-iec-deploy
90     name: 'iec-{iecType}-deploy-{installer}-{deploy_type}-{os}-daily-{stream}'
91     concurrent: true
92     node: '{slave-label}'
93     properties: &properties
94       - throttle:
95           enabled: true
96           max-total: 4
97           max-per-node: 1
98           option: 'project'
99       - build-blocker:
100           use-build-blocker: true
101           blocking-jobs:
102             - '.*-{iecType}-deploy-{installer}-{deploy_type}-.*'
103             - '.*-{iecType}-destroy-{installer}-{deploy_type}-.*'
104             - '.*-{iecType}-install-.*-{installer}-{deploy_type}-.*'
105           block-level: 'NODE'
106
107     parameters:
108       - lf-infra-parameters:
109           project: '{project}'
110           stream: '{stream}'
111           branch: '{branch}'
112       - '{project}-defaults'
113       - '{installer}-{os}-defaults'
114       - string:
115           name: DEPLOY_SCENARIO
116           default: '{scenario}'
117       - string:
118           name: IEC_TYPE
119           default: '{iecType}'
120       - string:
121           name: EXTRA_ARGS
122           default: '-o {os}'
123
124     wrappers: &wrappers
125       - build-name:
126           name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO $IEC_TYPE'
127
128     scm: &scm
129       - lf-infra-gerrit-scm:
130           jenkins-ssh-credential: '{jenkins-ssh-credential}'
131           git-url: '{git-url}/{project}.git'
132           refspec: '$GERRIT_REFSPEC'
133           branch: '$GERRIT_BRANCH'
134           submodule-recursive: false
135           submodule-timeout: '{submodule-timeout}'
136           submodule-disable: true
137           choosing-strategy: default
138
139     builders:
140       - description-setter:
141           description: "POD: $NODE_NAME"
142       - conditional-step:
143           condition-kind: regex-match
144           regex: 'compass'
145           label: '{installer}'
146           steps:
147             - shell:
148                 !include-raw-escape: ../iec/iec-compass-build.sh
149             - shell:
150                 !include-raw-escape: ../iec/iec-compass-deploy.sh
151             - shell:
152                 !include-raw-escape: ../iec/iec-fdn-install.sh
153       - conditional-step:
154           condition-kind: regex-match
155           regex: 'fuel'
156           label: '{installer}'
157           steps:
158             - shell:
159                 !include-raw-escape: ../iec/iec-fuel-deploy.sh
160
161     publishers: &publishers
162       - email:
163           recipients: armband@enea.com
164       - lf-infra-publish
165
166 - job-template:
167     id: akraino-iec-destroy
168     name: 'iec-{iecType}-destroy-{installer}-{deploy_type}-{os}-daily-{stream}'
169     concurrent: true
170     node: '{slave-label}'
171     properties: *properties
172     parameters:
173       - lf-infra-parameters:
174           project: '{project}'
175           stream: '{stream}'
176           branch: '{branch}'
177       - '{project}-defaults'
178       - '{installer}-{os}-defaults'
179       - string:
180           name: DEPLOY_SCENARIO
181           default: '{scenario}'
182       - string:
183           name: IEC_TYPE
184           default: '{iecType}'
185       - string:
186           name: EXTRA_ARGS
187           default: '-EEE -o {os}'
188
189     wrappers: *wrappers
190     scm: *scm
191
192     builders:
193       - description-setter:
194           description: "POD: $NODE_NAME"
195       - shell:
196           !include-raw-escape: ../iec/iec-{installer}-destroy.sh
197
198     publishers: *publishers
199
200 - job-template:
201     id: akraino-iec-phase-usecase
202     name: 'iec-{iecType}-{phase}-{usecase}-{installer}-{deploy_type}-{os}-daily-{stream}'
203     concurrent: true
204     node: '{slave-label}'
205     properties: *properties
206
207     parameters:
208       - lf-infra-parameters:
209           project: '{project}'
210           stream: '{stream}'
211           branch: '{branch}'
212       - '{project}-defaults'
213       - '{installer}-{os}-defaults'
214       - '{usecase}-defaults'
215
216     wrappers:
217       - build-name:
218           name: '$BUILD_NUMBER - Usecase: ${usecase} DeployType: ${installer}-${deploy_type}'
219
220     scm: *scm
221
222     builders:
223       - shell:
224           !include-raw-escape: ../iec/iec-{usecase}.sh
225
226     publishers: *publishers