Add sonar-project-file parameter to ci sonar jobs
[releng/global-jjb.git] / docs / jjb / lf-ci-jobs.rst
1 #######
2 CI Jobs
3 #######
4
5 Job Groups
6 ==========
7
8 .. include:: ../job-groups.rst
9
10 Below is a list of CI job groups:
11
12 .. literalinclude:: ../../jjb/lf-ci-job-groups.yaml
13    :language: yaml
14
15
16 Macros
17 ======
18
19 lf-infra-jjb-parameters
20 -----------------------
21
22 :Required Parameters:
23
24     :jjb-cache: Location of Jenkins Job Builder (JJB) cache used for jjb
25         jobs.
26     :jjb-version: Version of Jenkins Job Builder (JJB) to install and use in
27         the jjb jobs.
28
29 lf-jenkins-cfg-clouds
30 ---------------------
31
32 Deploys Jenkins Cloud configuration read from the ``jenkins-clouds`` directory
33 in ci-management repositories.
34
35 .. note::
36
37    Requires the jjbini file in Jenkins CFP to contain JJB 2.0 style
38    config definitions for "production" and "sandbox" systems.
39
40 :Required Parameters:
41
42     :jenkins-silos: Space-separated list of Jenkins silos to update
43         configuration for as defined in ~/.config/jenkins_jobs/jenkins_jobs.ini
44
45 lf-jenkins-cfg-global-vars
46 --------------------------
47
48 Manages the Global Jenkins variables. This macro will clear all exist macros
49 in Jenkins and replaces them with the ones defined by the
50 ci-management/jenkins-config/global-vars-SILO.sh script.
51
52 .. note::
53
54    Requires the jjbini file in Jenkins CFP to contain JJB 2.0 style
55    config definitions for "production" and "sandbox" systems.
56
57 :Required parameters:
58
59     :jenkins-silos: Space-separated list of Jenkins silos to update
60         configuration for as defined in ~/.config/jenkins_jobs/jenkins_jobs.ini
61
62 lf-infra-jjbini
63 ---------------
64
65 Provides jenkins_jobs.ini configuration for Jenkins.
66
67 lf-packer-common
68 ----------------
69
70 Common packer configuration.
71
72 lf-packer-file-paths
73 --------------------
74
75 Gerrit file-paths for packer jobs.
76
77 lf-packer-parameters
78 --------------------
79
80 Parameters useful for packer related tasks.
81
82 :Parameters:
83
84     :packer-version: Version of packer to install / use.
85         (shell: PACKER_VERSION)
86
87 lf-packer-verify-file-paths
88 ---------------------------
89
90 Gerrit file-paths for packer verify jobs.
91
92 lf-puppet-parameters
93 --------------------
94
95 Parameters useful for Puppet related tasks.
96
97 :Parameters:
98
99     :puppet-lint-version: Version of puppet-lint to install / use.
100         (shell: PUPPET_LINT_VERSION)
101
102 Job Templates
103 =============
104
105 .. _gerrit-branch-lock:
106
107 Gerrit Branch Lock
108 ------------------
109
110 Job submits a patch to lock or unlock a project's branch.
111
112 :Template Names:
113     - {project-name}-gerrit-branch-lock-{stream}
114     - gerrit-branch-lock
115
116 :Comment Trigger:
117
118     * lock branch
119     * unlock branch
120
121 :Required parameters:
122
123     :build-node: The node to run build on.
124     :jenkins-ssh-credential: Credential to use for SSH. (Generally
125         should be configured in defaults.yaml)
126
127 :Optional parameters:
128
129     :branch: Git branch to build against. (default: master)
130     :git-url: URL to clone project from. (default: $GIT_URL/$GERRIT_PROJECT)
131     :stream: Keyword that can be used to represent a release code-name.
132         Often the same as the branch. (default: master)
133     :submodule-timeout: Timeout (in minutes) for checkout operation.
134         (default: 10)
135     :submodule-disable: Disable submodule checkout operation.
136         (default: false)
137     :gerrit_merge_triggers: Override Gerrit Triggers.
138
139 .. _lf-global-jjb-jenkins-cfg-merge:
140
141 Jenkins Configuration Merge
142 ---------------------------
143
144 Jenkins job to manage Global Jenkins configuration.
145
146 .. note::
147
148    Requires the jjbini file in Jenkins CFP to contain JJB 2.0 style
149    config definitions for "production" and "sandbox" systems.
150
151 :Template names:
152
153     - {project-name}-jenkins-cfg-merge
154     - gerrit-jenkins-cfg-merge
155     - github-jenkins-cfg-merge
156
157 :Optional parameters:
158
159     :branch: Git branch to build against. (default: master)
160     :cron: How often to run the job on a cron schedule. (default: @daily)
161     :git-url: URL to clone project from. (default: $GIT_URL/$GERRIT_PROJECT)
162     :jenkins-silos: Space separated list of Jenkins silos to update
163         configuration for as defined in ~/.config/jenkins_jobs/jenkins_jobs.ini
164         (default: production sandbox)
165
166 Typically this template is automatically pulled in by the
167 "{project-name}-ci-jobs" job-group and does not need to be explicitly called if
168 the job group is being used.
169
170 Minimal Example:
171
172 .. literalinclude:: ../../.jjb-test/lf-ci-jobs/jenkins-cfg-merge-minimal.yaml
173    :language: yaml
174
175 Full Example:
176
177 .. literalinclude:: ../../.jjb-test/lf-ci-jobs/jenkins-cfg-merge-full.yaml
178    :language: yaml
179
180 .. _jenkins-cfg-envvar:
181
182 Global Environment Variables
183 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
184
185 Global Environment Variables are managed via the
186 ``jenkins-config/global-vars-SILO.sh`` file in ci-management. Replace SILO with
187 the name of the Jenkins silo the variable configuration is for.
188
189 The format for this file is ``KEY=value`` for example::
190
191     GERRIT_URL=https://git.opendaylight.org/gerrit
192     GIT_BASE=git://devvexx.opendaylight.org/mirror/$PROJECT
193     GIT_URL=git://devvexx.opendaylight.org/mirror
194     JENKINS_HOSTNAME=vex-yul-odl-jenkins-2
195     LOGS_SERVER=https://logs.opendaylight.org
196     NEXUS_URL=https://nexus.opendaylight.org
197     ODLNEXUSPROXY=https://nexus.opendaylight.org
198     SILO=sandbox
199     SONAR_URL=https://sonar.opendaylight.org
200
201 Cloud Configuration
202 ^^^^^^^^^^^^^^^^^^^
203
204 This configuration requires the OpenStack Cloud plugin in Jenkins and is
205 currently the only cloud plugin supported.
206
207 OpenStack Cloud plugin version supported:
208
209 * 2.30 - 2.34
210 * 2.35 - 2.37
211
212 Cloud configuration are managed via a directory structure in ci-management as
213 follows:
214
215 - jenkins-config/clouds/openstack/
216 - jenkins-config/clouds/openstack/cattle/cloud.cfg
217 - jenkins-config/clouds/openstack/cattle/centos7-builder-2c-2g.cfg
218 - jenkins-config/clouds/openstack/cattle/centos7-builder-4c-4g.cfg
219 - jenkins-config/clouds/openstack/cattle/centos7-docker-4c-4g.cfg
220
221 The directory name inside of the "openstack" directory is used as the name of
222 the cloud configuration. In this case "cattle" is being used as the cloud name.
223
224 The ``cloud.cfg`` file is a special file used to configure the main cloud
225 configuration in the format ``KEY=value``.
226
227 :Cloud Parameters:
228
229     :CLOUD_URL: API endpoint URL for Keystone.
230         (default: "")
231     :CLOUD_IGNORE_SSL: Ignore unverified SSL certificates. (default: false)
232     :CLOUD_ZONE: OpenStack region to use. (default: "")
233     :CLOUD_CREDENTIAL_ID: Credential to use for authentication to OpenStack.
234         (default: "os-cloud")
235     :INSTANCE_CAP: Total number of instances the cloud will allow spin up.
236         (default: null)
237     :SANDBOX_CAP: Total number of instances the cloud will allow to
238         spin up. This applies to "sandbox" systems and overrides the
239         INSTANCE_CAP setting. (default: null)
240
241 :Template Parameters:
242
243     .. note::
244
245        In the case of template definitions of a parameter below is not passed
246        the one defined in default clouds will be inherited.
247
248     :IMAGE_NAME: The image name to use for this template.
249         (required)
250     :HARDWARE_ID: OpenStack flavor to use. (required)
251
252     :LABELS: Labels to assign to the vm. (default: FILE_NAME)
253     :NETWORK_ID: OpenStack network to use. (default: "")
254     :USER_DATA_ID: User Data to pass into the instance.
255         (default: jenkins-init-script)
256     :INSTANCE_CAP: Total number of instances of this type that can be launched
257         at one time. When defined in clouds.cfg it defines the total for the
258         entire cloud. (default: null)
259     :SANDBOX_CAP: Total number of instances of this type that can be launched
260         at one time. When defined in clouds.cfg it defines the total for the
261         entire cloud. This applies to "sandbox" systems and overrides the
262         INSTANCE_CAP setting. (default: null)
263     :FLOATING_IP_POOL: Floating ip pool to use. (default: "")
264     :SECURITY_GROUPS: Security group to use. (default: "default")
265     :AVAILABILITY_ZONE: OpenStack availability zone to use. (default: "")
266     :START_TIMEOUT: Number of milliseconds to wait for the agent to be
267         provisioned and connected. (default: 600000)
268     :KEY_PAIR_NAME: SSH Public Key Pair to use for authentication.
269         (default: jenkins)
270     :NUM_EXECUTORS: Number of executors to enable for the instance.
271         (default: 1)
272     :JVM_OPTIONS: JVM Options to pass to Java. (default: "")
273     :FS_ROOT: File system root for the workspace. (default: "/w")
274     :RETENTION_TIME: Number of minutes to wait for an idle slave to be used
275         again before it's removed. If set to -1, the slave will be kept
276         forever. (default: 0)
277     :CONNECTION_TYPE: The connection type for Jenkins to connect to the build
278         minion. Valid options: JNLP, SSH. (default: "SSH")
279
280 For a live example see the OpenDaylight project jenkins-config directory.
281 https://github.com/opendaylight/releng-builder/tree/master/jenkins-config
282
283 Troubleshooting
284 ^^^^^^^^^^^^^^^
285
286 :Cloud Configuration:
287
288     The directory ``groovy-inserts`` contains the groovy script output that is
289     used to push to Jenkins. In the event of a job failure this file can be
290     inspected.
291
292  .. _lf-global-jjb-jenkins-cfg-verify:
293
294 Jenkins Configuration Verify
295 ----------------------------
296
297 Jenkins job to verify the Global Jenkins configuration.
298
299 Requires the ``clouds-yaml`` file to be setup on the Jenkins host.
300
301 :Template names:
302
303     - {project-name}-jenkins-cfg-verify
304     - gerrit-jenkins-cfg-verify
305     - github-jenkins-cfg-verify
306
307 :Optional parameters:
308
309     :branch: Git branch to build against. (default: master)
310     :git-url: URL to clone project from. (default: $GIT_URL/$GERRIT_PROJECT)
311
312 This job is not part of the "{project-name}-ci-jobs" group. It must be called
313 explicitly.
314
315 Example:
316
317 .. literalinclude:: ../../.jjb-test/lf-ci-jobs/jenkins-cfg-verify.yaml
318    :language: yaml
319
320
321 .. _jenkins-sandbox-cleanup:
322
323 Jenkins Sandbox Cleanup
324 -----------------------
325
326 Cleanup Jenkins Sandbox of jobs and views periodically.
327
328 :Template names:
329
330     - {project-name}-jenkins-sandbox-cleanup
331     - gerrit-jenkins-sandbox-cleanup
332     - github-jenkins-sandbox-cleanup
333
334 :Comment Trigger: NONE
335
336 :Required parameters:
337
338     :build-node: The node to run build on.
339     :jenkins-ssh-credential: Credential to use for SSH. (Generally
340         should be configured in defaults.yaml)
341
342 :Optional parameters:
343
344     :cron: Schedule to run job. (default: '0 8 * * 6')
345
346
347 .. _jjb-deploy:
348
349 JJB Deploy Job
350 --------------
351
352 Deploy jobs to jenkins-sandbox system via code review comment.
353
354 This job checks out the current code review patch and then runs a
355 ``jenkins-jobs update`` to push a patch defined by the comment.
356
357 :Template names:
358
359     - {project-name}-jjb-deploy-job
360     - gerrit-jjb-deploy-job
361     - github-jjb-deploy-job
362
363 :Comment Trigger: jjb-deploy JOB_NAME
364
365     .. note::
366
367        The JJB Deploy Job is configured to trigger only if the Gerrit comment
368        starts with the `jjb-deploy` keyword.
369
370        Example of a valid command in Gerrit comment that triggers the job:
371
372        ``jjb-deploy builder-jjb-*``
373
374        Example of a invalid command in Gerrit comment that would _not_ trigger
375        the job:
376
377        ``Update the job. jjb-deploy builder-jjb-*``
378
379        JOB_NAME can include the * wildcard character to push multiple jobs
380        matching the pattern. For example ``jjb-deploy builder-jjb-*`` will push
381        all builder-jjb-* jobs to the sandbox system.
382
383 :Required parameters:
384
385     :build-node: The node to run build on.
386     :jenkins-ssh-credential: Credential to use for SSH. (Generally
387         should be configured in defaults.yaml)
388
389 :Optional parameters:
390
391     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
392     :gerrit_jjb_deploy_job_triggers: Override Gerrit Triggers.
393
394
395 .. _jjb-merge:
396
397 JJB Merge
398 ---------
399
400 Runs `jenkins-jobs update` to update production job configuration
401
402 :Template Names:
403     - {project-name}-jjb-merge
404     - gerrit-jjb-merge
405     - github-jjb-merge
406
407 :Comment Trigger: remerge
408
409 :Required parameters:
410
411     :build-node: The node to run build on.
412     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
413         be configured in defaults.yaml)
414
415 :Optional parameters:
416
417     :branch: Git branch to fetch for the build. (default: master)
418     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
419     :build-timeout: Timeout in minutes before aborting build. (default: 10)
420     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
421     :jjb-cache: JJB cache location. (default: $HOME/.cache/jenkins_jobs)
422     :jjb-workers: Number of threads to run **update** with. Set to 0 by default
423         which is equivalent to the number of available CPU cores. (default: 0)
424     :jjb-version: JJB version to install. (default: see job-template)
425     :stream: Keyword that can be used to represent a release code-name.
426         Often the same as the branch. (default: master)
427     :submodule-recursive: Whether to checkout submodules recursively.
428         (default: true)
429     :submodule-timeout: Timeout (in minutes) for checkout operation.
430         (default: 10)
431     :submodule-disable: Disable submodule checkout operation.
432         (default: false)
433
434     :gerrit_merge_triggers: Override Gerrit Triggers.
435     :gerrit_trigger_file_paths: Override file paths which can be used to
436         filter which file modifications will trigger a build.
437         (default defined by lf_jjb_common)
438
439
440 .. _jjb-verify:
441
442 JJB Verify
443 ----------
444
445 Runs `jenkins-jobs test` to validate JJB syntax
446
447 :Template Names:
448     - {project-name}-jjb-verify
449     - gerrit-jjb-verify
450     - github-jjb-verify
451
452 :Comment Trigger: recheck|reverify
453
454 :Required parameters:
455
456     :build-node: The node to run build on.
457     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
458         be configured in defaults.yaml)
459
460 :Optional parameters:
461
462     :branch: Git branch to fetch for the build. (default: master)
463     :build-concurrent: Whether or not to allow this job to run multiple jobs
464         simultaneously. (default: true)
465     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
466     :build-timeout: Timeout in minutes before aborting build. (default: 10)
467     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
468     :jjb-cache: JJB cache location. (default: $HOME/.cache/jenkins_jobs)
469     :jjb-version: JJB version to install. (default: see job-template)
470     :stream: Keyword that can be used to represent a release code-name.
471         Often the same as the branch. (default: master)
472     :submodule-recursive: Whether to checkout submodules recursively.
473         (default: true)
474     :submodule-timeout: Timeout (in minutes) for checkout operation.
475         (default: 10)
476     :submodule-disable: Disable submodule checkout operation.
477         (default: false)
478     :throttle_categories: List of categories to throttle by.
479     :throttle-enabled: Whether or not to enable throttling on the job.
480         (default: true)
481     :throttle-max-per-node: Max jobs to run on the same node. (default: 1)
482     :throttle-max-total: Max jobs to run across the entire project. - 0
483         means 'unlimited' (default: 0)
484     :throttle-option: Throttle by the project or by list of categories
485         defined in the throttle plugin configuration. (options: 'project',
486         'category'; default: project)
487
488     :gerrit_verify_triggers: Override Gerrit Triggers.
489     :gerrit_trigger_file_paths: Override file paths which can be used to
490         filter which file modifications will trigger a build.
491         (default defined by lf_jjb_common)
492
493 .. _jjb-verify-upstream-gjjb:
494
495 JJB Verify Upstream Global JJB
496 ------------------------------
497
498 Runs ``jenkins-jobs test`` to validate JJB syntax for upstream global-jjb
499 patches. This job is useful to notify upstream that they may be breaking
500 project level jobs.
501
502 :Template Names:
503     - {project-name}-jjb-verify-upstream-gjjb
504     - gerrit-jjb-verify-upstream-gjjb
505
506 :Comment Trigger: recheck|reverify
507
508 :Required parameters:
509
510     :build-node: The node to run build on.
511     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
512         be configured in defaults.yaml)
513
514 :Optional parameters:
515
516     :branch: Git branch to fetch for the build. (default: master)
517     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
518     :build-timeout: Timeout in minutes before aborting build. (default: 10)
519     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
520     :jjb-cache: JJB cache location. (default: $HOME/.cache/jenkins_jobs)
521     :jjb-version: JJB version to install. (default: see job-template)
522     :stream: Keyword that can be used to represent a release code-name.
523         Often the same as the branch. (default: master)
524
525 .. _info-yaml-verify:
526
527 Info YAML Verify
528 ----------------
529
530 Info YAML Verify job validates that INFO.yaml file changes are kept isolated from
531 other file changes. Verifies INFO.yaml files follow the schema defined in
532 `lfit/releng-global-jjb/schema/info-schema.yaml`.
533
534 :Template Names:
535     - {project-name}-info-yaml-verify
536     - gerrit-info-yaml-verify
537     - github-info-yaml-verify
538
539 :Required parameters:
540
541     :build-node: The node to run build on.
542     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
543         be configured in defaults.yaml)
544
545 :Optional parameters:
546
547     :branch: Git branch to fetch for the build. (default: master)
548     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
549     :build-timeout: Timeout in minutes before aborting build. (default: 10)
550     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
551     :stream: Keyword that can be used to represent a release code-name.
552         Often the same as the branch. (default: master)
553     :submodule-recursive: Whether to checkout submodules recursively.
554         (default: true)
555     :submodule-timeout: Timeout (in minutes) for checkout operation.
556         (default: 10)
557     :submodule-disable: Disable submodule checkout operation.
558         (default: false)
559
560     :gerrit_verify_triggers: Override Gerrit Triggers.
561
562 .. _license-checker:
563
564 License Checker
565 ---------------
566
567 Job to scan projects for files missing license headers.
568
569 :Template Names:
570     - {project-name}-license-check
571     - gerrit-license-check
572     - github-license-check
573
574 :Optional parameters:
575
576     :build-timeout: Timeout in minutes before aborting build. (default: 15)
577     :file-patterns: Space-separated list of file patterns to scan.
578         (default: \*.go \*.groovy \*.java \*.py \*.sh)
579     :spdx-disable: Disable the SPDX-Identifier checker. (default: false)
580     :lhc-version: Version of LHC to use. (default: 0.2.0)
581     :license-exclude-paths: Comma-separated list of paths to exclude from the
582         license checker. The paths used here will be matched using a contains
583         rule so it is best to be as precise with the path as possible.
584         For example a path of '/src/generated/' will be searched as
585         '**/src/generated/**'.
586         Example: org/opendaylight/yang/gen,protobuff/messages
587         (default: '')
588     :licenses-allowed: Comma-separated list of allowed licenses.
589         (default: Apache-2.0,EPL-1.0,MIT)
590     :project-pattern: The ANT based pattern for Gerrit Trigger to choose which
591         projects to trigger job against. (default: '**')
592
593 .. _gjjb-openstack-cron:
594
595 OpenStack Cron
596 --------------
597
598 Cron job that runs regularly to perform periodic tasks against OpenStack.
599
600 This job requires a Config File Provider file named ``clouds-yaml`` available
601 containing the credentials for the cloud.
602
603 :Template Names:
604     - {project-name}-openstack-cron
605     - gerrit-openstack-cron
606     - github-openstack-cron
607
608 :Required parameters:
609
610     :build-node: The node to run build on.
611     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
612         be configured in defaults.yaml)
613     :jenkins-urls: URLs to Jenkins systems to check for active builds.
614
615 :Optional parameters:
616
617     :branch: Git branch to fetch for the build. (default: master)
618     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
619     :build-timeout: Timeout in minutes before aborting build. (default: 90)
620     :cron: Time when the packer image should be rebuilt (default: @hourly)
621     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
622     :openstack-cloud: OS_CLOUD setting to pass to openstack client.
623         (default: vex)
624     :openstack-image-cleanup: Whether or not to run the image cleanup script.
625         (default: true)
626     :openstack-image-cleanup-age: Age in days of image before marking it for
627         removal. (default: 30)
628     :openstack-image-protect: Whether or not to run the image protect script.
629         (default: true)
630     :openstack-server-cleanup: Whether or not to run the server cleanup script.
631         (default: true)
632     :openstack-stack-cleanup: Whether or not to run the stack cleanup script.
633         (default: true)
634     :openstack-volume-cleanup: Whether or not to run the volume cleanup script.
635         (default: true)
636     :stream: Keyword that can be used to represent a release code-name.
637         Often the same as the branch. (default: master)
638     :submodule-recursive: Whether to checkout submodules recursively.
639         (default: true)
640     :submodule-timeout: Timeout (in minutes) for checkout operation.
641         (default: 10)
642     :submodule-disable: Disable submodule checkout operation.
643         (default: false)
644
645 Minimal Example:
646
647 .. literalinclude:: ../../.jjb-test/lf-ci-jobs/openstack-cron-minimal.yaml
648
649 Full Example:
650
651 .. literalinclude:: ../../.jjb-test/lf-ci-jobs/openstack-cron-full.yaml
652
653 .. _gjjb-openstack-update-cloud-image:
654
655 OpenStack Update Cloud Image
656 ----------------------------
657
658 This job finds and updates OpenStack cloud images on the ci-management source
659 repository.
660
661 The job is triggered in two ways:
662
663 1. When packer merge job completes, the new image name created is passed
664    down to the job.
665 2. When the job is triggered manually to update all new images.
666
667 When the job is triggered through an upstream packer merge job, this only
668 generates a change request for the new image built.
669
670 When the job is triggered manually, this job finds the latest images on
671 OpenStack cloud and compares them with the images currently used in the source
672 ci-management source repository. If the compared images have newer
673 time stamps are **all** updated through a change request.
674
675 This job requires a Jenkins configuration merge and verify job setup and
676 working on Jenkins.
677
678 :Template Names:
679     - {project-name}-openstack-update-cloud-image
680     - gerrit-openstack-update-cloud-image
681     - github-openstack-update-cloud-image
682
683 :Required parameters:
684
685     :build-node: The node to run build on.
686     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
687         be configured in defaults.yaml)
688     :new-image-name: Name of new image name passed from packer merge job or
689         set to 'all' to update all images. (default: all)
690
691 :Optional parameters:
692
693     :branch: Git branch to fetch for the build. (default: master)
694     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
695     :build-timeout: Timeout in minutes before aborting build. (default: 90)
696     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
697     :openstack-cloud: OS_CLOUD setting to pass to openstack client.
698         (default: vex)
699     :stream: Keyword that can be used to represent a release code-name.
700         Often the same as the branch. (default: master)
701     :submodule-recursive: Whether to checkout submodules recursively.
702         (default: true)
703     :submodule-timeout: Timeout (in minutes) for checkout operation.
704         (default: 10)
705     :submodule-disable: Disable submodule checkout operation.
706         (default: false)
707     :update-cloud-image: Submit a change request to update new built cloud
708         image to Jenkins. (default: false)
709
710 Minimal Example:
711
712 .. literalinclude:: ../../.jjb-test/lf-ci-jobs/openstack-update-cloud-image-minimal.yaml
713
714 Full Example:
715
716 .. literalinclude:: ../../.jjb-test/lf-ci-jobs/openstack-update-cloud-image-full.yaml
717
718
719 .. _gjjb-packer-merge:
720
721 Packer Merge
722 ------------
723
724 Packer Merge job runs `packer build` to build system images in the cloud.
725
726 :Template Names:
727     - {project-name}-packer-merge-{platforms}-{templates}
728     - gerrit-packer-merge
729     - github-packer-merge
730
731 :Comment Trigger: remerge
732
733 :Required parameters:
734
735     :build-node: The node to run build on.
736     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
737         be configured in defaults.yaml)
738     :mvn-settings: The name of settings file containing credentials for
739         the project.
740     :platforms: Platform or distribution to build. Typically json file
741         found in the packer/vars directory. (Example: centos)
742     :template: System template to build. Typically shell script found in
743         the packer/provision directory. (Example: java-builder)
744
745 :Optional parameters:
746
747     :cron: Time when the packer image should be rebuilt (default: @monthly)
748     :branch: Git branch to fetch for the build. (default: master)
749     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
750     :build-timeout: Timeout in minutes before aborting build. (default: 90)
751     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
752     :openstack: Packer template uses an OpenStack builder (default: true).
753     :openstack-cloud: Sets OS_CLOUD variable to the value of this parameter.
754         (default: vex).
755     :packer-cloud-settings: Name of settings file containing credentials
756         for the cloud that packer will build on. (default: packer-cloud-env)
757     :packer-version: Version of packer to install / use in build. (default: 1.0.2)
758     :stream: Keyword that can be used to represent a release code-name.
759         Often the same as the branch. (default: master)
760     :submodule-recursive: Whether to checkout submodules recursively.
761         (default: true)
762     :submodule-timeout: Timeout (in minutes) for checkout operation.
763         (default: 10)
764     :submodule-disable: Disable submodule checkout operation.
765         (default: false)
766
767     :gerrit_verify_triggers: Override Gerrit Triggers.
768     :update-cloud-image: Submit a change request to update new built cloud
769         image to Jenkins. (default: false)
770
771
772 Test an in-progress patch
773 ^^^^^^^^^^^^^^^^^^^^^^^^^
774
775 To test an in-progress patch from a GitHub Pull Request. Upload this
776 job to the :doc:`Jenkins Sandbox <lfdocs:jenkins-sandbox>`. Then when manually
777 building the job replace the GERRIT_REFSPEC parameter with the GitHub Pull
778 Request number of the patch you would like to test.
779
780 Example GitHub:
781
782 .. code-block:: none
783
784    GERRIT_REFSPEC: origin/pr/49/merge
785
786 .. _gjjb-packer-verify:
787
788 Packer Verify
789 -------------
790
791 Packer Verify job runs `packer validate` to verify packer configuration.
792
793 :Template Names:
794     - {project-name}-packer-verify
795     - gerrit-packer-verify
796     - github-packer-verify
797
798 :Comment Trigger: recheck|reverify
799
800 :Required parameters:
801
802     :build-node: The node to run build on.
803     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
804         be configured in defaults.yaml)
805     :mvn-settings: The name of settings file containing credentials for
806         the project.
807
808 :Optional parameters:
809
810     :branch: Git branch to fetch for the build. (default: master)
811     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
812     :build-timeout: Timeout in minutes before aborting build. (default: 10)
813     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
814     :openstack: Packer template uses an OpenStack builder (default: true).
815     :openstack-cloud: Sets OS_CLOUD variable to the value of this parameter.
816         (default: vex).
817     :packer-cloud-settings: Name of settings file containing credentials
818         for the cloud that packer will build on. (default: packer-cloud-env)
819     :packer-version: Version of packer to install / use in build. (default: 1.0.2)
820     :stream: Keyword that can be used to represent a release code-name.
821         Often the same as the branch. (default: master)
822     :submodule-recursive: Whether to checkout submodules recursively.
823         (default: true)
824     :submodule-timeout: Timeout (in minutes) for checkout operation.
825         (default: 10)
826     :submodule-disable: Disable submodule checkout operation.
827         (default: false)
828
829     :gerrit_verify_triggers: Override Gerrit Triggers.
830     :gerrit_trigger_file_paths: Override file paths which can be used to
831         filter which file modifications will trigger a build.
832
833
834 Puppet Verify
835 -------------
836
837 Runs puppet-lint in the ``puppet-dir`` directory. puppet-lint runs recursively,
838 the base directory is usually the best place to run from.
839
840 :Template Names:
841
842     - {project-name}-puppet-verify
843     - gerrit-puppet-verify
844     - github-puppet-verify
845
846 :Comment Trigger: recheck|reverify
847
848 :Required Parameters:
849
850     :build-node: The node to run build on.
851     :jenkins-ssh-credential: Credential to use for SSH. (Generally set
852         in defaults.yaml)
853
854 :Optional Parameters:
855
856     :branch: The branch to build against. (default: master)
857     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
858     :build-timeout: Timeout in minutes before aborting build. (default: 15)
859     :gerrit_trigger_file_paths: Override file paths which used to filter which
860         file modifications will trigger a build. Refer to JJB documentation for
861         "file-path" details.
862         https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit
863     :git-url: URL clone project from. (default: $GIT_URL/$GERRIT_PROJECT)
864     :puppet-dir: Directory containing the project's puppet module(s) relative
865         to the workspace.
866         (default: '')
867     :puppet-lint-version: Version of puppet-lint to use for testing.
868         (default: 2.3.6)
869     :stream: Keyword representing a release code-name.
870         Often the same as the branch. (default: master)
871     :submodule-recursive: Whether to checkout submodules recursively.
872         (default: true)
873     :submodule-timeout: Timeout (in minutes) for checkout operation.
874         (default: 10)
875     :submodule-disable: Disable submodule checkout operation.
876         (default: false)
877
878
879 Sonar
880 -----
881
882 Runs Jenkins Sonarqube plug-in to review for bugs, code smells,
883 and security vulnerabilities.
884
885 Requires ``SonarQube Scanner for Jenkins``
886
887 Plug-in configurations
888     Manage Jenkins --> Configure System --> SonarQube servers
889         - Name: Sonar (fixed)
890         - Server URL: https://sonar.server.org/ or https://sonarcloud.io
891         - Server authentication token: none for local, API token (saved as a
892           "secret text" credential) for Sonarcloud
893
894     Manage Jenkins --> Global Tool Configuration --> SonarQube Scanner
895         - Name: SonarQube Scanner (fixed)
896         - Install automatically
897         - Select latest version
898
899 .. note:: Sonar properties can be set directly in the job definition by
900    setting the sonar-project-file to ``""`` and adding all properties under
901    ``sonar-properties``.
902
903 :Template Names:
904
905     - {project-name}-sonar
906     - gerrit-sonar
907     - github-sonar
908
909 :Optional Parameters:
910     :sonar-task: Sonar task to run. (default: "")
911     :sonar-project-file: The filename for the project's properties
912         (default: "sonar-project.properties")
913     :sonar-properties: Sonar configuration properties. (default: "")
914     :sonar-java-opts: JVM options. (default: "")
915     :sonar-additional-args: Additional command line arguments. (default: "")
916
917
918 Sonar with Prescan
919 ------------------
920
921 The same as the Sonar job above, except the caller also defines a builder
922 called ``lf-sonar-prescan``, in which they can put any builders that they want
923 to run prior to the Sonar scan.
924
925 .. code-block:: yaml
926
927    - builder:
928        name: lf-sonar-prescan
929        builders:
930          - shell: "# Pre-scan shell script"
931
932 :Template Names:
933
934     - {project-name}-sonar-prescan
935     - gerrit-sonar-prescan
936     - github-sonar-prescan
937
938 :Required Parameters:
939     :lf-sonar-prescan: A builder that will run prior to the Sonar scan.
940
941 :Optional Parameters:
942     :sonar-task: Sonar task to run. (default: "")
943     :sonar-project-file: The filename for the project's properties
944         (default: "sonar-project.properties")
945     :sonar-properties: Sonar configuration properties. (default: "")
946     :sonar-java-opts: JVM options. (default: "")
947     :sonar-additional-args: Additional command line arguments. (default: "")