7 name: lf-infra-create-netrc
8 # Macro to create a ~/.netrc file from a Maven settings.xml
10 # {server-id} The id of a server as defined in settings.xml
13 properties-content: 'SERVER_ID={server-id}'
14 - shell: !include-raw-escape: ../shell/create-netrc.sh
17 name: lf-infra-docker-login
18 # Login into a custom hosted docker registry and / or docker.io
20 # The Jenkins system should have the following global variables defined
22 # DOCKER_REGISTRY : Optional
23 # The DNS address of the registry (IP or FQDN)
24 # ex: nexus3.example.com
26 # REGISTRY_PORTS : Required if DOCKER_REGISTRY is set
27 # Space separated listing of the registry ports to login
29 # ex: 10001 10002 10003 10004
31 # DOCKERHUB_EMAIL : Optional
32 # If this variable is set then an attempt to login to
33 # DockerHub (docker.io) will be also made. It should be
34 # set to the email address for the credentials that will
35 # get looked up. Only _one_ credential will ever be found
36 # in the maven settings file for DockerHub
38 - lf-provide-maven-settings:
39 global-settings-file: '{global-settings-file}'
40 settings-file: '{settings-file}'
41 - shell: !include-raw-escape: ../shell/docker-login.sh
42 - lf-provide-maven-settings-cleanup
45 name: lf-infra-gpg-verify-git-signature
46 # Verify gpg signature of the latest commit message in $WORKSPACE
48 # This command assumes that $WORKSPACE is a git repo.
50 # TODO: Verify signature after downloading users public key from a locally
51 # created repository instead of the public keymesh. This requires a process
52 # in place to get ODL developers public keys into a local repository without
53 # increasing the job thoughput.
55 - shell: !include-raw: ../shell/gpg-verify-git-signature.sh
58 name: lf-infra-ship-logs
60 - config-file-provider:
62 - file-id: 'jenkins-log-archives-settings'
63 variable: 'SETTINGS_FILE'
64 - lf-infra-create-netrc:
66 - shell: !include-raw:
67 - ../shell/lftools-install.sh
68 - ../shell/logs-deploy.sh
69 - shell: !include-raw:
70 - ../shell/logs-clear-credentials.sh
72 regexp: '^Build logs: .*'
75 name: lf-infra-packer-build
77 - config-file-provider:
79 - file-id: '{packer-cloud-settings}'
83 PACKER_PLATFORM={platform}
84 PACKER_TEMPLATE={template}
85 PACKER_VERSION={packer-version}
86 - shell: !include-raw-escape:
87 - ../shell/packer-install.sh
88 - ../shell/packer-build.sh
89 - shell: !include-raw:
90 - ../shell/packer-clear-credentials.sh
93 name: lf-infra-packer-validate
95 - config-file-provider:
97 - file-id: '{packer-cloud-settings}'
100 properties-content: |
101 PACKER_VERSION={packer-version}
102 - shell: !include-raw-escape:
103 - ../shell/packer-install.sh
104 - ../shell/packer-validate.sh
105 - shell: !include-raw:
106 - ../shell/packer-clear-credentials.sh
109 name: lf-infra-sysstat
111 - shell: !include-raw:
112 - ../shell/sysstat.sh
115 name: lf-jacoco-nojava-workaround
117 - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
120 name: lf-infra-deploy-maven-file
121 # Deploy files to a repository.
123 # The builder requires passing the following parameters
124 # REPO_ID: Repository ID
125 # GROUP_ID: Group ID of the repository
126 # UPLOAD_FILES_PATH: Path to directory containing one or more files
129 mvn-version: '{mvn-version}'
130 - lf-provide-maven-settings:
131 global-settings-file: '{global-settings-file}'
132 settings-file: '{settings-file}'
134 properties-content: |
135 MAVEN_REPO_URL={maven-repo-url}
138 UPLOAD_FILES_PATH={upload-files-dir}
139 - shell: !include-raw-escape:
140 - ../shell/lftools-install.sh
141 - ../shell/common-variables.sh
142 - ../shell/deploy-maven-file.sh
143 - lf-provide-maven-settings-cleanup
146 name: lf-maven-install
147 # call maven-target builder with a goal of --version to force Jenkins to
148 # install the needed maven version
150 # Create a $HOME/.wgetrc to make the Maven download quiet.
151 - shell: 'echo "quiet=on" > "$HOME/.wgetrc"'
153 maven-version: '{mvn-version}'
155 - shell: 'rm "$HOME/.wgetrc"'
158 name: lf-provide-maven-settings
159 # Push a global settings and user settings maven files
161 - config-file-provider:
163 - file-id: '{global-settings-file}'
164 variable: 'GLOBAL_SETTINGS_FILE'
165 - file-id: '{settings-file}'
166 variable: 'SETTINGS_FILE'
170 # Call pip install to install packages into a virtualenv
171 # The first package listed in PIP_PACKAGES is used as the virtualenv name.
174 properties-content: PIP_PACKAGES={pip-packages}
175 - shell: !include-raw-escape: ../shell/pip-install.sh
178 name: lf-provide-maven-settings-cleanup
179 # Clear maven settings files after we are done using them
183 set +e # DO NOT cause build failure if any of the rm calls fail.
185 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
187 # In some cases we use the lf-provide-maven-settings macro to produce
188 # a "$HOME/.netrc" file containing credentials. Remove that file here
192 # DO NOT fail build if any of the above lines fail.
196 name: lf-rtd-trigger-build
199 properties-content: RTD_PROJECT={rtd-project}
200 - shell: !include-raw-escape: ../shell/rtd-trigger-build.sh
206 properties-content: DOC_DIR={doc-dir}
207 - shell: !include-raw-escape:
208 - ../shell/tox-install.sh
209 - ../shell/rtd-verify.sh
216 name: lf-infra-maven-parameters
220 default: '{mvn-opts}'
222 Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
225 default: '{mvn-params}'
227 Maven parameters to pass to the mvn command.
230 # Sets an env var for shell scripts to be able to call the dynamically
231 # installed maven without having to calculate the path themselves.
232 default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}/bin/mvn'
233 description: 'Maven selector to be used by shell scripts'
235 name: STAGING_PROFILE_ID
236 default: '{staging-profile-id}'
238 Nexus staging profile ID.
242 name: lf-infra-openstack-parameters
246 default: '{os-cloud}'
248 The name of a cloud configuration in clouds.yaml. OS_CLOUD is a
249 variable name that is significant to openstack client as a
250 environment variable. Please refer to the documentation for
252 https://docs.openstack.org/developer/python-openstackclient/
256 name: lf-infra-parameters
257 # Standard parameters used in the LF CI environments. Gerrit variables are
258 # not used by GitHub projects, but defining them isn't harmful.
264 Parameter to identify a Gerrit project. This is typically the
265 project repo path as exists in Gerrit.
266 For example: ofextensions/circuitsw
271 Stream is often set to the same name as 'branch' but can
272 sometimes be used as a name representing a project's release code
278 Parameter to identify Gerrit project. This is typically the
279 project repo path as exists in Gerrit.
280 For example: ofextensions/circuitsw
282 Note that Gerrit will override this parameter automatically if a
283 job is triggered by Gerrit.
288 Parameter to identify a Gerrit branch.
290 Note that Gerrit will override this parameter automatically if a
291 job is triggered by Gerrit.
294 default: 'refs/heads/{branch}'
296 Parameter to identify a refspec when pulling from Gerrit.
298 Note that Gerrit will override this parameter automatically if a
299 job is triggered by Gerrit.
301 name: LFTOOLS_VERSION
302 default: '{lftools-version}'
304 Version of lftools to install. Can be a specific version like
305 '0.6.0' or a PEP-440 definition.
306 https://www.python.org/dev/peps/pep-0440/
307 For example '<1.0.0' or '>=1.0.0,<2.0.0'.
310 name: lf-infra-tox-parameters
311 # Useful parameters when working with TOX
312 # https://tox.readthedocs.io/
318 Path to directory containing tox.ini file.
321 default: '{tox-envs}'
323 Tox environments to run build against.
324 Example: docs,py2,py3
331 name: lf-infra-properties
334 # Allow build data to be stored at a length configured by the
335 # downstream project.
336 days-to-keep: '{build-days-to-keep}'
337 # Do not allow artifacts to be stored in Jenkins.
338 artifact-num-to-keep: 0
345 name: lf-jacoco-report
348 exec-pattern: "**/**.exec"
349 class-pattern: "**/classes"
350 source-pattern: "**/src/main/java"
351 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
362 name: lf-infra-publish
363 # lf-infra macro to finish up a build.
365 # Handles the following:
366 # - Shipping logs to Nexus logs site repository
367 # - Cleanup workspace
373 script-only-if-succeeded: false
374 script-only-if-failed: false
375 mark-unstable-if-failed: false
378 # Do not clean up *.jenkins-trigger files for jobs that use a
379 # properties file as input for triggering another build.
380 - '**/*.jenkins-trigger'
388 name: lf-infra-gerrit-scm
391 credentials-id: '{jenkins-ssh-credential}'
395 - 'refs/heads/{branch}'
399 recursive: '{submodule-recursive}'
400 choosing-strategy: '{choosing-strategy}'
403 name: lf-infra-github-scm
406 credentials-id: '{jenkins-ssh-credential}'
412 recursive: '{submodule-recursive}'
413 choosing-strategy: '{choosing-strategy}'
420 name: lf-infra-github-pr-trigger
422 - github-pull-request:
423 trigger-phrase: '{trigger-phrase}'
424 only-trigger-phrase: '{only-trigger-phrase}'
425 status-context: '{status-context}'
426 permit-all: '{permit-all}'
427 github-hooks: '{github-hooks}'
428 auto-close-on-fail: false
431 white-list: '{obj:github_pr_whitelist}'
432 admin-list: '{obj:github_pr_admin_list}'
439 name: lf-infra-wrappers
444 timeout: '{build-timeout}'
445 timeout-var: 'BUILD_TIMEOUT'
448 - ssh-agent-credentials:
450 - '{jenkins-ssh-credential}'