Document undocumented macros
[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-package-listing
79 ------------------------
80
81 Lists distro level packages.
82
83 lf-infra-packer-build
84 ---------------------
85
86 Run `packer build` to build system images.
87
88 lf-infra-packer-validate
89 ------------------------
90
91 Run `packer validate` to verify packer configuration.
92
93 :Required parameters:
94
95     :packer-cloud-settings: Cloud configuration file. Loaded on the build
96         server as CLOUDENV environment variable.
97     :packer-version: Version of packer to use.
98
99 lf-infra-push-gerrit-patch
100 --------------------------
101
102 Push a change through a Jenkins job to a Gerrit repository in an automated
103 way using git-review.
104
105 :Required parameters:
106
107     :gerrit-commit-message: Commit message to assign.
108     :gerrit-host: Gerrit hostname.
109     :gerrit-topic: Gerrit topic.
110     :gerrit-user: Gerrit user-id used for submitting the change.
111     :reviewers-email: Reviewers email. Space-separated list of
112         email addresses to CC on the patch.
113     :project: Gerrit project name.
114
115 .. _lf-infra-ship-logs:
116
117 lf-infra-ship-logs
118 ------------------
119
120 Gather and deploy logs to a log server.
121
122 lf-infra-sysstat
123 ----------------
124
125 Retrieves system stats.
126
127 lf-jacoco-nojava-workaround
128 ---------------------------
129
130 Workaround for Jenkins not able to find Java in JaCoCo runs.
131
132 lf-maven-install
133 ----------------
134
135 Call maven-target builder with a goal of --version to force Jenkins to
136 install the need provided version of Maven. This is needed for any shell scripts
137 that want to use Maven.
138
139 :Required parameters:
140
141     :mvn-version: Version of Maven to install.
142
143 lf-pip-install
144 --------------
145
146 Call pip install to install packages into a virtualenv located in
147 /tmp/v/VENV
148
149 .. note:: The first package listed in PIP_PACKAGES is used as the VENV name.
150
151 .. _lf-provide-maven-settings:
152
153 lf-provide-maven-settings
154 -------------------------
155
156 Push a global settings and user settings maven files to the build node.
157
158 lf-provide-maven-settings-cleanup
159 ---------------------------------
160
161 Cleanup maven settings.xml configuration. This should be called at the end of
162 any macros that calles the
163 :ref:`lf-provide-maven-settings <lf-provide-maven-settings>` macro.
164
165 .. _provide-sigul-config:
166
167 lf-provide-sigul-configuration
168 ------------------------------
169
170 Provides sigual configuration to the Jenkins build node.
171
172 Requires the following Config File Provider managed files in Jenkins
173 preconfigured.
174
175 * sigul-config
176 * sigul-password
177 * sigul-pki
178
179 .. _provide-sigul-config-cleanup:
180
181 lf-provide-sigul-configuration-cleanup
182 --------------------------------------
183
184 Cleanup configuration provided by `provide-sigul-config`.
185
186 lf-rtd-trigger-build
187 --------------------
188
189 Script to trigger a build on http://readthedocs.org
190
191 lf-rtd-verify
192 -------------
193
194 ReadTheDocs verify script.
195
196 lf-sigul-install
197 ----------------
198
199 Install Sigul.
200
201 Requires ``SIGUL_BRIDGE_IP`` configured as a global envvar.
202
203 lf-infra-provide-docker-cleanup
204 -------------------------------
205
206 Forcibly removes all of the docker images.
207
208 Parameters
209 ==========
210
211 lf-infra-maven-parameters
212 -------------------------
213
214 Provides parameters needed by Maven. Should be used by any jobs that need to
215 call the mvn cli.
216
217 lf-infra-openstack-parameters
218 -----------------------------
219
220 Provides parameters needed by OpenStack client CLI. Use in jobs that need to
221 call the openstack cli.
222
223 :Required Parameters:
224
225     :os-cloud: Configures ``OS_CLOUD`` envvar as used by openstack cli.
226
227 lf-infra-parameters
228 -------------------
229
230 Standard parameters used in the LF CI environments. Gerrit variables are
231 not used by GitHub projects, but defining them is not harmful. Should be used
232 in every job template.
233
234 lf-infra-node-parameters
235 ------------------------
236
237 Provides parameters needed by NodeJS and NPM. Should be used by any jobs that
238 need to run NodeJS or NPM.
239
240 lf-infra-tox-parameters
241 -----------------------
242
243 Provides parameters needed by python-tox. Should be used by any jobs that need
244 to run `tox <https://tox.readthedocs.io>`.
245
246 Properties
247 ==========
248
249 lf-infra-properties
250 -------------------
251
252 Configures the build-discarder plugin for Jenkins with the recommended lf-infra
253 settings. Should be used in all job-templates.
254
255 Publishers
256 ==========
257
258 lf-jacoco-report
259 ----------------
260
261 Provides basic configuration for the JaCoCo plugin.
262
263 lf-infra-publish
264 ----------------
265
266 Provides basic lf-infra recommended publisher configurations which should be
267 used in all job templates. This primary objective of this trigger is to
268 gather build logs and copy them to a log server.
269
270 SCM
271 ===
272
273 lf-infra-gerrit-scm
274 -------------------
275
276 Basic SCM configuration for Gerrit based projects.
277
278 lf-infra-github-scm
279 -------------------
280
281 Basic SCM configuration for GitHub based projects.
282
283 On the `branch` variable you can assign `$sha1` or `$ghprbActualCommit`
284 as the value.  This will require that the job be triggered via
285 the GHPRB plugin and not manually.
286
287 Wrappers
288 ========
289
290 lf-infra-wrappers
291 -----------------
292
293 Provides lf-infra recommended wrappers which should be used in every
294 job-template.
295
296 This wrapper requires that a managed file called `npmrc` exists in the Jenkins.  The main use
297 case here is to point to a npm proxy, on Nexus for example.
298 The type of the file should be "Custom file".  You can set various npmrc settings in it.
299 Documentation on npm configuration can be found at https://docs.npmjs.com/files/npmrc.
300 If you are not using npm then it is fine for the file to be empty.
301
302 Example npmrc:
303
304 .. code-block:: bash
305
306    registry=https://nexus3.onap.org/repository/npm.public/