Merge "Document lf-infra-push-gerrit-patch macro in RTD"
[releng/global-jjb.git] / docs / jjb / lf-macros.rst
1 #############
2 Global Macros
3 #############
4
5 Builders
6 ========
7
8 lf-fetch-dependent-patches
9 --------------------------
10
11 Fetch all patches provided via comment trigger
12
13 This macro will fetch all patches provided via comment trigger and will
14 create a list of projects from those patches via environment variable
15 called DEPENDENCY_BUILD_ORDER which can be used if necessary to build
16 projects in the specified order. The order is determined by first patch
17 instance for a project in the patch list.
18
19 lf-infra-create-netrc
20 ---------------------
21
22 Create a ~/.netrc file from a Maven settings.xml
23
24 :Required parameters:
25
26     :server-id: The id of a server as defined in settings.xml.
27
28 :Optional parameters:
29
30     :ALT_NEXUS_SERVER: URL of custom nexus server.
31         If set this will take precedence.
32         Use this to point at nexus3.$PROJECTDOMAIN
33         for example.
34
35 lf-infra-deploy-maven-file
36 --------------------------
37
38 Deploy files to a repository.
39
40 :Required parameters:
41
42     :global-settings-file: Global settings file to use.
43     :group-id: Group ID of the repository.
44     :maven-repo-url: URL of a Maven repository to upload to.
45     :mvn-version: Version of Maven to use.
46     :repo-id: Repository ID
47     :settings-file: Maven settings file to use.
48     :upload-files-dir: Path to directory containing one or more files
49
50 lf-infra-docker-login
51 ---------------------
52
53 Login into a custom hosted docker registry and / or docker.io
54
55 The Jenkins system should have the following global variables defined
56
57 :Environment variables:
58
59     :DOCKER_REGISTRY: The DNS address of the registry (IP or FQDN)
60         ex: nexus3.example.com (GLOBAL variable)
61
62     :REGISTRY_PORTS: Required if DOCKER_REGISTRY is set. Space separated list
63         of the registry ports to login to. ex: 10001 10002 10003 10004
64         (GLOBAL variable)
65
66     :DOCKERHUB_EMAIL: If this variable is set then an attempt to login to
67         DockerHub (docker.io) will be also made. It should be set to the email
68         address for the credentials that will get looked up. Only _one_
69         credential will ever be found in the maven settings file for DockerHub.
70         (GLOBAL variable)
71
72 lf-infra-gpg-verify-git-signature
73 ---------------------------------
74
75 Verify gpg signature of the latest commit message in $WORKSPACE.
76 This command assumes that $WORKSPACE is a git repo.
77
78 lf-infra-packer-build
79 ---------------------
80
81 Run `packer build` to build system images.
82
83 lf-infra-packer-validate
84 ------------------------
85
86 Run `packer validate` to verify packer configuration.
87
88 :Required parameters:
89
90     :packer-cloud-settings: Cloud configuration file. Loaded on the build
91         server as CLOUDENV environment variable.
92     :packer-version: Version of packer to use.
93
94 lf-infra-push-gerrit-patch
95 --------------------------
96
97 Push a change through a Jenkins job to a Gerrit repository in an automated
98 way using git-review.
99
100 :Required parameters:
101
102     :gerrit-commit-message: Commit message to assign.
103     :gerrit-host: Gerrit hostname.
104     :gerrit-topic: Gerrit topic.
105     :gerrit-user: Gerrit user-id used for submitting the change.
106     :reviewers-email: Reviewers email. Space-separated list of
107         email addresses to CC on the patch.
108     :project: Gerrit project name.
109
110 lf-infra-ship-logs
111 ------------------
112
113 Gather and deploy logs to a log server.
114
115 lf-infra-sysstat
116 ----------------
117
118 Retrieves system stats.
119
120 lf-jacoco-nojava-workaround
121 ---------------------------
122
123 Workaround for Jenkins not able to find Java in JaCoCo runs.
124
125 lf-maven-install
126 ----------------
127
128 Call maven-target builder with a goal of --version to force Jenkins to
129 install the need provided version of Maven. This is needed for any shell scripts
130 that want to use Maven.
131
132 :Required parameters:
133
134     :mvn-version: Version of Maven to install.
135
136 lf-pip-install
137 --------------
138
139 Call pip install to install packages into a virtualenv located in
140 /tmp/v/VENV
141
142 .. note:: The first package listed in PIP_PACKAGES is used as the VENV name.
143
144 .. _lf-provide-maven-settings:
145
146 lf-provide-maven-settings
147 -------------------------
148
149 Push a global settings and user settings maven files to the build node.
150
151 lf-provide-maven-settings-cleanup
152 ---------------------------------
153
154 Cleanup maven settings.xml configuration. This should be called at the end of
155 any macros that calles the
156 :ref:`lf-provide-maven-settings <lf-provide-maven-settings>` macro.
157
158 lf-rtd-trigger-build
159 --------------------
160
161 Script to trigger a build on http://readthedocs.org
162
163 lf-rtd-verify
164 -------------
165
166 ReadTheDocs verify script.
167
168 lf-infra-provide-docker-cleanup
169 -------------------------------
170
171 Forcibly removes all of the docker images.
172
173 Parameters
174 ==========
175
176 lf-infra-maven-parameters
177 -------------------------
178
179 Provides parameters needed by Maven. Should be used by any jobs that need to
180 call the mvn cli.
181
182 lf-infra-parameters
183 -------------------
184
185 Standard parameters used in the LF CI environments. Gerrit variables are
186 not used by GitHub projects, but defining them is not harmful. Should be used
187 in every job template.
188
189 lf-infra-node-parameters
190 ------------------------
191
192 Provides parameters needed by NodeJS and NPM. Should be used by any jobs that
193 need to run NodeJS or NPM.
194
195 lf-infra-tox-parameters
196 -----------------------
197
198 Provides parameters needed by python-tox. Should be used by any jobs that need
199 to run `tox <https://tox.readthedocs.io>`.
200
201 Properties
202 ==========
203
204 lf-infra-properties
205 -------------------
206
207 Configures the build-discarder plugin for Jenkins with the recommended lf-infra
208 settings. Should be used in all job-templates.
209
210 Publishers
211 ==========
212
213 lf-jacoco-report
214 ----------------
215
216 Provides basic configuration for the JaCoCo plugin.
217
218 lf-infra-publish
219 ----------------
220
221 Provides basic lf-infra recommended publisher configurations which should be
222 used in all job templates. This primary objective of this trigger is to
223 gather build logs and copy them to a log server.
224
225 SCM
226 ===
227
228 lf-infra-gerrit-scm
229 -------------------
230
231 Basic SCM configuration for Gerrit based projects.
232
233 lf-infra-github-scm
234 -------------------
235
236 Basic SCM configuration for GitHub based projects.
237
238 On the `branch` variable you can assign `$sha1` or `$ghprbActualCommit`
239 as the value.  This will require that the job be triggered via
240 the GHPRB plugin and not manually.
241
242 Triggers
243 ========
244
245 lf-infra-github-pr-trigger
246 --------------------------
247
248 Provides configuration for a GitHub PR Trigger.
249
250 Wrappers
251 ========
252
253 lf-infra-wrappers
254 -----------------
255
256 Provides lf-infra recommended wrappers which should be used in every
257 job-template.
258
259 This wrapper requires that a managed file called `npmrc` exists in the Jenkins.  The main use
260 case here is to point to a npm proxy, on Nexus for example.
261 The type of the file should be "Custom file".  You can set various npmrc settings in it.
262 Documentation on npm configuration can be found at https://docs.npmjs.com/files/npmrc.
263 If you are not using npm then it is fine for the file to be empty.
264
265 Example npmrc:
266
267 .. code-block:: bash
268
269    registry=https://nexus3.onap.org/repository/npm.public/