Add script to auto-update project templates
[releng/builder.git] / README.md
1 = How to test locally
2     - Use the official Jenkins docker image:
3         docker run -d -p 8080:8080 jenkins:weekly"
4     - Then install the Jenkins Plugin Dependencies as listed below
5     - Run JJB with:
6         jenkins-jobs -l DEBUG --conf jenkins.ini update jjb
7
8 = Jenkins Plugin Dependencies
9     - Email-ext Plugin
10     - Gerrit Trigger Plugin
11     - Git Plugin
12     - Sonar Plugin
13     - SSH-Agent Plugin
14
15 = Creating jobs from OpenDaylight templates
16
17 The ODL Releng project provides 3 job templates which can be used to
18 define basic jobs.
19
20 Note: The templates below depend on a modified JJB version to add
21       support for Config File Provider module in the Maven Project
22       module for JJB. This custom version of JJB can be found at:
23       https://github.com/zxiiro/jenkins-job-builder/tree/support-config-file-provider
24
25 == Verify Job Template
26
27 The Verify job template creates a Gerrit Trigger job that will trigger
28 when a new patch is submitted to Gerrit.
29
30 == Merge Job Template
31
32 The Merge job template is similar to the Verify Job Template except it
33 will trigger once a Gerrit patch is merged into
34 the repo.
35
36 == Daily Job Template
37
38 The Daily (or Nightly) Job Template creates a job which will run on a
39 Daily basis and also Submits Sonar reports.
40
41
42 == Basic Job Configuration
43
44 To create jobs based on the above templates you can use the example
45 template which will create 6 jobs (verify, merge, and daily jobs for both
46 master and stable/helium branch).
47
48 Run the following steps from the repo root to create initial job config.
49 This script will produce a file in jjb/<project>/<project>.yaml
50 containing your project's base template.
51
52     python scripts/jjb-init-project.py <project-name>
53
54     # Example
55     python scripts/jjb-init-project.py aaa
56
57     # Note: The optional options below require you to remove the 1st line
58     #       comment in the produced template file otherwise the auto
59     #       update script will overwrite the customization next time it
60     #       is run. See Auto Update Job Templates section below for more
61     #       details.
62     #
63     # Optionally pass the following options:
64     #
65     # -g / --mvn-goals : With your job's Maven Goals necessary to build
66     #                    (defaults to "clean install")
67     #          Example : -g "clean install"
68     #
69     # -o / --mvn-opts  : With your job's Maven Options necessary to build
70     #                    (defaults to empty)
71     #          Example : -o "-Xmx1024m"
72
73 If all your project requires is the basic verify, merge, and
74 daily jobs then using the job.template should be all you need to
75 configure for your jobs.
76
77 === Auto Update Job Templates
78
79 The first line of the job YAML file produced by the script will contain
80 the words # REMOVE THIS LINE IF... leaving this line will allow the
81 releng/builder autoupdate script to maintain this file for your project
82 should the base template ever change. It is a good idea to leave this
83 line if you do not plan to create any complex jobs outside of the
84 provided template.
85
86 However if your project needs more control over your jobs or if you have
87 any additional configuration outside of the standard configuration
88 provided by the template then this line should be removed.
89
90 It is also possible to take advantage of both the auto updater and creating
91 your own jobs. To do this, create a YAML file in your project's sub-directory
92 with any name other than <project>.yaml. The auto-update script will only
93 search for files with the name <project>.yaml. The normal <project>.yaml
94 file can then be left in tact with the "# REMOVE THIS LINE IF..." comment so
95 it will be automatically updated.