1e48683fefcbcbd1433e0f4c301ea6fdeeda92a5
[ci-management.git] / jjb / akraino-templates / akraino-jjb-kni.yaml
1 ---
2 #
3 # Copyright (c) 2019 Red Hat. All rights reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
6 # not use this file except in compliance with the License.
7 #
8 # You may obtain a copy of the License at
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17
18 # A builder to ship logs from a bare metal Akraino deploy test node.
19 # Similar to lf-infra-ship-logs without python-tools-install.sh and
20 # job-cost.sh.
21 - builder:
22     name: kni-deploy-ship-logs
23     builders:
24       # Ensure no pre-existing .netrc files are overriding logs config
25       - lf-provide-maven-settings-cleanup
26       - config-file-provider:
27           files:
28             - file-id: "jenkins-log-archives-settings"
29               variable: "SETTINGS_FILE"
30       - lf-infra-create-netrc:
31           server-id: logs
32       - shell: !include-raw:
33           - ../../global-jjb/shell/logs-deploy.sh
34       - shell: !include-raw:
35           - ../../global-jjb/shell/logs-clear-credentials.sh
36       - description-setter:
37           regexp: "(^(Nexus|S3) build logs: .*)"
38
39 - kni_common: &kni_common
40     name: kni-common
41
42     ######################
43     # Default parameters #
44     ######################
45
46     build-node: "{build-node}"
47     build-days-to-keep: 30
48     build-timeout: 60
49     submodule-recursive: true
50     gerrit_trigger_file_paths: "{obj:gerrit_trigger_file_paths}"
51
52     #####################
53     # Job Configuration #
54     #####################
55
56     project-type: freestyle
57     node: "{build-node}"
58     properties:
59       - lf-infra-properties:
60           build-days-to-keep: '{build-days-to-keep}'
61
62     parameters:
63       - lf-infra-parameters:
64           project: '{project}'
65           branch: '{branch}'
66           stream: '{stream}'
67           lftools-version: '{lftools-version}'
68
69     wrappers:
70       - lf-infra-wrappers:
71           build-timeout: '{build-timeout}'
72           jenkins-ssh-credential: '{jenkins-ssh-credential}'
73
74     scm:
75       - lf-infra-gerrit-scm:
76           jenkins-ssh-credential: '{jenkins-ssh-credential}'
77           git-url: '{git-url}/{project}.git'
78           refspec: '$GERRIT_REFSPEC'
79           branch: '$GERRIT_BRANCH'
80           submodule-recursive: '{submodule-recursive}'
81           submodule-timeout: '{submodule-timeout}'
82           submodule-disable: false
83           choosing-strategy: default
84
85     gerrit_verify_triggers:
86       - patchset-created-event:
87           exclude-drafts: true
88           exclude-trivial-rebase: false
89           exclude-no-code-change: false
90       - draft-published-event
91       - comment-added-contains-event:
92           comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
93
94     triggers:
95       - gerrit:
96           server-name: '{gerrit-server-name}'
97           trigger-on: '{obj:gerrit_verify_triggers}'
98           projects:
99             - project-compare-type: ANT
100               project-pattern: '{project}'
101               branches:
102                 - branch-compare-type: ANT
103                   branch-pattern: '**/{branch}'
104               file-paths: '{obj:gerrit_trigger_file_paths}'
105     publishers:
106       - lf-infra-publish
107
108 - kni_common_deploy: &kni_common_deploy
109     name: kni-common-deploy
110     <<: *kni_common
111     archive-artifacts: >
112       **/*.log
113
114     parameters:
115       - lf-infra-parameters:
116           project: '{project}'
117           branch: '{branch}'
118           stream: '{stream}'
119           lftools-version: '{lftools-version}'
120       - string:
121           name: ARCHIVE_ARTIFACTS
122           default: '{archive-artifacts}'
123           description: Artifacts to archive to the logs server.
124
125     wrappers:
126       - lf-infra-wrappers:
127           build-timeout: '{build-timeout}'
128           jenkins-ssh-credential: '{jenkins-ssh-credential}'
129       - credentials-binding:
130           - ssh-user-private-key:
131               credential-id: kni-secrets
132               key-file-variable: KNI_KEY_PATH
133     scm:
134       - akraino-lf-infra-gerrit-scm:
135           jenkins-ssh-credential: '{jenkins-ssh-credential}'
136           git-url: '{git-url}/{project}.git'
137           refspec: '$GERRIT_REFSPEC'
138           branch: '$GERRIT_BRANCH'
139           submodule-recursive: '{submodule-recursive}'
140           submodule-timeout: '{submodule-timeout}'
141           submodule-disable: false
142           choosing-strategy: default
143           basedir: '{project-name}'
144       - akraino-lf-infra-gerrit-scm:
145           jenkins-ssh-credential: '{jenkins-ssh-credential}'
146           git-url: '{git-url}/kni/installer.git'
147           refspec: 'refs/heads/master'
148           branch: 'master'
149           submodule-recursive: '{submodule-recursive}'
150           submodule-timeout: '{submodule-timeout}'
151           submodule-disable: false
152           choosing-strategy: default
153           basedir: 'installer'
154
155     publishers:
156       - postbuildscript:
157           builders:
158             - role: BOTH
159               build-on:
160                 - ABORTED
161                 - FAILURE
162                 - NOT_BUILT
163                 - SUCCESS
164                 - UNSTABLE
165               build-steps:
166                 - kni-deploy-ship-logs
167           mark-unstable-if-failed: true
168       - workspace-cleanup:
169           exclude:
170             # Do not clean up *.jenkins-trigger files for jobs that use a
171             # properties file as input for triggering another build.
172             - "**/*.jenkins-trigger"
173           fail-build: false
174
175 - job-template:
176     id: kni-installer-verify-installer
177     name: '{project-name}-verify-installer'
178     gerrit_trigger_file_paths:
179       - compare-type: ANT
180         pattern: '**'
181     <<: *kni_common
182     build-node: centos7-builder-2c-1g
183
184     builders:
185       - lf-infra-pre-build
186       - shell: !include-raw-escape:
187           - ../shell/install_go.sh
188       - shell: !include-raw-escape:
189           - ../shell/build_kni_installer.sh
190
191 - job-template:
192     id: kni-verify-deploy-aws
193     name: 'kni-{project-name}-verify-deploy-aws'
194     build-node: kni-cloud
195     <<: *kni_common_deploy
196
197     gerrit_trigger_file_paths:
198       - compare-type: ANT
199         pattern: 'profiles/production.aws/**'
200       - compare-type: ANT
201         pattern: 'sites/testing.aws.edge-sites.net/**'
202       - compare-type: ANT
203         pattern: 'base/**'
204
205     builders:
206       - lf-infra-pre-build
207       - config-file-provider:
208           files:
209             - file-id: kni-coreos-pull-secret
210               target: akraino-secrets/coreos-pull-secret
211       - shell: !include-raw-escape:
212           - ../shell/install_go.sh
213       - shell: ./installer/ci/kni_deploy_aws.sh
214
215 - job-template:
216     id: kni-verify-deploy-gcp
217     name: 'kni-{project-name}-verify-deploy-gcp'
218     build-node: kni-cloud
219     <<: *kni_common_deploy
220
221     gerrit_trigger_file_paths:
222       - compare-type: ANT
223         pattern: 'profiles/production.gcp/**'
224       - compare-type: ANT
225         pattern: 'sites/testing.gcp.edge-sites.net/**'
226       - compare-type: ANT
227         pattern: 'base/**'
228
229     builders:
230       - lf-infra-pre-build
231       - config-file-provider:
232           files:
233             - file-id: kni-coreos-pull-secret
234               target: akraino-secrets/coreos-pull-secret
235       - shell: !include-raw-escape:
236           - ../shell/install_go.sh
237       - shell: ./installer/ci/kni_deploy_gcp.sh
238
239 - job-template:
240     id: kni-verify-deploy-baremetal
241     name: 'kni-{project-name}-verify-deploy-baremetal'
242     <<: *kni_common_deploy
243     build-timeout: 120
244     build-node: kni-baremetal
245
246     gerrit_trigger_file_paths:
247       - compare-type: ANT
248         pattern: 'profiles/production.baremetal/**'
249       - compare-type: ANT
250         pattern: 'sites/testing.baremetal.edge-sites.net/**'
251       - compare-type: ANT
252         pattern: 'base/**'
253
254     scm:
255       - akraino-lf-infra-gerrit-scm:
256           jenkins-ssh-credential: '{jenkins-ssh-credential}'
257           git-url: 'https://gerrit.akraino.org/r/kni/blueprint-pae'
258           refspec: '$GERRIT_REFSPEC'
259           branch: '$GERRIT_BRANCH'
260           submodule-recursive: '{submodule-recursive}'
261           submodule-timeout: '{submodule-timeout}'
262           submodule-disable: false
263           choosing-strategy: default
264           basedir: 'kni-blueprint-pae'
265       - akraino-lf-infra-gerrit-scm:
266           jenkins-ssh-credential: '{jenkins-ssh-credential}'
267           git-url: '{git-url}/kni/installer.git'
268           refspec: 'refs/heads/master'
269           branch: 'master'
270           submodule-recursive: '{submodule-recursive}'
271           submodule-timeout: '{submodule-timeout}'
272           submodule-disable: false
273           choosing-strategy: default
274           basedir: 'installer'
275
276     builders:
277       - lf-infra-pre-build
278       - config-file-provider:
279           files:
280             - file-id: kni-coreos-pull-secret
281               target: akraino-secrets/coreos-pull-secret
282             - file-id: kni-ssh-pub-key
283               target: akraino-secrets/ssh-pub-key
284       - shell: sudo -E ./installer/ci/kni_deploy_baremetal.sh