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-escape: ../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-escape:
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-escape:
104 - ../shell/sudo-logs.sh
105 - shell: !include-raw-escape:
106 - ../shell/job-cost.sh
107 - shell: !include-raw-escape:
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-escape:
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}"
137 target: "$HOME/.config/jenkins_jobs/cloud-env.pkrvars.hcl"
140 properties-content: |
141 PACKER_BUILDER={packer-builder}
142 PACKER_PLATFORM={platform}
143 PACKER_TEMPLATE={template}
144 PACKER_VERSION={packer-version}
145 UPDATE_CLOUD_IMAGE={update-cloud-image}
146 - shell: !include-raw-escape:
147 - ../shell/packer-install.sh
148 - ../shell/packer-build.sh
149 - shell: !include-raw:
150 - ../shell/packer-clear-credentials.sh
153 name: lf-infra-packer-validate
156 condition-kind: boolean-expression
157 condition-expression: "{openstack}"
159 - config-file-provider:
161 - file-id: clouds-yaml
162 target: "$HOME/.config/openstack/clouds.yaml"
164 properties-content: OS_CLOUD={openstack-cloud}
165 - config-file-provider:
167 - file-id: "{packer-cloud-settings}"
168 target: "$HOME/.config/jenkins_jobs/cloud-env.pkrvars.hcl"
171 properties-content: |
172 PACKER_VERSION={packer-version}
173 - shell: !include-raw-escape:
174 - ../shell/packer-install.sh
175 - ../shell/packer-validate.sh
176 - shell: !include-raw:
177 - ../shell/packer-clear-credentials.sh
180 name: lf-infra-update-packer-images
182 - shell: !include-raw-escape: ../shell/update-cloud-images.sh
185 name: lf-infra-push-gerrit-patch
188 properties-content: |
190 GERRIT_COMMIT_MESSAGE={gerrit-commit-message}
191 GERRIT_HOST={gerrit-host}
192 GERRIT_TOPIC={gerrit-topic}
193 GERRIT_USER={gerrit-user}
194 REVIEWERS_EMAIL={reviewers-email}
195 - shell: !include-raw-escape: ../shell/gerrit-push-patch.sh
198 name: lf-infra-sysstat
200 - shell: !include-raw-escape:
201 - ../shell/sysstat.sh
204 name: lf-jacoco-nojava-workaround
206 - shell: "mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes"
209 name: lf-infra-deploy-maven-file
212 mvn-version: "{mvn-version}"
213 - lf-provide-maven-settings:
214 global-settings-file: "{global-settings-file}"
215 settings-file: "{settings-file}"
217 properties-content: |
218 MAVEN_REPO_URL={maven-repo-url}
221 UPLOAD_FILES_PATH={upload-files-dir}
222 - shell: !include-raw-escape:
223 - ../shell/common-variables.sh
224 - ../shell/deploy-maven-file.sh
225 - lf-provide-maven-settings-cleanup
228 name: lf-maven-central
231 condition-kind: boolean-expression
232 condition-expression: "{mvn-central}"
234 - lf-provide-maven-settings:
235 global-settings-file: "{mvn-global-settings}"
236 settings-file: "{mvn-settings}"
237 - lf-infra-create-netrc:
240 properties-content: "OSSRH_PROFILE_ID={ossrh-profile-id}"
241 - shell: !include-raw-escape: ../shell/maven-central.sh
242 - lf-provide-maven-settings-cleanup
245 name: lf-packagecloud-file-provider
247 - config-file-provider:
249 - file-id: ".packagecloud"
250 target: "$HOME/.packagecloud"
251 - config-file-provider:
253 - file-id: "packagecloud_api"
254 target: "$HOME/packagecloud_api"
257 name: lf-packagecloud-push
260 properties-content: |
261 BUILD_DIR={build-dir}
262 PACKAGECLOUD_ACCOUNT={packagecloud-account}
263 PACKAGECLOUD_REPO={packagecloud-repo}
264 DEBIAN_DISTRIBUTION_VERSIONS={debian-distribution-versions}
265 RPM_DISTRIBUTION_VERSIONS={rpm-distribution-versions}
266 - shell: !include-raw-escape: ../shell/packagecloud-push.sh
269 name: lf-maven-install
271 # Create a $HOME/.wgetrc to make the Maven download quiet.
272 - shell: 'echo "quiet=on" > "$HOME/.wgetrc"'
274 maven-version: "{mvn-version}"
276 - shell: 'rm "$HOME/.wgetrc"'
279 name: lf-provide-maven-settings
281 - config-file-provider:
283 - file-id: "{global-settings-file}"
284 variable: "GLOBAL_SETTINGS_FILE"
285 - file-id: "{settings-file}"
286 variable: "SETTINGS_FILE"
289 name: lf-provide-maven-settings-cleanup
293 set +e # DO NOT cause build failure if any of the rm calls fail.
295 rm -f "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
297 # In some cases we use the lf-provide-maven-settings macro to produce
298 # a "$HOME/.netrc" file containing credentials. Remove that file here
302 # DO NOT fail build if any of the above lines fail.
306 name: lf-rtd-trigger-build
309 properties-content: |
310 RTD_BUILD_URL={rtd-build-url}
311 RTD_TOKEN={rtd-token}
312 - shell: !include-raw-escape: ../shell/rtd-trigger-build.sh
318 properties-content: |
320 PYTHON={python-version}
321 - shell: !include-raw-escape: ../shell/tox-install.sh
322 - shell: !include-raw-escape: ../shell/rtd-verify.sh
328 properties-content: |
329 DEFAULT_VERSION={default-version}
330 - shell: !include-raw-escape: ../shell/rtdv3.sh
333 name: check-info-votes
336 properties-content: JENKINS_SSH_CREDENTIAL={jenkins-ssh-credential}
337 - shell: !include-raw-escape: ../shell/check-info-votes.sh
342 - config-file-provider:
344 - file-id: lftoolsini
345 target: "$HOME/.config/lftools/lftools.ini"
346 - shell: !include-raw-escape: ../shell/release-job.sh
349 name: lf-sigul-sign-dir
350 # Requires that Jenkins be configured with SIGUL_BRIDGE_IP as a global
351 # Environment variable
354 condition-kind: boolean-expression
355 condition-expression: "{sign-artifacts}"
357 - config-file-provider:
359 - file-id: sigul-config
360 variable: SIGUL_CONFIG
361 - file-id: sigul-password
362 variable: SIGUL_PASSWORD
365 - shell: !include-raw-escape: ../shell/sigul-configuration.sh
366 - shell: !include-raw-escape: ../shell/sigul-install.sh
368 properties-content: |
370 SIGN_MODE={sign-mode}
371 - shell: !include-raw-escape:
372 - ../shell/sigul-sign-dir.sh
373 - shell: !include-raw-escape: ../shell/sigul-configuration-cleanup.sh
376 name: lf-infra-provide-docker-cleanup
380 set +e # DO NOT cause build failure if docker rmi fails
381 docker rmi -f $(docker images -a -q)
386 # Run a Sonar Jenkins Plugin
390 scanner-name: SonarQubeScanner
392 project: "{sonar-project-file}"
393 properties: "{sonar-properties}"
394 java-opts: "{sonar-java-opts}"
395 additional-arguments: "{sonar-additional-args}"
399 name: lf-infra-sonar-with-prescan
400 # Run a Sonar Jenkins Plugin
402 - lf-sonar-prescan # Must be defined by caller
405 scanner-name: SonarQubeScanner
407 project: "{sonar-project-file}"
408 properties: "{sonar-properties}"
409 java-opts: "{sonar-java-opts}"
410 additional-arguments: "{sonar-additional-args}"
413 name: lf-infra-pipeline-verify
415 - shell: !include-raw-escape: ../shell/pipeline-linter.sh
422 name: lf-autotools-parameters
423 # Parameters for configure-make builds.
427 default: "{configure-opts}"
429 Options to pass to configure.
430 Example: --build=i686-pc-linux-gnu
433 default: "{install-prefix}"
435 Install prefix for configure.
436 Usually a workspace subdirectory.
439 default: "{make-opts}"
441 Options to pass to make.
445 name: lf-clm-parameters
449 default: "{nexus-iq-stage}"
451 Stage the policy evaluation will be run against on the Nexus IQ Server.
454 name: lf-cmake-parameters
455 # Parameters useful in CMake builds.
459 default: "{build-dir}"
460 description: "Directory to build the project in."
463 default: "{cmake-opts}"
465 Options to pass to CMAKE.
466 Example: -DCMAKE_INSTALL_PREFIX=$WORKSPACE/target/output
469 default: "{install-prefix}"
470 description: "Install prefix for C/C++ builds. Example: /usr/local"
473 default: "{make-opts}"
474 description: "Options to pass to make. Example: -j8"
477 name: lf-infra-maven-parameters
481 # Sets an env var for shell scripts to be able to call the dynamically
482 # installed maven without having to calculate the M2_HOME themselves.
483 default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}"
484 description: "Maven selector to be used by shell scripts"
487 default: "{mvn-opts}"
489 Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
492 default: "{mvn-params}"
494 Maven parameters to pass to the mvn command.
497 # Sets an env var for shell scripts to be able to call the dynamically
498 # installed maven without having to calculate the path themselves.
499 # yamllint disable-line rule:line-length
500 default: "/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}/bin/mvn"
501 description: "Maven selector to be used by shell scripts"
504 name: lf-infra-openstack-parameters
508 default: "{os-cloud}"
510 The name of a cloud configuration in clouds.yaml. OS_CLOUD is a
511 variable name that is significant to openstack client as a
512 environment variable. Please refer to the documentation for
514 https://docs.openstack.org/developer/python-openstackclient/
517 name: lf-infra-parameters
518 # Standard parameters used in the LF CI environments. Gerrit variables are
519 # not used by GitHub projects, but defining them isn't harmful.
525 Parameter to identify a SCM project to build. This is typically
526 the project repo path. For example: ofextensions/circuitsw
531 Stream is often set to the same name as 'branch' but can
532 sometimes be used as a name representing a project's release code
538 Gerrit Trigger provided parameter to identify Gerrit project that
539 triggered the build. This is typically the project repo path as
540 exists in Gerrit. For example: ofextensions/circuitsw
542 If using Gerrit, in a manual build this should match the PROJECT
548 Gerrit Trigger provided parameter to identify a Gerrit branch.
550 If using Gerrit, in a manual build override with the branch to
554 default: "refs/heads/{branch}"
556 Gerrit Trigger provided parameter to identify a refspec to fetch
559 If using Gerrit, in a manual build override with a refspec.
560 https://git-scm.com/book/en/v2/Git-Internals-The-Refspec
561 For example: 'refs/heads/master'
564 default: "origin/{branch}"
566 GitHub PR Trigger provided parameter for specifying the commit
569 If using GitHub, in a manual build override with a branch path or
570 sha1 hash to a specific commit. For example: 'origin/master'
573 name: lf-infra-node-parameters
577 default: "{node-dir}"
578 description: Path to a Node project directory.
581 default: "{node-version}"
582 description: Version of NodeJS to install.
585 name: lf-infra-sonar-cli-parameters
591 Path to directory containing tox.ini file.
594 default: "{tox-envs}"
596 Tox environments to run build against.
598 name: SONAR_SCANNER_VERSION
599 default: "{sonar-scanner-version}"
601 Version of sonar scanner to use.
604 name: SONAR_SCANNER_HOME
605 default: "{sonar-scanner-home}"
607 Sonar scanner home directory.
608 Example: $WORKSPACE/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
610 name: SONAR_SCANNER_OPTS
611 default: "{sonar-scanner-opts}"
613 Sonar scanner Java options.
617 name: lf-infra-tox-parameters
623 Path to directory containing tox.ini file.
626 default: "{tox-envs}"
628 Tox environments to run build against.
632 name: lf-build-with-parameters-maven-release
637 description: "Version to release, for example: 1.0.0"
641 description: "Tag to push to git repo; optional, defaults to VERSION"
645 description: "Log dir, for example: project-maven-stage-master/17/"
647 name: OVERRIDE_SEMVER_REGEX
649 description: "Override Semantic Version (SemVer) Regular Expression. Ex: '.*'"
651 name: DISTRIBUTION_TYPE
656 description: "Set to maven for build with parameters"
658 name: USE_RELEASE_FILE
659 default: "{use-release-file}"
660 description: "Set to False for job built with parameters"
667 name: lf-infra-properties
670 # Allow build data to be stored at a length configured by the
671 # downstream project.
672 days-to-keep: "{build-days-to-keep}"
673 # Do not allow artifacts to be stored in Jenkins.
674 artifact-num-to-keep: 0
681 name: lf-jacoco-report
684 exec-pattern: "**/**.exec"
685 class-pattern: "**/classes"
686 source-pattern: "**/src/main/java"
687 # yamllint disable-line rule:line-length
688 exclusion-pattern: "{exclude-pattern}"
699 name: lf-infra-publish
700 # lf-infra macro to finish up a build.
702 # Handles the following:
703 # - Shipping logs to Nexus logs site repository
704 # - Cleanup workspace
717 - lf-infra-package-listing
718 - lf-infra-capture-instance-metadata
720 mark-unstable-if-failed: true
723 # Do not clean up *.jenkins-trigger files for jobs that use a
724 # properties file as input for triggering another build.
725 - "**/*.jenkins-trigger"
729 name: lf-infra-publish-windows
730 # lf-infra macro to finish up a build.
732 # Handles the following:
733 # - Shipping logs to Nexus logs site repository
734 # - Cleanup workspace
736 # TODO: RELENG-1228 Develop log shipping script for Windows systems
747 # - lf-infra-ship-logs-windows
748 # mark-unstable-if-failed: true
751 # Do not clean up *.jenkins-trigger files for jobs that use a
752 # properties file as input for triggering another build.
753 - "**/*.jenkins-trigger"
757 name: global-jjb-email-notification
760 recipients: "{email-recipients}"
762 content-type: default
763 subject: "{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!"
765 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
767 Please refer to the logs server URL for console logs when possible
768 and use the Jenkins Build URL as a last resort.
782 name: lf-infra-gerrit-scm
785 credentials-id: "{jenkins-ssh-credential}"
789 - "refs/heads/{branch}"
793 disable: "{submodule-disable}"
794 recursive: "{submodule-recursive}"
795 timeout: "{submodule-timeout}"
796 choosing-strategy: "{choosing-strategy}"
799 name: lf-infra-github-scm
802 credentials-id: "{jenkins-ssh-credential}"
810 disable: "{submodule-disable}"
811 recursive: "{submodule-recursive}"
812 timeout: "{submodule-timeout}"
813 choosing-strategy: "{choosing-strategy}"
820 name: lf-infra-wrappers-common
825 timeout: "{build-timeout}"
826 timeout-var: "BUILD_TIMEOUT"
833 name: lf-infra-wrappers
835 - lf-infra-wrappers-common:
836 build-timeout: "{build-timeout}"
837 - config-file-provider:
840 target: "$HOME/.npmrc"
842 target: "$HOME/.config/pip/pip.conf"
843 - ssh-agent-credentials:
845 - "{jenkins-ssh-credential}"
848 name: lf-infra-wrappers-windows
850 - lf-infra-wrappers-common:
851 build-timeout: "{build-timeout}"