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-capture-instance-metadata
37 - shell: !include-raw:
38 - ../shell/capture-instance-metadata.sh
41 name: lf-infra-create-netrc
44 properties-content: "SERVER_ID={server-id}"
45 - shell: !include-raw-escape: ../shell/create-netrc.sh
48 name: lf-infra-docker-login
50 - lf-provide-maven-settings:
51 global-settings-file: "{global-settings-file}"
52 settings-file: "{settings-file}"
53 - shell: !include-raw-escape: ../shell/docker-login.sh
54 - lf-provide-maven-settings-cleanup
57 name: lf-infra-gpg-verify-git-signature
58 # TODO: Verify signature after downloading users public key from a locally
59 # created repository instead of the public keymesh. This requires a process
60 # in place to get ODL developers public keys into a local repository without
61 # increasing the job thoughput.
63 - shell: !include-raw: ../shell/gpg-verify-git-signature.sh
66 name: lf-infra-pre-build
68 - shell: !include-raw-escape: ../shell/python-tools-install.sh
71 name: lf-infra-ship-logs
73 # Ensure no pre-existing .netrc files are overriding logs config
74 - lf-provide-maven-settings-cleanup
75 - config-file-provider:
77 - file-id: "jenkins-log-archives-settings"
78 variable: "SETTINGS_FILE"
80 condition-kind: regex-match
83 on-evaluation-failure: dont-run
85 - config-file-provider:
87 - file-id: "jenkins-s3-log-ship"
88 target: $HOME/.aws/credentials
89 - lf-infra-create-netrc:
91 - shell: !include-raw:
92 # Ensure python-tools are installed in case job template does not
93 # call the lf-infra-pre-build macro.
94 - ../shell/python-tools-install.sh
95 - shell: !include-raw:
96 - ../shell/sudo-logs.sh
97 - shell: !include-raw:
98 - ../shell/job-cost.sh
99 - shell: !include-raw:
100 - ../shell/logs-deploy.sh
101 - shell: !include-raw:
102 - ../shell/logs-clear-credentials.sh
103 - description-setter:
104 regexp: "(^(Nexus|S3) build logs: .*)"
107 name: lf-infra-package-listing
109 - shell: !include-raw:
110 - ../shell/package-listing.sh
113 name: lf-infra-packer-build
116 condition-kind: boolean-expression
117 condition-expression: "{openstack}"
119 - config-file-provider:
121 - file-id: clouds-yaml
122 target: "$HOME/.config/openstack/clouds.yaml"
124 properties-content: OS_CLOUD={openstack-cloud}
125 - config-file-provider:
127 - file-id: "{packer-cloud-settings}"
130 properties-content: |
131 PACKER_BUILDER={packer-builder}
132 PACKER_PLATFORM={platform}
133 PACKER_TEMPLATE={template}
134 PACKER_VERSION={packer-version}
135 UPDATE_CLOUD_IMAGE={update-cloud-image}
136 - shell: !include-raw-escape:
137 - ../shell/packer-install.sh
138 - ../shell/packer-build.sh
139 - shell: !include-raw:
140 - ../shell/packer-clear-credentials.sh
143 name: lf-infra-packer-validate
146 condition-kind: boolean-expression
147 condition-expression: "{openstack}"
149 - config-file-provider:
151 - file-id: clouds-yaml
152 target: "$HOME/.config/openstack/clouds.yaml"
154 properties-content: OS_CLOUD={openstack-cloud}
155 - config-file-provider:
157 - file-id: "{packer-cloud-settings}"
160 properties-content: |
161 PACKER_BUILDER={packer-builder}
162 PACKER_VERSION={packer-version}
163 - shell: !include-raw-escape:
164 - ../shell/packer-install.sh
165 - ../shell/packer-validate.sh
166 - shell: !include-raw:
167 - ../shell/packer-clear-credentials.sh
170 name: lf-infra-update-packer-images
172 - shell: !include-raw: ../shell/update-cloud-images.sh
175 name: lf-infra-push-gerrit-patch
178 properties-content: |
180 GERRIT_COMMIT_MESSAGE={gerrit-commit-message}
181 GERRIT_HOST={gerrit-host}
182 GERRIT_TOPIC={gerrit-topic}
183 GERRIT_USER={gerrit-user}
184 REVIEWERS_EMAIL={reviewers-email}
185 - shell: !include-raw-escape: ../shell/gerrit-push-patch.sh
188 name: lf-infra-sysstat
190 - shell: !include-raw:
191 - ../shell/sysstat.sh
194 name: lf-jacoco-nojava-workaround
196 - shell: "mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes"
199 name: lf-infra-deploy-maven-file
202 mvn-version: "{mvn-version}"
203 - lf-provide-maven-settings:
204 global-settings-file: "{global-settings-file}"
205 settings-file: "{settings-file}"
207 properties-content: |
208 MAVEN_REPO_URL={maven-repo-url}
211 UPLOAD_FILES_PATH={upload-files-dir}
212 - shell: !include-raw-escape:
213 - ../shell/common-variables.sh
214 - ../shell/deploy-maven-file.sh
215 - lf-provide-maven-settings-cleanup
218 name: lf-maven-central
221 condition-kind: boolean-expression
222 condition-expression: "{mvn-central}"
224 - lf-provide-maven-settings:
225 global-settings-file: "{mvn-global-settings}"
226 settings-file: "{mvn-settings}"
227 - lf-infra-create-netrc:
230 properties-content: "OSSRH_PROFILE_ID={ossrh-profile-id}"
231 - shell: !include-raw-escape: ../shell/maven-central.sh
232 - lf-provide-maven-settings-cleanup
235 name: lf-packagecloud-file-provider
237 - config-file-provider:
239 - file-id: ".packagecloud"
240 target: "$HOME/.packagecloud"
241 - config-file-provider:
243 - file-id: "packagecloud_api"
244 target: "$HOME/packagecloud_api"
247 name: lf-packagecloud-push
250 properties-content: |
251 BUILD_DIR={build-dir}
252 PACKAGECLOUD_ACCOUNT={packagecloud-account}
253 PACKAGECLOUD_REPO={packagecloud-repo}
254 DEBIAN_DISTRIBUTION_VERSIONS={debian-distribution-versions}
255 RPM_DISTRIBUTION_VERSIONS={rpm-distribution-versions}
256 - shell: !include-raw-escape: ../shell/packagecloud-push.sh
259 name: lf-maven-install
261 # Create a $HOME/.wgetrc to make the Maven download quiet.
262 - shell: 'echo "quiet=on" > "$HOME/.wgetrc"'
264 maven-version: "{mvn-version}"
266 - shell: 'rm "$HOME/.wgetrc"'
269 name: lf-provide-maven-settings
271 - config-file-provider:
273 - file-id: "{global-settings-file}"
274 variable: "GLOBAL_SETTINGS_FILE"
275 - file-id: "{settings-file}"
276 variable: "SETTINGS_FILE"
279 name: lf-provide-maven-settings-cleanup
283 set +e # DO NOT cause build failure if any of the rm calls fail.
285 rm -f "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
287 # In some cases we use the lf-provide-maven-settings macro to produce
288 # a "$HOME/.netrc" file containing credentials. Remove that file here
292 # DO NOT fail build if any of the above lines fail.
296 name: lf-rtd-trigger-build
299 properties-content: |
300 RTD_BUILD_URL={rtd-build-url}
301 RTD_TOKEN={rtd-token}
302 - shell: !include-raw-escape: ../shell/rtd-trigger-build.sh
308 properties-content: |
310 PYTHON={python-version}
311 - shell: !include-raw-escape: ../shell/tox-install.sh
312 - shell: !include-raw-escape: ../shell/rtd-verify.sh
318 properties-content: |
319 DEFAULT_VERSION={default-version}
320 - shell: !include-raw-escape: ../shell/rtdv3.sh
323 name: check-info-votes
326 properties-content: JENKINS_SSH_CREDENTIAL={jenkins-ssh-credential}
327 - shell: !include-raw-escape: ../shell/check-info-votes.sh
332 - config-file-provider:
334 - file-id: lftoolsini
335 target: "$HOME/.config/lftools/lftools.ini"
336 - shell: !include-raw: ../shell/release-job.sh
339 name: lf-sigul-sign-dir
340 # Requires that Jenkins be configured with SIGUL_BRIDGE_IP as a global
341 # Environment variable
344 condition-kind: boolean-expression
345 condition-expression: "{sign-artifacts}"
347 - config-file-provider:
349 - file-id: sigul-config
350 variable: SIGUL_CONFIG
351 - file-id: sigul-password
352 variable: SIGUL_PASSWORD
355 - shell: !include-raw-escape: ../shell/sigul-configuration.sh
356 - shell: !include-raw-escape: ../shell/sigul-install.sh
358 properties-content: |
360 SIGN_MODE={sign-mode}
361 - shell: !include-raw-escape:
362 - ../shell/sigul-sign-dir.sh
363 - shell: !include-raw-escape: ../shell/sigul-configuration-cleanup.sh
366 name: lf-infra-provide-docker-cleanup
370 set +e # DO NOT cause build failure if docker rmi fails
371 docker rmi -f $(docker images -a -q)
376 # Run a Sonar Jenkins Plugin
380 scanner-name: SonarQubeScanner
382 project: "{sonar-project-file}"
383 properties: "{sonar-properties}"
384 java-opts: "{sonar-java-opts}"
385 additional-arguments: "{sonar-additional-args}"
388 name: lf-infra-sonar-with-prescan
389 # Run a Sonar Jenkins Plugin
391 - lf-sonar-prescan # Must be defined by caller
394 scanner-name: SonarQubeScanner
396 project: "{sonar-project-file}"
397 properties: "{sonar-properties}"
398 java-opts: "{sonar-java-opts}"
399 additional-arguments: "{sonar-additional-args}"
402 name: lf-infra-pipeline-verify
404 - shell: !include-raw-escape: ../shell/pipeline-linter.sh
411 name: lf-autotools-parameters
412 # Parameters for configure-make builds.
416 default: "{configure-opts}"
418 Options to pass to configure.
419 Example: --build=i686-pc-linux-gnu
422 default: "{install-prefix}"
424 Install prefix for configure.
425 Usually a workspace subdirectory.
428 default: "{make-opts}"
430 Options to pass to make.
434 name: lf-clm-parameters
438 default: "{nexus-iq-stage}"
440 Stage the policy evaluation will be run against on the Nexus IQ Server.
443 name: lf-cmake-parameters
444 # Parameters useful in CMake builds.
448 default: "{build-dir}"
449 description: "Directory to build the project in."
452 default: "{cmake-opts}"
454 Options to pass to CMAKE.
455 Example: -DCMAKE_INSTALL_PREFIX=$WORKSPACE/target/output
458 default: "{install-prefix}"
459 description: "Install prefix for C/C++ builds. Example: /usr/local"
462 default: "{make-opts}"
463 description: "Options to pass to make. Example: -j8"
466 name: lf-infra-maven-parameters
470 # Sets an env var for shell scripts to be able to call the dynamically
471 # installed maven without having to calculate the M2_HOME themselves.
472 default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}"
473 description: "Maven selector to be used by shell scripts"
476 default: "{mvn-opts}"
478 Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
481 default: "{mvn-params}"
483 Maven parameters to pass to the mvn command.
486 # Sets an env var for shell scripts to be able to call the dynamically
487 # installed maven without having to calculate the path themselves.
488 # yamllint disable-line rule:line-length
489 default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}/bin/mvn"
490 description: "Maven selector to be used by shell scripts"
493 name: lf-infra-openstack-parameters
497 default: "{os-cloud}"
499 The name of a cloud configuration in clouds.yaml. OS_CLOUD is a
500 variable name that is significant to openstack client as a
501 environment variable. Please refer to the documentation for
503 https://docs.openstack.org/developer/python-openstackclient/
506 name: lf-infra-parameters
507 # Standard parameters used in the LF CI environments. Gerrit variables are
508 # not used by GitHub projects, but defining them isn't harmful.
514 Parameter to identify a SCM project to build. This is typically
515 the project repo path. For example: ofextensions/circuitsw
520 Stream is often set to the same name as 'branch' but can
521 sometimes be used as a name representing a project's release code
527 Gerrit Trigger provided parameter to identify Gerrit project that
528 triggered the build. This is typically the project repo path as
529 exists in Gerrit. For example: ofextensions/circuitsw
531 If using Gerrit, in a manual build this should match the PROJECT
537 Gerrit Trigger provided parameter to identify a Gerrit branch.
539 If using Gerrit, in a manual build override with the branch to
543 default: "refs/heads/{branch}"
545 Gerrit Trigger provided parameter to identify a refspec to fetch
548 If using Gerrit, in a manual build override with a refspec.
549 https://git-scm.com/book/en/v2/Git-Internals-The-Refspec
550 For example: 'refs/heads/master'
553 default: "origin/{branch}"
555 GitHub PR Trigger provided parameter for specifying the commit
558 If using GitHub, in a manual build override with a branch path or
559 sha1 hash to a specific commit. For example: 'origin/master'
562 name: lf-infra-node-parameters
566 default: "{node-dir}"
567 description: Path to a Node project directory.
570 default: "{node-version}"
571 description: Version of NodeJS to install.
574 name: lf-infra-tox-parameters
580 Path to directory containing tox.ini file.
583 default: "{tox-envs}"
585 Tox environments to run build against.
586 Example: docs,py2,py3
589 name: lf-build-with-parameters-maven-release
594 description: "Version to release, for example: 1.0.0"
598 description: "Tag to push to git repo; optional, defaults to VERSION"
602 description: "Log dir, for example: project-maven-stage-master/17/"
604 name: OVERRIDE_SEMVER_REGEX
606 description: "Override Semantic Version (SemVer) Regular Expression. Ex: '.*'"
608 name: DISTRIBUTION_TYPE
613 description: "Set to maven for build with parameters"
615 name: USE_RELEASE_FILE
616 default: "{use-release-file}"
617 description: "Set to False for job built with parameters"
624 name: lf-infra-properties
627 # Allow build data to be stored at a length configured by the
628 # downstream project.
629 days-to-keep: "{build-days-to-keep}"
630 # Do not allow artifacts to be stored in Jenkins.
631 artifact-num-to-keep: 0
638 name: lf-jacoco-report
641 exec-pattern: "**/**.exec"
642 class-pattern: "**/classes"
643 source-pattern: "**/src/main/java"
644 # yamllint disable-line rule:line-length
645 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
656 name: lf-infra-publish
657 # lf-infra macro to finish up a build.
659 # Handles the following:
660 # - Shipping logs to Nexus logs site repository
661 # - Cleanup workspace
674 - lf-infra-package-listing
675 - lf-infra-capture-instance-metadata
677 mark-unstable-if-failed: true
680 # Do not clean up *.jenkins-trigger files for jobs that use a
681 # properties file as input for triggering another build.
682 - "**/*.jenkins-trigger"
686 name: lf-infra-publish-windows
687 # lf-infra macro to finish up a build.
689 # Handles the following:
690 # - Shipping logs to Nexus logs site repository
691 # - Cleanup workspace
693 # TODO: RELENG-1228 Develop log shipping script for Windows systems
704 # - lf-infra-ship-logs-windows
705 # mark-unstable-if-failed: true
708 # Do not clean up *.jenkins-trigger files for jobs that use a
709 # properties file as input for triggering another build.
710 - "**/*.jenkins-trigger"
714 name: global-jjb-email-notification
717 recipients: "{email-recipients}"
719 content-type: default
720 subject: "{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!"
722 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
724 Please refer to the logs server URL for console logs when possible
725 and use the Jenkins Build URL as a last resort.
739 name: lf-infra-gerrit-scm
742 credentials-id: "{jenkins-ssh-credential}"
746 - "refs/heads/{branch}"
750 disable: "{submodule-disable}"
751 recursive: "{submodule-recursive}"
752 timeout: "{submodule-timeout}"
753 choosing-strategy: "{choosing-strategy}"
756 name: lf-infra-github-scm
759 credentials-id: "{jenkins-ssh-credential}"
767 disable: "{submodule-disable}"
768 recursive: "{submodule-recursive}"
769 timeout: "{submodule-timeout}"
770 choosing-strategy: "{choosing-strategy}"
777 name: lf-infra-wrappers-common
782 timeout: "{build-timeout}"
783 timeout-var: "BUILD_TIMEOUT"
790 name: lf-infra-wrappers
792 - lf-infra-wrappers-common:
793 build-timeout: "{build-timeout}"
794 - config-file-provider:
797 target: "$HOME/.npmrc"
799 target: "$HOME/.config/pip/pip.conf"
800 - ssh-agent-credentials:
802 - "{jenkins-ssh-credential}"
805 name: lf-infra-wrappers-windows
807 - lf-infra-wrappers-common:
808 build-timeout: "{build-timeout}"