6 # To take advantage of this macro, have your build write
7 # out the file 'gerrit_comment.txt' with information to post
8 # back to gerrit and include this macro in the list of builders.
10 name: comment-to-gerrit
12 - shell: !include-raw: ../shell/comment-to-gerrit.sh
15 name: lf-fetch-dependent-patches
17 - shell: !include-raw: ../shell/gerrit-fetch-dependencies.sh
19 properties-file: $WORKSPACE/.dependency.properties
22 name: lf-license-check
26 FILE_PATTERNS={file-patterns}
27 SPDX_DISABLE={spdx-disable}
28 LHC_VERSION={lhc-version}
29 LICENSE_EXCLUDE_PATHS={license-exclude-paths}
30 LICENSES_ALLOWED={licenses-allowed}
31 - shell: !include-raw-escape:
32 - ../shell/license-check.sh
35 name: lf-infra-create-netrc
38 properties-content: "SERVER_ID={server-id}"
39 - shell: !include-raw-escape: ../shell/create-netrc.sh
42 name: lf-infra-docker-login
44 - lf-provide-maven-settings:
45 global-settings-file: "{global-settings-file}"
46 settings-file: "{settings-file}"
47 - shell: !include-raw-escape: ../shell/docker-login.sh
48 - lf-provide-maven-settings-cleanup
51 name: lf-infra-gpg-verify-git-signature
52 # TODO: Verify signature after downloading users public key from a locally
53 # created repository instead of the public keymesh. This requires a process
54 # in place to get ODL developers public keys into a local repository without
55 # increasing the job thoughput.
57 - shell: !include-raw: ../shell/gpg-verify-git-signature.sh
60 name: lf-infra-pre-build
62 - shell: !include-raw-escape: ../shell/python-tools-install.sh
65 name: lf-infra-ship-logs
67 # Ensure no pre-existing .netrc files are overriding logs config
68 - lf-provide-maven-settings-cleanup
69 - config-file-provider:
71 - file-id: "jenkins-log-archives-settings"
72 variable: "SETTINGS_FILE"
73 - lf-infra-create-netrc:
75 - shell: !include-raw:
76 # Ensure python-tools are installed in case job template does not
77 # call the lf-infra-pre-build macro.
78 - ../shell/python-tools-install.sh
79 - shell: !include-raw:
80 - ../shell/sudo-logs.sh
81 - shell: !include-raw:
82 - ../shell/job-cost.sh
83 - shell: !include-raw:
84 - ../shell/logs-deploy.sh
85 - shell: !include-raw:
86 - ../shell/logs-clear-credentials.sh
88 regexp: "^Build logs: .*"
91 name: lf-infra-package-listing
93 - shell: !include-raw:
94 - ../shell/package-listing.sh
97 name: lf-infra-packer-build
100 condition-kind: boolean-expression
101 condition-expression: "{openstack}"
103 - config-file-provider:
105 - file-id: clouds-yaml
106 target: "$HOME/.config/openstack/clouds.yaml"
108 properties-content: OS_CLOUD={openstack-cloud}
109 - config-file-provider:
111 - file-id: "{packer-cloud-settings}"
114 properties-content: |
115 PACKER_PLATFORM={platform}
116 PACKER_TEMPLATE={template}
117 PACKER_VERSION={packer-version}
118 UPDATE_CLOUD_IMAGE={update-cloud-image}
119 - shell: !include-raw-escape:
120 - ../shell/packer-install.sh
121 - ../shell/packer-build.sh
122 - shell: !include-raw:
123 - ../shell/packer-clear-credentials.sh
126 name: lf-infra-packer-validate
129 condition-kind: boolean-expression
130 condition-expression: "{openstack}"
132 - config-file-provider:
134 - file-id: clouds-yaml
135 target: "$HOME/.config/openstack/clouds.yaml"
137 properties-content: OS_CLOUD={openstack-cloud}
138 - config-file-provider:
140 - file-id: "{packer-cloud-settings}"
143 properties-content: |
144 PACKER_VERSION={packer-version}
145 - shell: !include-raw-escape:
146 - ../shell/packer-install.sh
147 - ../shell/packer-validate.sh
148 - shell: !include-raw:
149 - ../shell/packer-clear-credentials.sh
152 name: lf-infra-update-packer-images
154 - shell: !include-raw: ../shell/update-cloud-images.sh
157 name: lf-infra-push-gerrit-patch
160 properties-content: |
162 GERRIT_COMMIT_MESSAGE={gerrit-commit-message}
163 GERRIT_HOST={gerrit-host}
164 GERRIT_TOPIC={gerrit-topic}
165 GERRIT_USER={gerrit-user}
166 REVIEWERS_EMAIL={reviewers-email}
167 - shell: !include-raw-escape: ../shell/gerrit-push-patch.sh
170 name: lf-infra-sysstat
172 - shell: !include-raw:
173 - ../shell/sysstat.sh
176 name: lf-jacoco-nojava-workaround
178 - shell: "mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes"
181 name: lf-infra-deploy-maven-file
184 mvn-version: "{mvn-version}"
185 - lf-provide-maven-settings:
186 global-settings-file: "{global-settings-file}"
187 settings-file: "{settings-file}"
189 properties-content: |
190 MAVEN_REPO_URL={maven-repo-url}
193 UPLOAD_FILES_PATH={upload-files-dir}
194 - shell: !include-raw-escape:
195 - ../shell/common-variables.sh
196 - ../shell/deploy-maven-file.sh
197 - lf-provide-maven-settings-cleanup
200 name: lf-maven-central
203 condition-kind: boolean-expression
204 condition-expression: "{mvn-central}"
206 - lf-provide-maven-settings:
207 global-settings-file: "{mvn-global-settings}"
208 settings-file: "{mvn-settings}"
209 - lf-infra-create-netrc:
212 properties-content: "OSSRH_PROFILE_ID={ossrh-profile-id}"
213 - shell: !include-raw-escape: ../shell/maven-central.sh
214 - lf-provide-maven-settings-cleanup
217 name: lf-maven-install
219 # Create a $HOME/.wgetrc to make the Maven download quiet.
220 - shell: 'echo "quiet=on" > "$HOME/.wgetrc"'
222 maven-version: "{mvn-version}"
224 - shell: 'rm "$HOME/.wgetrc"'
227 name: lf-provide-maven-settings
229 - config-file-provider:
231 - file-id: "{global-settings-file}"
232 variable: "GLOBAL_SETTINGS_FILE"
233 - file-id: "{settings-file}"
234 variable: "SETTINGS_FILE"
240 properties-content: PIP_PACKAGES={pip-packages}
241 - shell: !include-raw-escape: ../shell/pip-install.sh
244 name: lf-provide-maven-settings-cleanup
248 set +e # DO NOT cause build failure if any of the rm calls fail.
250 rm -f "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
252 # In some cases we use the lf-provide-maven-settings macro to produce
253 # a "$HOME/.netrc" file containing credentials. Remove that file here
257 # DO NOT fail build if any of the above lines fail.
261 name: lf-rtd-trigger-build
264 properties-content: |
265 RTD_BUILD_URL={rtd-build-url}
266 RTD_TOKEN={rtd-token}
267 - shell: !include-raw-escape: ../shell/rtd-trigger-build.sh
273 properties-content: |
275 PYTHON={python-version}
276 - shell: !include-raw-escape: ../shell/tox-install.sh
277 - shell: !include-raw-escape: ../shell/rtd-verify.sh
284 condition-kind: file-exists
285 condition-filename: .readthedocs.yaml
286 on-evaluation-failure: dont-run
289 properties-content: |
290 TOX_ENVS=docs,docs-linkcheck
292 - lf-infra-tox-install:
293 python-version: "python3"
294 - shell: !include-raw: ../shell/tox-run.sh
295 - shell: !include-raw: ../shell/rtdv3.sh
298 name: check-info-votes
301 properties-content: JENKINS_SSH_CREDENTIAL={jenkins-ssh-credential}
302 - shell: !include-raw-escape: ../shell/check-info-votes.sh
307 - config-file-provider:
309 - file-id: lftoolsini
310 target: "$HOME/.config/lftools/lftools.ini"
311 - shell: !include-raw: ../shell/release-job.sh
314 name: lf-sigul-sign-dir
315 # Requires that Jenkins be configured with SIGUL_BRIDGE_IP as a global
316 # Environment variable
319 condition-kind: boolean-expression
320 condition-expression: "{sign-artifacts}"
322 - config-file-provider:
324 - file-id: sigul-config
325 variable: SIGUL_CONFIG
326 - file-id: sigul-password
327 variable: SIGUL_PASSWORD
330 - shell: !include-raw-escape: ../shell/sigul-configuration.sh
331 - shell: !include-raw-escape: ../shell/sigul-install.sh
333 properties-content: |
335 SIGN_MODE={sign-mode}
336 - shell: !include-raw-escape:
337 - ../shell/sigul-sign-dir.sh
338 - shell: !include-raw-escape: ../shell/sigul-configuration-cleanup.sh
341 name: lf-infra-provide-docker-cleanup
345 set +e # DO NOT cause build failure if docker rmi fails
346 docker rmi -f $(docker images -a -q)
351 # Run a Sonar Jenkins Plugin
355 scanner-name: SonarQubeScanner
357 project: "{sonar-project-file}"
358 properties: "{sonar-properties}"
359 java-opts: "{sonar-java-opts}"
360 additional-arguments: "{sonar-additional-args}"
363 name: lf-infra-sonar-with-prescan
364 # Run a Sonar Jenkins Plugin
366 - lf-sonar-prescan # Must be defined by caller
369 scanner-name: SonarQubeScanner
371 project: "{sonar-project-file}"
372 properties: "{sonar-properties}"
373 java-opts: "{sonar-java-opts}"
374 additional-arguments: "{sonar-additional-args}"
381 name: lf-clm-parameters
385 default: "{nexus-iq-stage}"
387 Stage the policy evaluation will be run against on the Nexus IQ Server.
390 name: lf-cmake-parameters
391 # Parameters useful in CMake builds.
395 default: "{build-dir}"
396 description: "Directory to build the project in."
399 default: "{cmake-opts}"
401 Options to pass to CMAKE.
402 Example: -DCMAKE_INSTALL_PREFIX=$WORKSPACE/target/output
405 default: "{install-prefix}"
406 description: "Install prefix for C/C++ builds. Example: /usr/local"
409 default: "{make-opts}"
410 description: "Options to pass to make. Example: -j8"
413 name: lf-infra-maven-parameters
417 # Sets an env var for shell scripts to be able to call the dynamically
418 # installed maven without having to calculate the M2_HOME themselves.
419 default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}"
420 description: "Maven selector to be used by shell scripts"
423 default: "{mvn-opts}"
425 Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
428 default: "{mvn-params}"
430 Maven parameters to pass to the mvn command.
433 # Sets an env var for shell scripts to be able to call the dynamically
434 # installed maven without having to calculate the path themselves.
435 # yamllint disable-line rule:line-length
436 default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}/bin/mvn"
437 description: "Maven selector to be used by shell scripts"
440 name: lf-infra-openstack-parameters
444 default: "{os-cloud}"
446 The name of a cloud configuration in clouds.yaml. OS_CLOUD is a
447 variable name that is significant to openstack client as a
448 environment variable. Please refer to the documentation for
450 https://docs.openstack.org/developer/python-openstackclient/
453 name: lf-infra-parameters
454 # Standard parameters used in the LF CI environments. Gerrit variables are
455 # not used by GitHub projects, but defining them isn't harmful.
461 Parameter to identify a SCM project to build. This is typically
462 the project repo path. For example: ofextensions/circuitsw
467 Stream is often set to the same name as 'branch' but can
468 sometimes be used as a name representing a project's release code
474 Gerrit Trigger provided parameter to identify Gerrit project that
475 triggered the build. This is typically the project repo path as
476 exists in Gerrit. For example: ofextensions/circuitsw
478 If using Gerrit, in a manual build this should match the PROJECT
484 Gerrit Trigger provided parameter to identify a Gerrit branch.
486 If using Gerrit, in a manual build override with the branch to
490 default: "refs/heads/{branch}"
492 Gerrit Trigger provided parameter to identify a refspec to fetch
495 If using Gerrit, in a manual build override with a refspec.
496 https://git-scm.com/book/en/v2/Git-Internals-The-Refspec
497 For example: 'refs/heads/master'
500 default: "origin/{branch}"
502 GitHub PR Trigger provided parameter for specifying the commit
505 If using GitHub, in a manual build override with a branch path or
506 sha1 hash to a specific commit. For example: 'origin/master'
509 name: lf-infra-node-parameters
513 default: "{node-dir}"
514 description: Path to a Node project directory.
517 default: "{node-version}"
518 description: Version of NodeJS to install.
521 name: lf-infra-tox-parameters
527 Path to directory containing tox.ini file.
530 default: "{tox-envs}"
532 Tox environments to run build against.
533 Example: docs,py2,py3
536 name: lf-build-with-parameters-maven-release
541 description: "Version to release, for example: 1.0.0"
545 description: "Tag to push to git repo; optional, defaults to VERSION"
549 description: "Log dir, for example: project-maven-stage-master/17/"
551 name: DISTRIBUTION_TYPE
556 description: "Set to maven for build with parameters"
558 name: USE_RELEASE_FILE
559 default: "{use-release-file}"
560 description: "Set to False for job built with parameters"
567 name: lf-infra-properties
570 # Allow build data to be stored at a length configured by the
571 # downstream project.
572 days-to-keep: "{build-days-to-keep}"
573 # Do not allow artifacts to be stored in Jenkins.
574 artifact-num-to-keep: 0
581 name: lf-jacoco-report
584 exec-pattern: "**/**.exec"
585 class-pattern: "**/classes"
586 source-pattern: "**/src/main/java"
587 # yamllint disable-line rule:line-length
588 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
599 name: lf-infra-publish
600 # lf-infra macro to finish up a build.
602 # Handles the following:
603 # - Shipping logs to Nexus logs site repository
604 # - Cleanup workspace
617 - lf-infra-package-listing
619 mark-unstable-if-failed: true
622 # Do not clean up *.jenkins-trigger files for jobs that use a
623 # properties file as input for triggering another build.
624 - "**/*.jenkins-trigger"
628 name: lf-infra-publish-windows
629 # lf-infra macro to finish up a build.
631 # Handles the following:
632 # - Shipping logs to Nexus logs site repository
633 # - Cleanup workspace
635 # TODO: RELENG-1228 Develop log shipping script for Windows systems
646 # - lf-infra-ship-logs-windows
647 # mark-unstable-if-failed: true
650 # Do not clean up *.jenkins-trigger files for jobs that use a
651 # properties file as input for triggering another build.
652 - "**/*.jenkins-trigger"
660 name: lf-infra-gerrit-scm
663 credentials-id: "{jenkins-ssh-credential}"
667 - "refs/heads/{branch}"
671 disable: "{submodule-disable}"
672 recursive: "{submodule-recursive}"
673 timeout: "{submodule-timeout}"
674 choosing-strategy: "{choosing-strategy}"
677 name: lf-infra-github-scm
680 credentials-id: "{jenkins-ssh-credential}"
688 disable: "{submodule-disable}"
689 recursive: "{submodule-recursive}"
690 timeout: "{submodule-timeout}"
691 choosing-strategy: "{choosing-strategy}"
698 name: lf-infra-wrappers-common
703 timeout: "{build-timeout}"
704 timeout-var: "BUILD_TIMEOUT"
711 name: lf-infra-wrappers
713 - lf-infra-wrappers-common:
714 build-timeout: "{build-timeout}"
715 - config-file-provider:
718 target: "$HOME/.npmrc"
720 target: "$HOME/.config/pip/pip.conf"
721 - ssh-agent-credentials:
723 - "{jenkins-ssh-credential}"
726 name: lf-infra-wrappers-windows
728 - lf-infra-wrappers-common:
729 build-timeout: "{build-timeout}"