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_VERSION={packer-version}
162 - shell: !include-raw-escape:
163 - ../shell/packer-install.sh
164 - ../shell/packer-validate.sh
165 - shell: !include-raw:
166 - ../shell/packer-clear-credentials.sh
169 name: lf-infra-update-packer-images
171 - shell: !include-raw: ../shell/update-cloud-images.sh
174 name: lf-infra-push-gerrit-patch
177 properties-content: |
179 GERRIT_COMMIT_MESSAGE={gerrit-commit-message}
180 GERRIT_HOST={gerrit-host}
181 GERRIT_TOPIC={gerrit-topic}
182 GERRIT_USER={gerrit-user}
183 REVIEWERS_EMAIL={reviewers-email}
184 - shell: !include-raw-escape: ../shell/gerrit-push-patch.sh
187 name: lf-infra-sysstat
189 - shell: !include-raw:
190 - ../shell/sysstat.sh
193 name: lf-jacoco-nojava-workaround
195 - shell: "mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes"
198 name: lf-infra-deploy-maven-file
201 mvn-version: "{mvn-version}"
202 - lf-provide-maven-settings:
203 global-settings-file: "{global-settings-file}"
204 settings-file: "{settings-file}"
206 properties-content: |
207 MAVEN_REPO_URL={maven-repo-url}
210 UPLOAD_FILES_PATH={upload-files-dir}
211 - shell: !include-raw-escape:
212 - ../shell/common-variables.sh
213 - ../shell/deploy-maven-file.sh
214 - lf-provide-maven-settings-cleanup
217 name: lf-maven-central
220 condition-kind: boolean-expression
221 condition-expression: "{mvn-central}"
223 - lf-provide-maven-settings:
224 global-settings-file: "{mvn-global-settings}"
225 settings-file: "{mvn-settings}"
226 - lf-infra-create-netrc:
229 properties-content: "OSSRH_PROFILE_ID={ossrh-profile-id}"
230 - shell: !include-raw-escape: ../shell/maven-central.sh
231 - lf-provide-maven-settings-cleanup
234 name: lf-packagecloud-file-provider
236 - config-file-provider:
238 - file-id: ".packagecloud"
239 target: "$HOME/.packagecloud"
240 - config-file-provider:
242 - file-id: "packagecloud_api"
243 target: "$HOME/packagecloud_api"
246 name: lf-packagecloud-push
249 properties-content: |
250 BUILD_DIR={build-dir}
251 PACKAGECLOUD_ACCOUNT={packagecloud-account}
252 PACKAGECLOUD_REPO={packagecloud-repo}
253 DEBIAN_DISTRIBUTION_VERSIONS={debian-distribution-versions}
254 RPM_DISTRIBUTION_VERSIONS={rpm-distribution-versions}
255 - shell: !include-raw-escape: ../shell/packagecloud-push.sh
258 name: lf-maven-install
260 # Create a $HOME/.wgetrc to make the Maven download quiet.
261 - shell: 'echo "quiet=on" > "$HOME/.wgetrc"'
263 maven-version: "{mvn-version}"
265 - shell: 'rm "$HOME/.wgetrc"'
268 name: lf-provide-maven-settings
270 - config-file-provider:
272 - file-id: "{global-settings-file}"
273 variable: "GLOBAL_SETTINGS_FILE"
274 - file-id: "{settings-file}"
275 variable: "SETTINGS_FILE"
278 name: lf-provide-maven-settings-cleanup
282 set +e # DO NOT cause build failure if any of the rm calls fail.
284 rm -f "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
286 # In some cases we use the lf-provide-maven-settings macro to produce
287 # a "$HOME/.netrc" file containing credentials. Remove that file here
291 # DO NOT fail build if any of the above lines fail.
295 name: lf-rtd-trigger-build
298 properties-content: |
299 RTD_BUILD_URL={rtd-build-url}
300 RTD_TOKEN={rtd-token}
301 - shell: !include-raw-escape: ../shell/rtd-trigger-build.sh
307 properties-content: |
309 PYTHON={python-version}
310 - shell: !include-raw-escape: ../shell/tox-install.sh
311 - shell: !include-raw-escape: ../shell/rtd-verify.sh
317 properties-content: |
318 DEFAULT_VERSION={default-version}
319 - shell: !include-raw-escape: ../shell/rtdv3.sh
322 name: check-info-votes
325 properties-content: JENKINS_SSH_CREDENTIAL={jenkins-ssh-credential}
326 - shell: !include-raw-escape: ../shell/check-info-votes.sh
331 - config-file-provider:
333 - file-id: lftoolsini
334 target: "$HOME/.config/lftools/lftools.ini"
335 - shell: !include-raw: ../shell/release-job.sh
338 name: lf-sigul-sign-dir
339 # Requires that Jenkins be configured with SIGUL_BRIDGE_IP as a global
340 # Environment variable
343 condition-kind: boolean-expression
344 condition-expression: "{sign-artifacts}"
346 - config-file-provider:
348 - file-id: sigul-config
349 variable: SIGUL_CONFIG
350 - file-id: sigul-password
351 variable: SIGUL_PASSWORD
354 - shell: !include-raw-escape: ../shell/sigul-configuration.sh
355 - shell: !include-raw-escape: ../shell/sigul-install.sh
357 properties-content: |
359 SIGN_MODE={sign-mode}
360 - shell: !include-raw-escape:
361 - ../shell/sigul-sign-dir.sh
362 - shell: !include-raw-escape: ../shell/sigul-configuration-cleanup.sh
365 name: lf-infra-provide-docker-cleanup
369 set +e # DO NOT cause build failure if docker rmi fails
370 docker rmi -f $(docker images -a -q)
375 # Run a Sonar Jenkins Plugin
379 scanner-name: SonarQubeScanner
381 project: "{sonar-project-file}"
382 properties: "{sonar-properties}"
383 java-opts: "{sonar-java-opts}"
384 additional-arguments: "{sonar-additional-args}"
387 name: lf-infra-sonar-with-prescan
388 # Run a Sonar Jenkins Plugin
390 - lf-sonar-prescan # Must be defined by caller
393 scanner-name: SonarQubeScanner
395 project: "{sonar-project-file}"
396 properties: "{sonar-properties}"
397 java-opts: "{sonar-java-opts}"
398 additional-arguments: "{sonar-additional-args}"
401 name: lf-infra-pipeline-verify
403 - shell: !include-raw-escape: ../shell/pipeline-linter.sh
410 name: lf-autotools-parameters
411 # Parameters for configure-make builds.
415 default: "{configure-opts}"
417 Options to pass to configure.
418 Example: --build=i686-pc-linux-gnu
421 default: "{install-prefix}"
423 Install prefix for configure.
424 Usually a workspace subdirectory.
427 default: "{make-opts}"
429 Options to pass to make.
433 name: lf-clm-parameters
437 default: "{nexus-iq-stage}"
439 Stage the policy evaluation will be run against on the Nexus IQ Server.
442 name: lf-cmake-parameters
443 # Parameters useful in CMake builds.
447 default: "{build-dir}"
448 description: "Directory to build the project in."
451 default: "{cmake-opts}"
453 Options to pass to CMAKE.
454 Example: -DCMAKE_INSTALL_PREFIX=$WORKSPACE/target/output
457 default: "{install-prefix}"
458 description: "Install prefix for C/C++ builds. Example: /usr/local"
461 default: "{make-opts}"
462 description: "Options to pass to make. Example: -j8"
465 name: lf-infra-maven-parameters
469 # Sets an env var for shell scripts to be able to call the dynamically
470 # installed maven without having to calculate the M2_HOME themselves.
471 default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}"
472 description: "Maven selector to be used by shell scripts"
475 default: "{mvn-opts}"
477 Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
480 default: "{mvn-params}"
482 Maven parameters to pass to the mvn command.
485 # Sets an env var for shell scripts to be able to call the dynamically
486 # installed maven without having to calculate the path themselves.
487 # yamllint disable-line rule:line-length
488 default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}/bin/mvn"
489 description: "Maven selector to be used by shell scripts"
492 name: lf-infra-openstack-parameters
496 default: "{os-cloud}"
498 The name of a cloud configuration in clouds.yaml. OS_CLOUD is a
499 variable name that is significant to openstack client as a
500 environment variable. Please refer to the documentation for
502 https://docs.openstack.org/developer/python-openstackclient/
505 name: lf-infra-parameters
506 # Standard parameters used in the LF CI environments. Gerrit variables are
507 # not used by GitHub projects, but defining them isn't harmful.
513 Parameter to identify a SCM project to build. This is typically
514 the project repo path. For example: ofextensions/circuitsw
519 Stream is often set to the same name as 'branch' but can
520 sometimes be used as a name representing a project's release code
526 Gerrit Trigger provided parameter to identify Gerrit project that
527 triggered the build. This is typically the project repo path as
528 exists in Gerrit. For example: ofextensions/circuitsw
530 If using Gerrit, in a manual build this should match the PROJECT
536 Gerrit Trigger provided parameter to identify a Gerrit branch.
538 If using Gerrit, in a manual build override with the branch to
542 default: "refs/heads/{branch}"
544 Gerrit Trigger provided parameter to identify a refspec to fetch
547 If using Gerrit, in a manual build override with a refspec.
548 https://git-scm.com/book/en/v2/Git-Internals-The-Refspec
549 For example: 'refs/heads/master'
552 default: "origin/{branch}"
554 GitHub PR Trigger provided parameter for specifying the commit
557 If using GitHub, in a manual build override with a branch path or
558 sha1 hash to a specific commit. For example: 'origin/master'
561 name: lf-infra-node-parameters
565 default: "{node-dir}"
566 description: Path to a Node project directory.
569 default: "{node-version}"
570 description: Version of NodeJS to install.
573 name: lf-infra-tox-parameters
579 Path to directory containing tox.ini file.
582 default: "{tox-envs}"
584 Tox environments to run build against.
588 name: lf-build-with-parameters-maven-release
593 description: "Version to release, for example: 1.0.0"
597 description: "Tag to push to git repo; optional, defaults to VERSION"
601 description: "Log dir, for example: project-maven-stage-master/17/"
603 name: OVERRIDE_SEMVER_REGEX
605 description: "Override Semantic Version (SemVer) Regular Expression. Ex: '.*'"
607 name: DISTRIBUTION_TYPE
612 description: "Set to maven for build with parameters"
614 name: USE_RELEASE_FILE
615 default: "{use-release-file}"
616 description: "Set to False for job built with parameters"
623 name: lf-infra-properties
626 # Allow build data to be stored at a length configured by the
627 # downstream project.
628 days-to-keep: "{build-days-to-keep}"
629 # Do not allow artifacts to be stored in Jenkins.
630 artifact-num-to-keep: 0
637 name: lf-jacoco-report
640 exec-pattern: "**/**.exec"
641 class-pattern: "**/classes"
642 source-pattern: "**/src/main/java"
643 # yamllint disable-line rule:line-length
644 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
655 name: lf-infra-publish
656 # lf-infra macro to finish up a build.
658 # Handles the following:
659 # - Shipping logs to Nexus logs site repository
660 # - Cleanup workspace
673 - lf-infra-package-listing
674 - lf-infra-capture-instance-metadata
676 mark-unstable-if-failed: true
679 # Do not clean up *.jenkins-trigger files for jobs that use a
680 # properties file as input for triggering another build.
681 - "**/*.jenkins-trigger"
685 name: lf-infra-publish-windows
686 # lf-infra macro to finish up a build.
688 # Handles the following:
689 # - Shipping logs to Nexus logs site repository
690 # - Cleanup workspace
692 # TODO: RELENG-1228 Develop log shipping script for Windows systems
703 # - lf-infra-ship-logs-windows
704 # mark-unstable-if-failed: true
707 # Do not clean up *.jenkins-trigger files for jobs that use a
708 # properties file as input for triggering another build.
709 - "**/*.jenkins-trigger"
713 name: global-jjb-email-notification
716 recipients: "{email-recipients}"
718 content-type: default
719 subject: "{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!"
721 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
723 Please refer to the logs server URL for console logs when possible
724 and use the Jenkins Build URL as a last resort.
738 name: lf-infra-gerrit-scm
741 credentials-id: "{jenkins-ssh-credential}"
745 - "refs/heads/{branch}"
749 disable: "{submodule-disable}"
750 recursive: "{submodule-recursive}"
751 timeout: "{submodule-timeout}"
752 choosing-strategy: "{choosing-strategy}"
755 name: lf-infra-github-scm
758 credentials-id: "{jenkins-ssh-credential}"
766 disable: "{submodule-disable}"
767 recursive: "{submodule-recursive}"
768 timeout: "{submodule-timeout}"
769 choosing-strategy: "{choosing-strategy}"
776 name: lf-infra-wrappers-common
781 timeout: "{build-timeout}"
782 timeout-var: "BUILD_TIMEOUT"
789 name: lf-infra-wrappers
791 - lf-infra-wrappers-common:
792 build-timeout: "{build-timeout}"
793 - config-file-provider:
796 target: "$HOME/.npmrc"
798 target: "$HOME/.config/pip/pip.conf"
799 - ssh-agent-credentials:
801 - "{jenkins-ssh-credential}"
804 name: lf-infra-wrappers-windows
806 - lf-infra-wrappers-common:
807 build-timeout: "{build-timeout}"