11 This macro will post a comment to the gerrit patchset if the build
12 creates a file named gerrit_comment.txt
13 To use this macro add it to the list of builders.
15 lf-ansible-config-file-provider
16 -------------------------------
18 Provisions files required by the ansible, namely
19 "~/.ansible/ansible.cfg" in the Jenkins home directory.
21 lf-fetch-dependent-patches
22 --------------------------
24 Fetch all patches provided via comment trigger
26 This macro will fetch all patches provided via comment trigger and will
27 create a list of projects from those patches via environment variable
28 called ``DEPENDENCY_BUILD_ORDER`` to build projects in the specified order.
29 Order calculated by the first patch instance for a project in the patch list.
38 :file-patterns: Space-separated list of file patterns to scan.
39 For example: \*.go \*.groovy \*.java \*.py \*.sh
40 :spdx-disable: Disable the SPDX-Identifier checker.
41 :lhc-version: Version of LHC to use.
42 :license-exclude-paths: Comma-separated list of paths to exclude from the
43 license checker. Matches the paths defined here using a contains rule,
44 we recommend you to configure as precisely as possible. For example
45 a path of '/src/generated/' will search as '**/src/generated/**'.
46 Example: org/opendaylight/yang/gen,protobuff/messages
47 :licenses-allowed: Comma-separated list of allowed licenses.
48 For example: Apache-2.0,EPL-1.0,MIT
50 lf-infra-capture-instance-metadata
51 ----------------------------------
53 Capture instance metadata.
58 Create a ~/.netrc file from a Maven settings.xml
62 :server-id: The id of a server as defined in settings.xml.
66 :ALT_NEXUS_SERVER: URL of custom nexus server.
67 If set this will take precedence.
68 Use this to point at nexus3.$PROJECTDOMAIN
71 lf-infra-deploy-maven-file
72 --------------------------
74 Deploy files to a repository.
78 :global-settings-file: Global settings file to use.
79 :group-id: Group ID of the repository.
80 :maven-repo-url: URL of a Maven repository to upload to.
81 :mvn-version: Version of Maven to use.
82 :repo-id: Repository ID
83 :settings-file: Maven settings file to use.
84 :upload-files-dir: Path to directory containing one or more files
89 Login into a custom hosted docker registry and / or docker.io
91 The Jenkins system should have the following global variables defined
93 :Environment variables:
95 :DOCKER_REGISTRY: The DNS address of the registry (IP or FQDN)
96 ex: nexus3.example.com (GLOBAL variable)
98 :REGISTRY_PORTS: Required when setting ``DOCKER_REGISTRY``. Space-separated
99 list of the registry ports to login to. ex: 10001 10002 10003 10004
102 :DOCKERHUB_EMAIL: If set, then the job will attempt to login to DockerHub
103 (docker.io). Set to the email address for the credentials that will
104 get looked up. Returns the _first_ credential from the maven settings
105 file for DockerHub. (GLOBAL variable)
107 lf-infra-gpg-verify-git-signature
108 ---------------------------------
110 Verify gpg signature of the latest commit message in $WORKSPACE.
111 This command assumes that $WORKSPACE is a git repo.
116 Macro that runs before all builders to prepare the system for job use.
118 lf-infra-package-listing
119 ------------------------
121 Lists distro level packages.
123 lf-infra-packer-build
124 ---------------------
126 Run `packer build` to build system images.
128 :Required parameters:
130 :openstack: Packer template uses an OpenStack builder (true|false).
131 :openstack-cloud: Sets OS_CLOUD variable to the value of this parameter.
132 :packer-version: Version of packer to use.
133 :platform: Build platform as found in the vars directory.
134 :template: Packer template to build as found in the templates directory.
136 :Optional parameters:
138 :update-cloud-image: Submit a change request to update new built cloud
141 lf-infra-packer-validate
142 ------------------------
144 Run ``packer validate`` to verify packer configuration.
146 :Required parameters:
148 :openstack: Packer template uses an OpenStack builder (true|false).
149 :openstack-cloud: Sets OS_CLOUD variable to the value of this parameter.
150 :packer-cloud-settings: Cloud configuration file. Loaded on the build
151 server as CLOUDENV environment variable.
152 :packer-version: Version of packer to use.
154 lf-infra-push-gerrit-patch
155 --------------------------
157 Push a change through a Jenkins job to a Gerrit repository in an automated
158 way using git-review.
160 :Required parameters:
162 :gerrit-commit-message: Commit message to assign.
163 :gerrit-host: Gerrit hostname.
164 :gerrit-topic: Gerrit topic.
165 :gerrit-user: Gerrit user-id used for submitting the change.
166 :reviewers-email: Reviewers email. Space-separated list of
167 email addresses to CC on the patch.
168 :project: Gerrit project name.
170 .. _lf-infra-ship-logs:
175 Gather and deploy logs to a log server.
180 Retrieves system stats.
182 lf-infra-update-packer-images
183 -----------------------------
185 Find and update the new built cloud image{s} in the ci-management source
189 lf-jacoco-nojava-workaround
190 ---------------------------
192 Workaround for Jenkins not able to find Java in JaCoCo runs.
194 .. _lf-maven-central:
199 Publish artifacts to OSSRH (Maven Central) staging.
201 Requires that the project's settings.xml contains a ServerId 'ossrh' with the
202 credentials for the project's OSSRH account.
204 This macro assumes the directory ``$WORKSPACE/m2repo`` contains a Maven 2
205 repository which is to upload to OSSRH.
207 :Required parameters:
209 :mvn-central: Set to ``true`` to upload to mvn-central. (true|false)
210 :mvn-global-settings: The name of the Maven global settings to use for
211 Maven configuration. (default: global-settings)
212 :mvn-settings: The name of settings file containing credentials for the
214 :ossrh-profile-id: Nexus staging profile ID as provided by OSSRH.
216 .. literalinclude:: ../../.jjb-test/lf-macros/lf-maven-central-minimal.yaml
219 .. _lf-maven-install:
224 Call maven-target builder with a goal of ``--version`` to force Jenkins to
225 install the declared version of Maven. Use this as a preparation step for
226 any shell scripts that want to use Maven.
228 :Required parameters:
230 :mvn-version: Version of Maven to install.
232 lf-packagecloud-file-provider
233 -----------------------------
235 Provisions files required by the Ruby gem package_cloud, namely
236 ".packagecloud" and "packagecloud_api" in the Jenkins home directory.
241 Pushes DEB/RPM package files to PackageCloud using the Ruby gem package_cloud.
243 :Required parameters:
245 :build-dir: Directory with deb/rpm files to push
246 :debian-distribution-versions: list of DEB package distro/version strings
247 separated by space; example: ubuntu/bionic debian/stretch
248 :packagecloud-account: PackageCloud account ID; example: oran
249 :packagecloud-repo: PackageCloud repository; example: master, staging
250 :rpm-distribution-versions: list of RPM package distro/version strings
251 separated by space; example: el/4 el/5
256 Call pip install to install packages into a virtualenv located in
259 .. note:: Uses the first package listed in PIP_PACKAGES as the VENV name.
261 .. _lf-provide-maven-settings:
263 lf-provide-maven-settings
264 -------------------------
266 Push a global settings and user settings maven files to the build node.
268 lf-provide-maven-settings-cleanup
269 ---------------------------------
271 Cleanup maven ``settings.xml`` configuration. Set at the end of any macros that
273 :ref:`lf-provide-maven-settings <lf-provide-maven-settings>` macro.
278 Script to trigger a build on http://readthedocs.org
283 ReadTheDocs verify script. Installs and runs tox.
285 :Required parameters:
287 :doc-dir: Document directory.
288 :python-version: Python version.
293 Read the docs scripts that leverage the new Read the Docs v3 api
294 `RTD v3 API <https://docs.readthedocs.io/en/stable/api/v3.html>`_
295 Runs tox to verify that the docs are good and then runs the RTDv3 shell script.
296 This script handles creating projects as needed, assiging subprojects to the main
297 read the docs project and triggering builds to update the documentation.
298 Jobs will run but skip verify bits until a ``.readthedocs.yaml`` exists in the
299 root of their repository.
305 Validates votes on a changes to ``INFO.yaml``.
310 releases lftools.ini (required)
311 needed to push to nexus.
317 Then runs ../shell/release-job.sh
323 Use Sigul to sign a directory via {sign-dir}.
325 Requires ``SIGUL_BRIDGE_IP`` configured as a global envvar.
327 :Required Parameters:
328 :sign-artifacts: Set ``true`` to sign artifacts with Sigul.
329 :sign-dir: Directory to sign.
330 :sign-mode: serial|parallel
332 lf-infra-provide-docker-cleanup
333 -------------------------------
335 Forcefully removes all docker images.
340 Runs Jenkins SonarQube plug-in.
342 Requires ``SonarQube Scanner for Jenkins``
346 Optionally, set Sonar properties directly in the job definition by
347 setting the sonar-project-file to ``""`` and adding all properties under
348 ``sonar-properties``.
350 :Optional Parameters:
351 :sonar-task: Sonar task to run. (default: "")
352 :sonar-project-file: The filename for the project's properties
353 (default: "sonar-project.properties")
354 :sonar-properties: Sonar configuration properties. (default: "")
355 :sonar-java-opts: JVM options. (default: "")
356 :sonar-additional-args: Additional command line arguments. (default: "")
357 :sonar-jdk: JDK version to use. (default: openjdk17)
359 lf-infra-sonar-with-prescan
360 ---------------------------
362 Runs Jenkins SonarQube plug-in after a pre-scan builder.
364 Requires ``SonarQube Scanner for Jenkins``
368 Optionally, set Sonar properties directly in the job definition by
369 setting the sonar-project-file to ``""`` and adding all properties under
370 ``sonar-properties``.
372 :Required Parameters:
373 :lf-sonar-prescan: A builder that will run before the Sonar scan.
375 :Optional Parameters:
376 :sonar-task: Sonar task to run. (default: "")
377 :sonar-project-file: The filename for the project's properties
378 (default: "sonar-project.properties")
379 :sonar-properties: Sonar configuration properties. (default: "")
380 :sonar-java-opts: JVM options. (default: "")
381 :sonar-additional-args: Additional command line arguments. (default: "")
383 lf-infra-pipeline-verify
384 ------------------------
386 Verify a Jenkins pipeline by linting it and ensuring that it cannot run on the
392 lf-autotools-parameters
393 -----------------------
395 Provides parameters needed by configure and make. Use in any jobs that need to
396 call the ``configure && make`` pattern.
401 Provides the policy evaluation stage to run against Nexus IQ Server.
402 Valid values include: 'build', 'stage-release', 'operate'.
407 Provides parameters required by CMake. Use in any jobs that need to call the
408 ``cmake && make && make install`` pattern.
410 lf-infra-maven-parameters
411 -------------------------
413 Provides parameters required by Maven. Use in any jobs that need to call the
416 lf-infra-openstack-parameters
417 -----------------------------
419 Provides parameters needed by OpenStack client CLI. Use in jobs that need to
420 call the openstack cli.
422 :Required Parameters:
424 :os-cloud: Configures ``OS_CLOUD`` envvar as used by openstack cli.
429 Standard parameters used in the LF CI environments. GitHub projects will ignore
430 the Gerrit variables and vice-versa, so defining them is not harmful. Use in
433 lf-infra-node-parameters
434 ------------------------
436 Provides parameters needed by NodeJS and NPM. Use in any jobs that need to run
439 lf-infra-sonar-cli-parameters
440 -----------------------------
442 Provides parameters needed by Python jobs to run the SonarCloud CLI.
444 lf-infra-tox-parameters
445 -----------------------
447 Provides parameters required by python-tox. Use in any jobs that need to run
448 `tox <https://tox.readthedocs.io>`.
451 lf-build-with-parameters-maven-release
452 --------------------------------------
454 Provides parameters needed for maven release jobs 'build with parameters'.
462 Configures the build-discarder plugin for Jenkins with the recommended lf-infra
463 settings. We recommend to include in all job-templates.
471 Provides basic configuration for the JaCoCo plugin.
476 Provides basic lf-infra recommended publisher configurations for use in all job
477 templates. The purpose of this trigger is to gather package listing, instance
478 metadata, sar reports, build logs and copy them to a log server.
480 lf-infra-publish-windows
481 ------------------------
483 Windows publisher for use at the end of Windows job templates. Takes care of
484 cleaning out the workspace at the end of a job.
492 Basic SCM configuration for Gerrit based projects.
494 :Required parameters:
496 :submodule-timeout: Timeout (in minutes) for checkout operation.
498 :submodule-disable: Disable submodule checkout operation.
504 Basic SCM configuration for GitHub based projects.
506 On the `branch` variable you can assign ``$sha1`` or ``$ghprbActualCommit``
507 as the value. This will enable the jobs to trigger via the GHPRB plugin.
509 :Required parameters:
511 :submodule-timeout: Timeout (in minutes) for checkout operation.
513 :submodule-disable: Disable submodule checkout operation.
519 lf-infra-wrappers-common
520 ------------------------
522 Provides lf-infra recommended wrappers for use in every job-template. Include
523 this wrapper when creating more specific platform wrappers to ensure they pick
524 up the common settings.
529 Provides lf-infra recommended wrappers for use in every job-template targetting
532 This wrapper requires a managed file named ``npmrc`` to exist in Jenkins. The
533 main use case here is to point to a npm proxy, on Nexus for example. Set the
534 file type to "Custom file". You can set any npmrc settings in it,
535 documentation on npm configuration is available at
536 <https://docs.npmjs.com/files/npmrc>. If you are not using npm then create an
543 registry=https://nexus3.onap.org/repository/npm.public/
545 lf-infra-wrappers-windows
546 -------------------------
548 Provides lf-infra recommended wrappers for use in every job-template targetting
552 global-jjb-email-notification
553 -----------------------------
555 Provides a publisher macro that ties into the lf-openstack-cron job
556 to alert admins if this job fails.