19de22d1952401157a28fc1776915ad1acd912a6
[releng/global-jjb.git] / docs / jjb / lf-ci-jobs.rst
1 #######
2 CI Jobs
3 #######
4
5 Job Groups
6 ==========
7
8 {project-name}-ci-jobs
9 ----------------------
10
11 Recommended jobs that should be deployed for CI using Gerrit.
12
13 :Includes:
14
15     - gerrit-jenkins-cfg-merge
16     - gerrit-jjb-deploy-job
17     - gerrit-jjb-merge
18     - gerrit-jjb-verify
19
20 {project-name}-github-ci-jobs
21 -----------------------------
22
23 Recommended jobs that should be deployed CI using GitHub.
24
25 :Includes:
26
27     - github-jenkins-cfg-merge
28     - github-jjb-deploy-job
29     - github-jjb-merge
30     - github-jjb-verify
31
32 {project-name}-packer-jobs
33 --------------------------
34
35 Jobs related to Packer builds for CI using Gerrit.
36
37 :Includes:
38
39     - gerrit-packer-merge
40     - gerrit-packer-verify
41
42 {project-name}-github-packer-jobs
43 ---------------------------------
44
45 Jobs related to Packer builds for CI using GitHub.
46
47 :Includes:
48
49     - github-packer-merge
50     - github-packer-verify
51
52 Macros
53 ======
54
55 lf-jenkins-cfg-global-vars
56 --------------------------
57
58 Manages the Global Jenkins variables. This macro will clear all exist macros
59 in Jenkins and replaces them with the ones defined by the
60 ci-management/jenkins-config/global-vars-SILO.sh script.
61
62 .. note::
63
64    Requires the jjbini file in Jenkins CFP to contain JJB 2.0 style
65    config definitions for "production" and "sandbox" systems.
66
67 :Required parameters:
68
69     :jenkins-silos: Space separated list of Jenkins silos to update
70         configuration for as defined in ~/.config/jenkins_jobs/jenkins_jobs.ini
71
72 lf-infra-jjbini
73 ---------------
74
75 Provides jenkins_jobs.ini configuration for Jenkins.
76
77 lf-infra-jjbini-sandbox
78 -----------------------
79
80 Provides jenkins_jobs.ini configuration for Jenkins sandbox.
81
82 .. todo:: This needs to be consolidated into lf-infra-jjbini when JJB 2.0 is available
83
84 lf-packer-verify-file-paths
85 ---------------------------
86
87 Gerrit file-paths for packer verify jobs.
88
89 lf-packer-file-paths
90 --------------------
91
92 Gerrit file-paths for packer jobs.
93
94 lf-packer-common
95 ----------------
96
97 Common packer configuration.
98
99 Job Templates
100 =============
101
102 Gerrit Branch Lock
103 ------------------
104
105 Job submits a patch to lock or unlock a project's branch.
106
107 :Template Names:
108     - {project-name}-gerrit-branch-lock-{stream}
109     - gerrit-branch-lock
110
111
112 Jenkins Configuration Merge
113 ---------------------------
114
115 Jenkins job to manage Global Jenkins configuration.
116
117 Global Environment Variables are managed via the
118 ``jenkins-config/global-vars-SILO.sh`` file in ci-management. Replace SILO with
119 the name of the Jenkins silo the variable configuration is for.
120
121 The format for this file is ``KEY=value`` for example::
122
123     GERRIT_URL=https://git.opendaylight.org/gerrit
124     GIT_BASE=git://devvexx.opendaylight.org/mirror/$PROJECT
125     GIT_URL=git://devvexx.opendaylight.org/mirror
126     JENKINS_HOSTNAME=vex-yul-odl-jenkins-2
127     LOGS_SERVER=https://logs.opendaylight.org
128     NEXUS_URL=https://nexus.opendaylight.org
129     ODLNEXUSPROXY=https://nexus.opendaylight.org
130     SILO=sandbox
131     SONAR_URL=https://sonar.opendaylight.org
132
133 .. note::
134
135    Requires the jjbini file in Jenkins CFP to contain JJB 2.0 style
136    config definitions for "production" and "sandbox" systems.
137
138 :Template names:
139
140     - {project-name}-jenkins-cfg-merge
141     - gerrit-jenkins-cfg-merge
142     - github-jenkins-cfg-merge
143
144 :Optional parameters:
145
146     :branch: Git branch to build against. (default: master)
147     :cron: How often to run the job on a cron schedule. (default: @daily)
148     :git-url: URL to clone project from. (default: $GIT_URL/$GERRIT_PROJECT)
149     :jenkins-silos: Space separated list of Jenkins silos to update
150         configuration for as defined in ~/.config/jenkins_jobs/jenkins_jobs.ini
151         (default: production sandbox)
152
153 Typically this template is automatically pulled in by the
154 "{project-name}-ci-jobs" job-group and does not need to be explicitly called if
155 the job group is being used.
156
157 Miniaml Example:
158
159 .. literalinclude:: ../../.jjb-test/lf-ci-jobs/jenkins-cfg-merge-minimal.yaml
160    :language: yaml
161
162 Full Example:
163
164 .. literalinclude:: ../../.jjb-test/lf-ci-jobs/jenkins-cfg-merge-full.yaml
165    :language: yaml
166
167
168 JJB Deploy Job
169 --------------
170
171 Deploy jobs to jenkins-sandbox system via code review comment
172
173 This job checks out the current code review patch and then runs a
174 `jenkins-jobs update` to push a patch defined by the comment.
175
176 :Template names:
177
178     - {project-name}-jjb-deploy-job
179     - gerrit-jjb-deploy-job
180     - github-jjb-deploy-job
181
182 :Comment Trigger: jjb-deploy JOB_NAME
183
184     .. note::
185
186        JOB_NAME can include the * wildcard character to push multiple jobs
187        matching the pattern. For example `jjb-deploy builder-jjb-*`` will push
188        all builder-jjb-* jobs to the sandbox system.
189
190 :Required parameters:
191
192     :build-node: The node to run build on.
193     :jenkins-ssh-credential: Credential to use for SSH. (Generally
194         should be configured in defaults.yaml)
195
196 :Optional parameters:
197
198     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
199     :gerrit_jjb_deploy_job_triggers: Override Gerrit Triggers.
200
201
202 JJB Merge
203 ---------
204
205 Runs `jenkins-jobs update` to update production job configuration
206
207 :Template Names:
208     - {project-name}-jjb-merge
209     - gerrit-jjb-merge
210     - github-jjb-merge
211
212 :Required parameters:
213
214     :build-node: The node to run build on.
215     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
216         be configured in defaults.yaml)
217     :mvn-settings: The name of settings file containing credentials for
218         the project.
219
220 :Optional parameters:
221
222     :branch: Git branch to fetch for the build. (default: master)
223     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
224     :build-timeout: Timeout in seconds before aborting build. (default: 10)
225     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
226     :stream: Keyword that can be used to represent a release code-name.
227         Often the same as the branch. (default: master)
228     :submodule-recursive: Whether to checkout submodules recursively.
229         (default: true)
230
231     :gerrit_merge_triggers: Override Gerrit Triggers.
232     :gerrit_trigger_file_paths: Override file paths which can be used to
233         filter which file modifications will trigger a build.
234         (default defined by lf_jjb_common)
235
236
237 JJB Verify
238 ----------
239
240 Runs `jenkins-jobs test` to validate JJB syntax
241
242 :Template Names:
243     - {project-name}-jjb-verify
244     - gerrit-jjb-verify
245     - github-jjb-verify
246
247 :Required parameters:
248
249     :build-node: The node to run build on.
250     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
251         be configured in defaults.yaml)
252     :mvn-settings: The name of settings file containing credentials for
253         the project.
254
255 :Optional parameters:
256
257     :branch: Git branch to fetch for the build. (default: master)
258     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
259     :build-timeout: Timeout in seconds before aborting build. (default: 10)
260     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
261     :stream: Keyword that can be used to represent a release code-name.
262         Often the same as the branch. (default: master)
263     :submodule-recursive: Whether to checkout submodules recursively.
264         (default: true)
265
266     :gerrit_verify_triggers: Override Gerrit Triggers.
267     :gerrit_trigger_file_paths: Override file paths which can be used to
268         filter which file modifications will trigger a build.
269         (default defined by lf_jjb_common)
270
271
272 Packer Merge
273 ------------
274
275 Packer Merge job runs `packer build` to build system images in the cloud.
276
277 :Template Names:
278     - {project-name}-packer-merge-{platforms}-{templates}
279     - gerrit-packer-merge
280     - github-packer-merge
281
282 :Required parameters:
283
284     :build-node: The node to run build on.
285     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
286         be configured in defaults.yaml)
287     :mvn-settings: The name of settings file containing credentials for
288         the project.
289     :platforms: Platform or distribution to build. Typically json file
290         found in the packer/vars directory. (Example: centos)
291     :template: System template to build. Typically shell script found in
292         the packer/provision directory. (Example: java-builder)
293
294 :Optional parameters:
295
296     :branch: Git branch to fetch for the build. (default: master)
297     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
298     :build-timeout: Timeout in seconds before aborting build. (default: 10)
299     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
300     :packer-cloud-settings: Name of settings file containing credentials
301         for the cloud that packer will build on. (default: packer-cloud-env)
302     :packer-version: Version of packer to install / use in build. (default: 1.0.2)
303     :stream: Keyword that can be used to represent a release code-name.
304         Often the same as the branch. (default: master)
305     :submodule-recursive: Whether to checkout submodules recursively.
306         (default: true)
307
308     :gerrit_verify_triggers: Override Gerrit Triggers.
309
310
311 Packer Verify
312 -------------
313
314 Packer Verify job runs `packer validate` to verify packer configuration.
315
316 :Template Names:
317     - {project-name}-packer-verify
318     - gerrit-packer-verify
319     - github-packer-verify
320
321 :Required parameters:
322
323     :build-node: The node to run build on.
324     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
325         be configured in defaults.yaml)
326     :mvn-settings: The name of settings file containing credentials for
327         the project.
328
329 :Optional parameters:
330
331     :branch: Git branch to fetch for the build. (default: master)
332     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
333     :build-timeout: Timeout in seconds before aborting build. (default: 10)
334     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
335     :packer-cloud-settings: Name of settings file containing credentials
336         for the cloud that packer will build on. (default: packer-cloud-env)
337     :packer-version: Version of packer to install / use in build. (default: 1.0.2)
338     :stream: Keyword that can be used to represent a release code-name.
339         Often the same as the branch. (default: master)
340     :submodule-recursive: Whether to checkout submodules recursively.
341         (default: true)
342
343     :gerrit_verify_triggers: Override Gerrit Triggers.
344     :gerrit_trigger_file_paths: Override file paths which can be used to
345         filter which file modifications will trigger a build.