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: '{os-cloud-file-id}'
80 target: '$HOME/.config/openstack/clouds.yaml'
81 - file-id: 'packer-cloud-env'
85 PACKER_PLATFORM={platform}
86 PACKER_TEMPLATE={template}
87 PACKER_VERSION={packer-version}
88 - shell: !include-raw-escape:
89 - ../shell/packer-install.sh
90 - ../shell/packer-build.sh
91 - shell: !include-raw:
92 - ../shell/packer-clear-credentials.sh
95 name: lf-infra-packer-validate
97 - config-file-provider:
99 - file-id: '{os-cloud-file-id}'
100 target: '$HOME/.config/openstack/clouds.yaml'
101 - file-id: 'packer-cloud-env'
104 properties-content: |
105 PACKER_VERSION={packer-version}
106 - shell: !include-raw-escape:
107 - ../shell/packer-install.sh
108 - ../shell/packer-validate.sh
109 - shell: !include-raw:
110 - ../shell/packer-clear-credentials.sh
113 name: lf-infra-sysstat
115 - shell: !include-raw:
116 - ../shell/sysstat.sh
119 name: lf-jacoco-nojava-workaround
121 - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
124 name: lf-infra-deploy-maven-file
125 # Deploy files to a repository.
127 # The builder requires passing the following parameters
128 # REPO_ID: Repository ID
129 # GROUP_ID: Group ID of the repository
130 # UPLOAD_FILES_PATH: Path to directory containing one or more files
133 mvn-version: '{mvn-version}'
134 - lf-provide-maven-settings:
135 global-settings-file: '{global-settings-file}'
136 settings-file: '{settings-file}'
138 properties-content: |
141 UPLOAD_FILES_PATH={files-dir}
142 - shell: !include-raw-escape:
143 - ../shell/lftools-install.sh
144 - ../shell/deploy-maven-file.sh
145 - lf-provide-maven-settings-cleanup
148 name: lf-maven-install
149 # call maven-target builder with a goal of --version to force Jenkins to
150 # install the needed maven version
152 # Create a $HOME/.wgetrc to make the Maven download quiet.
153 - shell: 'echo "quiet=on" > "$HOME/.wgetrc"'
155 maven-version: '{mvn-version}'
157 - shell: 'rm "$HOME/.wgetrc"'
160 name: lf-provide-maven-settings
161 # Push a global settings and user settings maven files
163 - config-file-provider:
165 - file-id: '{global-settings-file}'
166 variable: 'GLOBAL_SETTINGS_FILE'
167 - file-id: '{settings-file}'
168 variable: 'SETTINGS_FILE'
171 name: lf-provide-maven-settings-cleanup
172 # Clear maven settings files after we are done using them
176 set +e # DO NOT cause build failure if any of the rm calls fail.
178 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
180 # In some cases we use the lf-provide-maven-settings macro to produce
181 # a "$HOME/.netrc" file containing credentials. Remove that file here
185 # DO NOT fail build if any of the above lines fail.
193 name: lf-infra-maven-parameters
197 default: '{mvn-opts}'
199 Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
202 default: '{mvn-params}'
204 Maven parameters to pass to the mvn command.
207 # Sets an env var for shell scripts to be able to call the dynamically
208 # installed maven without having to calculate the path themselves.
209 default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}/bin/mvn'
210 description: 'Maven selector to be used by shell scripts'
212 name: STAGING_PROFILE_ID
213 default: '{staging-profile-id}'
215 Nexus staging profile ID.
219 name: lf-infra-openstack-parameters
223 default: '{os-cloud}'
225 The name of a cloud configuration in clouds.yaml. OS_CLOUD is a
226 variable name that is significant to openstack client as a
227 environment variable. Please refer to the documentation for
229 https://docs.openstack.org/developer/python-openstackclient/
233 name: lf-infra-parameters
234 # Standard parameters used in the LF CI environments. Gerrit variables are
235 # not used by GitHub projects, but defining them isn't harmful.
241 Parameter to identify a Gerrit project. This is typically the
242 project repo path as exists in Gerrit.
243 For example: ofextensions/circuitsw
248 Stream is often set to the same name as 'branch' but can
249 sometimes be used as a name representing a project's release code
255 Parameter to identify Gerrit project. This is typically the
256 project repo path as exists in Gerrit.
257 For example: ofextensions/circuitsw
259 Note that Gerrit will override this parameter automatically if a
260 job is triggered by Gerrit.
265 Parameter to identify a Gerrit branch.
267 Note that Gerrit will override this parameter automatically if a
268 job is triggered by Gerrit.
273 Parameter to identify a refspec when pulling from Gerrit.
275 Note that Gerrit will override this parameter automatically if a
276 job is triggered by Gerrit.
280 name: lf-infra-tox-parameters
281 # Useful parameters when working with TOX
282 # https://tox.readthedocs.io/
288 Path to directory containing tox.ini file.
291 default: '{tox-envs}'
293 Tox environments to run build against.
294 Example: docs,py2,py3
301 name: lf-infra-properties
304 # Allow build data to be stored at a length configured by the
305 # downstream project.
306 days-to-keep: '{build-days-to-keep}'
307 # Do not allow artifacts to be stored in Jenkins.
308 artifact-num-to-keep: 0
315 name: lf-infra-publish
316 # lf-infra macro to finish up a build.
318 # Handles the following:
319 # - Shipping logs to Nexus logs site repository
320 # - Cleanup workspace
326 script-only-if-succeeded: false
327 script-only-if-failed: false
328 mark-unstable-if-failed: false
331 # Do not clean up *.jenkins-trigger files for jobs that use a
332 # properties file as input for triggering another build.
333 - '**/*.jenkins-trigger'
341 name: lf-infra-gerrit-scm
344 credentials-id: '{jenkins-ssh-credential}'
348 - 'refs/heads/{branch}'
352 recursive: '{submodule-recursive}'
353 choosing-strategy: '{choosing-strategy}'
356 name: lf-infra-github-scm
359 credentials-id: '{jenkins-ssh-credential}'
365 recursive: '{submodule-recursive}'
366 choosing-strategy: '{choosing-strategy}'
373 name: lf-infra-github-pr-trigger
375 - github-pull-request:
376 trigger-phrase: '{trigger-phrase}'
377 only-trigger-phrase: '{only-trigger-phrase}'
378 status-context: '{status-context}'
379 permit-all: '{permit-all}'
380 github-hooks: '{github-hooks}'
381 auto-close-on-fail: false
384 white-list: '{obj:github_pr_whitelist}'
385 admin-list: '{obj:github_pr_admin_list}'
392 name: lf-infra-wrappers
397 timeout: '{build-timeout}'
398 timeout-var: 'BUILD_TIMEOUT'
401 - ssh-agent-credentials:
403 - '{jenkins-ssh-credential}'