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-ansible-config-file-provider
17 - config-file-provider:
19 - file-id: "ansible-cfg"
20 target: "$HOME/.ansible/ansible.cfg"
23 name: lf-fetch-dependent-patches
25 - shell: !include-raw: ../shell/gerrit-fetch-dependencies.sh
27 properties-file: $WORKSPACE/.dependency.properties
30 name: lf-license-check
34 FILE_PATTERNS={file-patterns}
35 SPDX_DISABLE={spdx-disable}
36 LHC_VERSION={lhc-version}
37 LICENSE_EXCLUDE_PATHS={license-exclude-paths}
38 LICENSES_ALLOWED={licenses-allowed}
39 - shell: !include-raw-escape:
40 - ../shell/license-check.sh
43 name: lf-infra-capture-instance-metadata
45 - shell: !include-raw:
46 - ../shell/capture-instance-metadata.sh
49 name: lf-infra-create-netrc
52 properties-content: "SERVER_ID={server-id}"
53 - shell: !include-raw-escape: ../shell/create-netrc.sh
56 name: lf-infra-docker-login
58 - lf-provide-maven-settings:
59 global-settings-file: "{global-settings-file}"
60 settings-file: "{settings-file}"
61 - shell: !include-raw-escape: ../shell/docker-login.sh
62 - lf-provide-maven-settings-cleanup
65 name: lf-infra-gpg-verify-git-signature
66 # TODO: Verify signature after downloading users public key from a locally
67 # created repository instead of the public keymesh. This requires a process
68 # in place to get ODL developers public keys into a local repository without
69 # increasing the job thoughput.
71 - shell: !include-raw: ../shell/gpg-verify-git-signature.sh
74 name: lf-infra-pre-build
76 - shell: !include-raw-escape: ../shell/python-tools-install.sh
79 name: lf-infra-ship-logs
81 # Ensure no pre-existing .netrc files are overriding logs config
82 - lf-provide-maven-settings-cleanup
83 - config-file-provider:
85 - file-id: "jenkins-log-archives-settings"
86 variable: "SETTINGS_FILE"
88 condition-kind: regex-match
91 on-evaluation-failure: dont-run
93 - config-file-provider:
95 - file-id: "jenkins-s3-log-ship"
96 target: $HOME/.aws/credentials
97 - lf-infra-create-netrc:
99 - shell: !include-raw:
100 # Ensure python-tools are installed in case job template does not
101 # call the lf-infra-pre-build macro.
102 - ../shell/python-tools-install.sh
103 - shell: !include-raw:
104 - ../shell/sudo-logs.sh
105 - shell: !include-raw:
106 - ../shell/job-cost.sh
107 - shell: !include-raw:
108 - ../shell/logs-deploy.sh
109 - shell: !include-raw:
110 - ../shell/logs-clear-credentials.sh
111 - description-setter:
112 regexp: "(^(Nexus|S3) build logs: .*)"
115 name: lf-infra-package-listing
117 - shell: !include-raw:
118 - ../shell/package-listing.sh
121 name: lf-infra-packer-build
123 - lf-ansible-config-file-provider
125 condition-kind: boolean-expression
126 condition-expression: "{openstack}"
128 - config-file-provider:
130 - file-id: clouds-yaml
131 target: "$HOME/.config/openstack/clouds.yaml"
133 properties-content: OS_CLOUD={openstack-cloud}
134 - config-file-provider:
136 - file-id: "{packer-cloud-settings}"
139 properties-content: |
140 PACKER_BUILDER={packer-builder}
141 PACKER_PLATFORM={platform}
142 PACKER_TEMPLATE={template}
143 PACKER_VERSION={packer-version}
144 UPDATE_CLOUD_IMAGE={update-cloud-image}
145 - shell: !include-raw-escape:
146 - ../shell/packer-install.sh
147 - ../shell/packer-build.sh
148 - shell: !include-raw:
149 - ../shell/packer-clear-credentials.sh
152 name: lf-infra-packer-validate
155 condition-kind: boolean-expression
156 condition-expression: "{openstack}"
158 - config-file-provider:
160 - file-id: clouds-yaml
161 target: "$HOME/.config/openstack/clouds.yaml"
163 properties-content: OS_CLOUD={openstack-cloud}
164 - config-file-provider:
166 - file-id: "{packer-cloud-settings}"
169 properties-content: |
170 PACKER_VERSION={packer-version}
171 - shell: !include-raw-escape:
172 - ../shell/packer-install.sh
173 - ../shell/packer-validate.sh
174 - shell: !include-raw:
175 - ../shell/packer-clear-credentials.sh
178 name: lf-infra-update-packer-images
180 - shell: !include-raw: ../shell/update-cloud-images.sh
183 name: lf-infra-push-gerrit-patch
186 properties-content: |
188 GERRIT_COMMIT_MESSAGE={gerrit-commit-message}
189 GERRIT_HOST={gerrit-host}
190 GERRIT_TOPIC={gerrit-topic}
191 GERRIT_USER={gerrit-user}
192 REVIEWERS_EMAIL={reviewers-email}
193 - shell: !include-raw-escape: ../shell/gerrit-push-patch.sh
196 name: lf-infra-sysstat
198 - shell: !include-raw:
199 - ../shell/sysstat.sh
202 name: lf-jacoco-nojava-workaround
204 - shell: "mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes"
207 name: lf-infra-deploy-maven-file
210 mvn-version: "{mvn-version}"
211 - lf-provide-maven-settings:
212 global-settings-file: "{global-settings-file}"
213 settings-file: "{settings-file}"
215 properties-content: |
216 MAVEN_REPO_URL={maven-repo-url}
219 UPLOAD_FILES_PATH={upload-files-dir}
220 - shell: !include-raw-escape:
221 - ../shell/common-variables.sh
222 - ../shell/deploy-maven-file.sh
223 - lf-provide-maven-settings-cleanup
226 name: lf-maven-central
229 condition-kind: boolean-expression
230 condition-expression: "{mvn-central}"
232 - lf-provide-maven-settings:
233 global-settings-file: "{mvn-global-settings}"
234 settings-file: "{mvn-settings}"
235 - lf-infra-create-netrc:
238 properties-content: "OSSRH_PROFILE_ID={ossrh-profile-id}"
239 - shell: !include-raw-escape: ../shell/maven-central.sh
240 - lf-provide-maven-settings-cleanup
243 name: lf-packagecloud-file-provider
245 - config-file-provider:
247 - file-id: ".packagecloud"
248 target: "$HOME/.packagecloud"
249 - config-file-provider:
251 - file-id: "packagecloud_api"
252 target: "$HOME/packagecloud_api"
255 name: lf-packagecloud-push
258 properties-content: |
259 BUILD_DIR={build-dir}
260 PACKAGECLOUD_ACCOUNT={packagecloud-account}
261 PACKAGECLOUD_REPO={packagecloud-repo}
262 DEBIAN_DISTRIBUTION_VERSIONS={debian-distribution-versions}
263 RPM_DISTRIBUTION_VERSIONS={rpm-distribution-versions}
264 - shell: !include-raw-escape: ../shell/packagecloud-push.sh
267 name: lf-maven-install
269 # Create a $HOME/.wgetrc to make the Maven download quiet.
270 - shell: 'echo "quiet=on" > "$HOME/.wgetrc"'
272 maven-version: "{mvn-version}"
274 - shell: 'rm "$HOME/.wgetrc"'
277 name: lf-provide-maven-settings
279 - config-file-provider:
281 - file-id: "{global-settings-file}"
282 variable: "GLOBAL_SETTINGS_FILE"
283 - file-id: "{settings-file}"
284 variable: "SETTINGS_FILE"
287 name: lf-provide-maven-settings-cleanup
291 set +e # DO NOT cause build failure if any of the rm calls fail.
293 rm -f "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
295 # In some cases we use the lf-provide-maven-settings macro to produce
296 # a "$HOME/.netrc" file containing credentials. Remove that file here
300 # DO NOT fail build if any of the above lines fail.
304 name: lf-rtd-trigger-build
307 properties-content: |
308 RTD_BUILD_URL={rtd-build-url}
309 RTD_TOKEN={rtd-token}
310 - shell: !include-raw-escape: ../shell/rtd-trigger-build.sh
316 properties-content: |
318 PYTHON={python-version}
319 - shell: !include-raw-escape: ../shell/tox-install.sh
320 - shell: !include-raw-escape: ../shell/rtd-verify.sh
326 properties-content: |
327 DEFAULT_VERSION={default-version}
328 - shell: !include-raw-escape: ../shell/rtdv3.sh
331 name: check-info-votes
334 properties-content: JENKINS_SSH_CREDENTIAL={jenkins-ssh-credential}
335 - shell: !include-raw-escape: ../shell/check-info-votes.sh
340 - config-file-provider:
342 - file-id: lftoolsini
343 target: "$HOME/.config/lftools/lftools.ini"
344 - shell: !include-raw: ../shell/release-job.sh
347 name: lf-sigul-sign-dir
348 # Requires that Jenkins be configured with SIGUL_BRIDGE_IP as a global
349 # Environment variable
352 condition-kind: boolean-expression
353 condition-expression: "{sign-artifacts}"
355 - config-file-provider:
357 - file-id: sigul-config
358 variable: SIGUL_CONFIG
359 - file-id: sigul-password
360 variable: SIGUL_PASSWORD
363 - shell: !include-raw-escape: ../shell/sigul-configuration.sh
364 - shell: !include-raw-escape: ../shell/sigul-install.sh
366 properties-content: |
368 SIGN_MODE={sign-mode}
369 - shell: !include-raw-escape:
370 - ../shell/sigul-sign-dir.sh
371 - shell: !include-raw-escape: ../shell/sigul-configuration-cleanup.sh
374 name: lf-infra-provide-docker-cleanup
378 set +e # DO NOT cause build failure if docker rmi fails
379 docker rmi -f $(docker images -a -q)
384 # Run a Sonar Jenkins Plugin
388 scanner-name: SonarQubeScanner
390 project: "{sonar-project-file}"
391 properties: "{sonar-properties}"
392 java-opts: "{sonar-java-opts}"
393 additional-arguments: "{sonar-additional-args}"
396 name: lf-infra-sonar-with-prescan
397 # Run a Sonar Jenkins Plugin
399 - lf-sonar-prescan # Must be defined by caller
402 scanner-name: SonarQubeScanner
404 project: "{sonar-project-file}"
405 properties: "{sonar-properties}"
406 java-opts: "{sonar-java-opts}"
407 additional-arguments: "{sonar-additional-args}"
410 name: lf-infra-pipeline-verify
412 - shell: !include-raw-escape: ../shell/pipeline-linter.sh
419 name: lf-autotools-parameters
420 # Parameters for configure-make builds.
424 default: "{configure-opts}"
426 Options to pass to configure.
427 Example: --build=i686-pc-linux-gnu
430 default: "{install-prefix}"
432 Install prefix for configure.
433 Usually a workspace subdirectory.
436 default: "{make-opts}"
438 Options to pass to make.
442 name: lf-clm-parameters
446 default: "{nexus-iq-stage}"
448 Stage the policy evaluation will be run against on the Nexus IQ Server.
451 name: lf-cmake-parameters
452 # Parameters useful in CMake builds.
456 default: "{build-dir}"
457 description: "Directory to build the project in."
460 default: "{cmake-opts}"
462 Options to pass to CMAKE.
463 Example: -DCMAKE_INSTALL_PREFIX=$WORKSPACE/target/output
466 default: "{install-prefix}"
467 description: "Install prefix for C/C++ builds. Example: /usr/local"
470 default: "{make-opts}"
471 description: "Options to pass to make. Example: -j8"
474 name: lf-infra-maven-parameters
478 # Sets an env var for shell scripts to be able to call the dynamically
479 # installed maven without having to calculate the M2_HOME themselves.
480 default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}"
481 description: "Maven selector to be used by shell scripts"
484 default: "{mvn-opts}"
486 Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
489 default: "{mvn-params}"
491 Maven parameters to pass to the mvn command.
494 # Sets an env var for shell scripts to be able to call the dynamically
495 # installed maven without having to calculate the path themselves.
496 # yamllint disable-line rule:line-length
497 default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}/bin/mvn"
498 description: "Maven selector to be used by shell scripts"
501 name: lf-infra-openstack-parameters
505 default: "{os-cloud}"
507 The name of a cloud configuration in clouds.yaml. OS_CLOUD is a
508 variable name that is significant to openstack client as a
509 environment variable. Please refer to the documentation for
511 https://docs.openstack.org/developer/python-openstackclient/
514 name: lf-infra-parameters
515 # Standard parameters used in the LF CI environments. Gerrit variables are
516 # not used by GitHub projects, but defining them isn't harmful.
522 Parameter to identify a SCM project to build. This is typically
523 the project repo path. For example: ofextensions/circuitsw
528 Stream is often set to the same name as 'branch' but can
529 sometimes be used as a name representing a project's release code
535 Gerrit Trigger provided parameter to identify Gerrit project that
536 triggered the build. This is typically the project repo path as
537 exists in Gerrit. For example: ofextensions/circuitsw
539 If using Gerrit, in a manual build this should match the PROJECT
545 Gerrit Trigger provided parameter to identify a Gerrit branch.
547 If using Gerrit, in a manual build override with the branch to
551 default: "refs/heads/{branch}"
553 Gerrit Trigger provided parameter to identify a refspec to fetch
556 If using Gerrit, in a manual build override with a refspec.
557 https://git-scm.com/book/en/v2/Git-Internals-The-Refspec
558 For example: 'refs/heads/master'
561 default: "origin/{branch}"
563 GitHub PR Trigger provided parameter for specifying the commit
566 If using GitHub, in a manual build override with a branch path or
567 sha1 hash to a specific commit. For example: 'origin/master'
570 name: lf-infra-node-parameters
574 default: "{node-dir}"
575 description: Path to a Node project directory.
578 default: "{node-version}"
579 description: Version of NodeJS to install.
582 name: lf-infra-tox-parameters
588 Path to directory containing tox.ini file.
591 default: "{tox-envs}"
593 Tox environments to run build against.
597 name: lf-build-with-parameters-maven-release
602 description: "Version to release, for example: 1.0.0"
606 description: "Tag to push to git repo; optional, defaults to VERSION"
610 description: "Log dir, for example: project-maven-stage-master/17/"
612 name: OVERRIDE_SEMVER_REGEX
614 description: "Override Semantic Version (SemVer) Regular Expression. Ex: '.*'"
616 name: DISTRIBUTION_TYPE
621 description: "Set to maven for build with parameters"
623 name: USE_RELEASE_FILE
624 default: "{use-release-file}"
625 description: "Set to False for job built with parameters"
632 name: lf-infra-properties
635 # Allow build data to be stored at a length configured by the
636 # downstream project.
637 days-to-keep: "{build-days-to-keep}"
638 # Do not allow artifacts to be stored in Jenkins.
639 artifact-num-to-keep: 0
646 name: lf-jacoco-report
649 exec-pattern: "**/**.exec"
650 class-pattern: "**/classes"
651 source-pattern: "**/src/main/java"
652 # yamllint disable-line rule:line-length
653 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
664 name: lf-infra-publish
665 # lf-infra macro to finish up a build.
667 # Handles the following:
668 # - Shipping logs to Nexus logs site repository
669 # - Cleanup workspace
682 - lf-infra-package-listing
683 - lf-infra-capture-instance-metadata
685 mark-unstable-if-failed: true
688 # Do not clean up *.jenkins-trigger files for jobs that use a
689 # properties file as input for triggering another build.
690 - "**/*.jenkins-trigger"
694 name: lf-infra-publish-windows
695 # lf-infra macro to finish up a build.
697 # Handles the following:
698 # - Shipping logs to Nexus logs site repository
699 # - Cleanup workspace
701 # TODO: RELENG-1228 Develop log shipping script for Windows systems
712 # - lf-infra-ship-logs-windows
713 # mark-unstable-if-failed: true
716 # Do not clean up *.jenkins-trigger files for jobs that use a
717 # properties file as input for triggering another build.
718 - "**/*.jenkins-trigger"
722 name: global-jjb-email-notification
725 recipients: "{email-recipients}"
727 content-type: default
728 subject: "{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!"
730 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
732 Please refer to the logs server URL for console logs when possible
733 and use the Jenkins Build URL as a last resort.
747 name: lf-infra-gerrit-scm
750 credentials-id: "{jenkins-ssh-credential}"
754 - "refs/heads/{branch}"
758 disable: "{submodule-disable}"
759 recursive: "{submodule-recursive}"
760 timeout: "{submodule-timeout}"
761 choosing-strategy: "{choosing-strategy}"
764 name: lf-infra-github-scm
767 credentials-id: "{jenkins-ssh-credential}"
775 disable: "{submodule-disable}"
776 recursive: "{submodule-recursive}"
777 timeout: "{submodule-timeout}"
778 choosing-strategy: "{choosing-strategy}"
785 name: lf-infra-wrappers-common
790 timeout: "{build-timeout}"
791 timeout-var: "BUILD_TIMEOUT"
798 name: lf-infra-wrappers
800 - lf-infra-wrappers-common:
801 build-timeout: "{build-timeout}"
802 - config-file-provider:
805 target: "$HOME/.npmrc"
807 target: "$HOME/.config/pip/pip.conf"
808 - ssh-agent-credentials:
810 - "{jenkins-ssh-credential}"
813 name: lf-infra-wrappers-windows
815 - lf-infra-wrappers-common:
816 build-timeout: "{build-timeout}"