42487ad8cc3a0b4249397ffc299e0c7c3b0c99fc
[releng/global-jjb.git] / .jjb-test / expected-xml / github-maven-maven-release-master
1 <?xml version="1.0" encoding="utf-8"?>
2 <project>
3   <jdk>openjdk8</jdk>
4   <actions/>
5   <description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
6   <keepDependencies>false</keepDependencies>
7   <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
8   <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
9   <concurrentBuild>false</concurrentBuild>
10   <assignedNode>build-vm</assignedNode>
11   <canRoam>false</canRoam>
12   <properties>
13     <com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github">
14       <projectUrl>$GIT_URL/$PROJECT/example-org/releng/ciman</projectUrl>
15       <displayName/>
16     </com.coravy.hudson.plugins.github.GithubProjectProperty>
17     <hudson.model.ParametersDefinitionProperty>
18       <parameterDefinitions>
19         <hudson.model.StringParameterDefinition>
20           <name>PROJECT</name>
21           <description>Parameter to identify a Gerrit project. This is typically the
22 project repo path as exists in Gerrit.
23 For example: ofextensions/circuitsw
24 </description>
25           <defaultValue>releng/ciman</defaultValue>
26         </hudson.model.StringParameterDefinition>
27         <hudson.model.StringParameterDefinition>
28           <name>STREAM</name>
29           <description>Stream is often set to the same name as 'branch' but can
30 sometimes be used as a name representing a project's release code
31 name.
32 </description>
33           <defaultValue>master</defaultValue>
34         </hudson.model.StringParameterDefinition>
35         <hudson.model.StringParameterDefinition>
36           <name>GERRIT_PROJECT</name>
37           <description>Parameter to identify Gerrit project. This is typically the
38 project repo path as exists in Gerrit.
39 For example: ofextensions/circuitsw
40
41 Note that Gerrit will override this parameter automatically if a
42 job is triggered by Gerrit.
43 </description>
44           <defaultValue>releng/ciman</defaultValue>
45         </hudson.model.StringParameterDefinition>
46         <hudson.model.StringParameterDefinition>
47           <name>GERRIT_BRANCH</name>
48           <description>Parameter to identify a Gerrit branch.
49
50 Note that Gerrit will override this parameter automatically if a
51 job is triggered by Gerrit.
52 </description>
53           <defaultValue>master</defaultValue>
54         </hudson.model.StringParameterDefinition>
55         <hudson.model.StringParameterDefinition>
56           <name>GERRIT_REFSPEC</name>
57           <description>Parameter to identify a refspec when pulling from Gerrit.
58
59 Note that Gerrit will override this parameter automatically if a
60 job is triggered by Gerrit.
61 </description>
62           <defaultValue>refs/heads/master</defaultValue>
63         </hudson.model.StringParameterDefinition>
64         <hudson.model.StringParameterDefinition>
65           <name>LFTOOLS_VERSION</name>
66           <description>Version of lftools to install. Can be a specific version like
67 '0.6.0' or a PEP-440 definition.
68 https://www.python.org/dev/peps/pep-0440/
69 For example '&lt;1.0.0' or '&gt;=1.0.0,&lt;2.0.0'.
70 </description>
71           <defaultValue>&lt;1.0.0</defaultValue>
72         </hudson.model.StringParameterDefinition>
73         <hudson.model.StringParameterDefinition>
74           <name>M2_HOME</name>
75           <description>Maven selector to be used by shell scripts</description>
76           <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33</defaultValue>
77         </hudson.model.StringParameterDefinition>
78         <hudson.model.StringParameterDefinition>
79           <name>MAVEN_OPTS</name>
80           <description>Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
81 </description>
82           <defaultValue/>
83         </hudson.model.StringParameterDefinition>
84         <hudson.model.StringParameterDefinition>
85           <name>MAVEN_PARAMS</name>
86           <description>Maven parameters to pass to the mvn command.
87 </description>
88           <defaultValue/>
89         </hudson.model.StringParameterDefinition>
90         <hudson.model.StringParameterDefinition>
91           <name>MVN</name>
92           <description>Maven selector to be used by shell scripts</description>
93           <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn</defaultValue>
94         </hudson.model.StringParameterDefinition>
95         <hudson.model.StringParameterDefinition>
96           <name>STAGING_PROFILE_ID</name>
97           <description>Nexus staging profile ID.
98 </description>
99           <defaultValue>uuddlrlrba</defaultValue>
100         </hudson.model.StringParameterDefinition>
101         <hudson.model.StringParameterDefinition>
102           <name>ARCHIVE_ARTIFACTS</name>
103           <description>Artifacts to archive to the logs server.</description>
104           <defaultValue/>
105         </hudson.model.StringParameterDefinition>
106       </parameterDefinitions>
107     </hudson.model.ParametersDefinitionProperty>
108   </properties>
109   <scm class="hudson.plugins.git.GitSCM">
110     <configVersion>2</configVersion>
111     <userRemoteConfigs>
112       <hudson.plugins.git.UserRemoteConfig>
113         <name>origin</name>
114         <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
115         <url>git@github.com:example-org/releng/ciman</url>
116         <credentialsId>test-credential</credentialsId>
117       </hudson.plugins.git.UserRemoteConfig>
118     </userRemoteConfigs>
119     <branches>
120       <hudson.plugins.git.BranchSpec>
121         <name>master</name>
122       </hudson.plugins.git.BranchSpec>
123     </branches>
124     <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
125     <remotePoll>false</remotePoll>
126     <gitTool>Default</gitTool>
127     <submoduleCfg class="list"/>
128     <reference/>
129     <gitConfigName/>
130     <gitConfigEmail/>
131     <extensions>
132       <hudson.plugins.git.extensions.impl.BuildChooserSetting>
133         <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
134       </hudson.plugins.git.extensions.impl.BuildChooserSetting>
135       <hudson.plugins.git.extensions.impl.SubmoduleOption>
136         <disableSubmodules>false</disableSubmodules>
137         <recursiveSubmodules>true</recursiveSubmodules>
138         <trackingSubmodules>false</trackingSubmodules>
139         <parentCredentials>false</parentCredentials>
140         <reference/>
141         <timeout>10</timeout>
142       </hudson.plugins.git.extensions.impl.SubmoduleOption>
143       <hudson.plugins.git.extensions.impl.WipeWorkspace/>
144     </extensions>
145   </scm>
146   <triggers class="vector">
147     <hudson.triggers.TimerTrigger>
148       <spec/>
149     </hudson.triggers.TimerTrigger>
150     <org.jenkinsci.plugins.ghprb.GhprbTrigger>
151       <spec/>
152       <adminlist/>
153       <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
154       <whitelist/>
155       <orgslist/>
156       <whiteListLabels/>
157       <blackListLabels/>
158       <cron/>
159       <triggerPhrase>^build release$</triggerPhrase>
160       <skipBuildPhrase/>
161       <onlyTriggerPhrase>true</onlyTriggerPhrase>
162       <useGitHubHooks>true</useGitHubHooks>
163       <permitAll>true</permitAll>
164       <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
165       <extensions>
166         <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
167           <commitStatusContext>Maven Release</commitStatusContext>
168         </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
169       </extensions>
170     </org.jenkinsci.plugins.ghprb.GhprbTrigger>
171   </triggers>
172   <builders>
173     <hudson.tasks.Shell>
174       <command>mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes</command>
175     </hudson.tasks.Shell>
176     <hudson.tasks.Shell>
177       <command>echo &quot;quiet=on&quot; &gt; &quot;$HOME/.wgetrc&quot;</command>
178     </hudson.tasks.Shell>
179     <hudson.tasks.Maven>
180       <targets>--version</targets>
181       <properties/>
182       <mavenName>mvn33</mavenName>
183       <usePrivateRepository>false</usePrivateRepository>
184       <settings class="jenkins.mvn.DefaultSettingsProvider"/>
185       <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
186     </hudson.tasks.Maven>
187     <hudson.tasks.Shell>
188       <command>rm &quot;$HOME/.wgetrc&quot;</command>
189     </hudson.tasks.Shell>
190     <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
191       <managedFiles>
192         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
193           <fileId>global-settings</fileId>
194           <targetLocation/>
195           <variable>GLOBAL_SETTINGS_FILE</variable>
196         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
197         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
198           <fileId>aproject-settings</fileId>
199           <targetLocation/>
200           <variable>SETTINGS_FILE</variable>
201         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
202       </managedFiles>
203     </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
204     <EnvInjectBuilder>
205       <info>
206         <propertiesContent>SERVER_ID=project-staging</propertiesContent>
207       </info>
208     </EnvInjectBuilder>
209     <hudson.tasks.Shell>
210       <command>#!/bin/bash
211 # SPDX-License-Identifier: EPL-1.0
212 ##############################################################################
213 # Copyright (c) 2017 The Linux Foundation and others.
214 #
215 # All rights reserved. This program and the accompanying materials
216 # are made available under the terms of the Eclipse Public License v1.0
217 # which accompanies this distribution, and is available at
218 # http://www.eclipse.org/legal/epl-v10.html
219 ##############################################################################
220 echo &quot;---&gt; create-netrc.sh&quot;
221
222 # Ensure we fail the job if any steps fail.
223 set -eu -o pipefail
224
225 NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
226 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
227     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
228     -v x:username -o &quot;:&quot; -v x:password \
229     &quot;$SETTINGS_FILE&quot;)
230
231 machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
232 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
233 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
234
235 echo &quot;machine ${machine%:*} login $user password $pass&quot; &gt; ~/.netrc
236 </command>
237     </hudson.tasks.Shell>
238     <hudson.tasks.Shell>
239       <command>#!/bin/bash
240 # SPDX-License-Identifier: EPL-1.0
241 ##############################################################################
242 # Copyright (c) 2017 The Linux Foundation and others.
243 #
244 # All rights reserved. This program and the accompanying materials
245 # are made available under the terms of the Eclipse Public License v1.0
246 # which accompanies this distribution, and is available at
247 # http://www.eclipse.org/legal/epl-v10.html
248 ##############################################################################
249 echo &quot;---&gt; lftools-install.sh&quot;
250
251 # Script to install lftools via a version passed in via lf-infra-parameters
252 #
253 # Required parameters:
254 #
255 #     LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
256 #                      set to a strict version number like '1.2.3' or using
257 #                      PEP-440 definitions.
258 #
259 #                      Examples:
260 #                          &lt;1.0.0
261 #                          &gt;=1.0.0,&lt;2.0.0
262 #
263 # By default a released version of lftools should always be used.
264 # The purpose of the 2 variables below is so that lftools devs can test
265 # unreleased versions of lftools. There are 2 methods to install a dev version
266 # of lftools:
267 #
268 #     1) gerrit patch: Used to test a patch that has not yet been merged.
269 #                      To do this set something like this:
270 #                          LFTOOLS_MODE=gerrit
271 #                          LFTOOLS_REFSPEC=refs/changes/96/5296/7
272 #
273 #     2) git branch: Used to install an lftools version from a specific branch.
274 #                    To use this set the variables as follows:
275 #                          LFTOOLS_MODE=git
276 #                          LFTOOLS_REFSPEC=master
277 #
278 #     3) release : The intended use case and default setting.
279 #                  Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
280
281 LFTOOLS_MODE=release  # release | git | gerrit
282 LFTOOLS_REFSPEC=master
283
284 # Ensure we fail the job if any steps fail.
285 # DO NOT set -u as virtualenv's activate script has unbound variables
286 set -e -o pipefail
287
288 virtualenv --quiet &quot;/tmp/v/lftools&quot;
289 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
290 source &quot;/tmp/v/lftools/bin/activate&quot;
291 pip install --quiet --upgrade pip
292
293 case $LFTOOLS_MODE in
294     gerrit)
295         git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
296         pushd /tmp/lftools
297         git fetch origin &quot;$LFTOOLS_REFSPEC&quot;
298         git checkout FETCH_HEAD
299         pip install --quiet --upgrade -r requirements.txt
300         pip install --quiet --upgrade -e .
301         popd
302         ;;
303
304     git)
305         pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@&quot;$BRANCH&quot;
306         ;;
307
308     release)
309         if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
310             LFTOOLS_VERSION=&quot;==$LFTOOLS_VERSION&quot;
311         fi
312
313         pip install --quiet --upgrade &quot;lftools${LFTOOLS_VERSION}&quot;
314         ;;
315 esac
316
317 lftools --version
318
319 # pipdeptree prints out a lot of information because lftools pulls in many
320 # dependencies. Let's only print it if we want to debug.
321 # echo &quot;----&gt; Pip Dependency Tree&quot;
322 # pip install --quiet --upgrade pipdeptree
323 # pipdeptree
324
325 #!/bin/bash
326 # SPDX-License-Identifier: EPL-1.0
327 ##############################################################################
328 # Copyright (c) 2017 The Linux Foundation and others.
329 #
330 # All rights reserved. This program and the accompanying materials
331 # are made available under the terms of the Eclipse Public License v1.0
332 # which accompanies this distribution, and is available at
333 # http://www.eclipse.org/legal/epl-v10.html
334 ##############################################################################
335
336 # This file contains a list of variables that are generally useful in many
337 # scripts. It is meant to be sourced in other scripts so that the variables can
338 # be called.
339
340 MAVEN_OPTIONS=&quot;$(echo --show-version \
341     --batch-mode \
342     -Djenkins \
343     -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
344     -Dmaven.repo.local=/tmp/r \
345     -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)&quot;
346 echo &quot;$MAVEN_OPTIONS&quot;
347
348 #!/bin/bash
349 # SPDX-License-Identifier: EPL-1.0
350 ##############################################################################
351 # Copyright (c) 2017 The Linux Foundation and others.
352 #
353 # All rights reserved. This program and the accompanying materials
354 # are made available under the terms of the Eclipse Public License v1.0
355 # which accompanies this distribution, and is available at
356 # http://www.eclipse.org/legal/epl-v10.html
357 ##############################################################################
358
359 # This script removes the -SNAPSHOT from a project to prepare it for release.
360
361 PATCH_DIR=&quot;$WORKSPACE/archives/patches&quot;
362 mkdir -p &quot;$PATCH_DIR&quot;
363
364 # Ensure we fail the job if any steps fail.
365 set -eu -o pipefail
366
367 echo &quot;$PROJECT&quot; &quot;$(git rev-parse --verify HEAD)&quot; | tee -a &quot;$PATCH_DIR/taglist.log&quot;
368
369 # Strip -SNAPSHOT from version to prepare release.
370 find . -name &quot;*.xml&quot; -print0 | xargs -0 sed -i 's/-SNAPSHOT//g'
371
372 git commit -am &quot;Release $PROJECT&quot;
373 git format-patch --stdout &quot;origin/$GERRIT_BRANCH&quot; &gt; &quot;$PATCH_DIR/${PROJECT//\//-}.patch&quot;
374 git bundle create &quot;$PATCH_DIR/${PROJECT//\//-}.bundle&quot; &quot;origin/${GERRIT_BRANCH}..HEAD&quot;
375
376 #!/bin/bash
377 # SPDX-License-Identifier: EPL-1.0
378 ##############################################################################
379 # Copyright (c) 2017 The Linux Foundation and others.
380 #
381 # All rights reserved. This program and the accompanying materials
382 # are made available under the terms of the Eclipse Public License v1.0
383 # which accompanies this distribution, and is available at
384 # http://www.eclipse.org/legal/epl-v10.html
385 ##############################################################################
386
387 # This script builds a Maven project and deploys it into a staging repo which
388 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
389
390 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
391 # Ensure we fail the job if any steps fail.
392 set -e -o pipefail
393 set +u
394
395 export MAVEN_OPTS
396
397 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
398 # shellcheck disable=SC2086
399 $MVN clean deploy \
400     --global-settings &quot;$GLOBAL_SETTINGS_FILE&quot; \
401     --settings &quot;$SETTINGS_FILE&quot; \
402     -DaltDeploymentRepository=staging::default::file:&quot;$WORKSPACE&quot;/m2repo \
403     $MAVEN_OPTIONS $MAVEN_PARAMS
404
405 #!/bin/bash
406 # SPDX-License-Identifier: EPL-1.0
407 ##############################################################################
408 # Copyright (c) 2017 The Linux Foundation and others.
409 #
410 # All rights reserved. This program and the accompanying materials
411 # are made available under the terms of the Eclipse Public License v1.0
412 # which accompanies this distribution, and is available at
413 # http://www.eclipse.org/legal/epl-v10.html
414 ##############################################################################
415
416 # This script publishes artifacts to a staging repo in Nexus.
417 #
418 # $WORKSPACE/m2repo   :  Exists and used to deploy the staging repository.
419 # $NEXUS_URL          :  Jenkins global variable should be defined.
420 # $STAGING_PROFILE_ID :  Provided by a job parameter.
421
422 # Ensure we fail the job if any steps fail.
423 set -eu -o pipefail
424
425 TMP_FILE=&quot;$(mktemp)&quot;
426 lftools deploy nexus-stage &quot;$NEXUS_URL&quot; &quot;$STAGING_PROFILE_ID&quot; &quot;$WORKSPACE/m2repo&quot; | tee &quot;$TMP_FILE&quot;
427 staging_repo=$(sed -n -e 's/Staging repository \(.*\) created\./\1/p' &quot;$TMP_FILE&quot;)
428
429 # Store repo info to a file in archives
430 mkdir -p &quot;$WORKSPACE/archives&quot;
431 echo &quot;$staging_repo&quot; &gt; &quot;$WORKSPACE/archives/staging-repo.txt&quot;
432
433 # Cleanup
434 rm &quot;$TMP_FILE&quot;
435 </command>
436     </hudson.tasks.Shell>
437     <hudson.tasks.Shell>
438       <command>#!/bin/bash
439 set +e  # DO NOT cause build failure if any of the rm calls fail.
440
441 rm &quot;$GLOBAL_SETTINGS_FILE&quot; &quot;$SETTINGS_FILE&quot;
442
443 # In some cases we use the lf-provide-maven-settings macro to produce
444 # a &quot;$HOME/.netrc&quot; file containing credentials. Remove that file here
445 # too if it exists.
446 rm &quot;$HOME/.netrc&quot;
447
448 # DO NOT fail build if any of the above lines fail.
449 exit 0
450 </command>
451     </hudson.tasks.Shell>
452   </builders>
453   <publishers>
454     <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
455       <buildSteps>
456         <hudson.tasks.Shell>
457           <command>#!/bin/bash
458 # SPDX-License-Identifier: EPL-1.0
459 ##############################################################################
460 # Copyright (c) 2017 The Linux Foundation and others.
461 #
462 # All rights reserved. This program and the accompanying materials
463 # are made available under the terms of the Eclipse Public License v1.0
464 # which accompanies this distribution, and is available at
465 # http://www.eclipse.org/legal/epl-v10.html
466 ##############################################################################
467 echo &quot;---&gt; sysstat.sh&quot;
468 set +e  # DON'T fail build if script fails.
469
470 OS=$(facter operatingsystem)
471 case &quot;$OS&quot; in
472     Ubuntu)
473         SYSSTAT_PATH=&quot;/var/log/sysstat&quot;
474
475         # Dont run the script when systat is not enabled by default
476         if ! grep --quiet 'ENABLED=&quot;true&quot;' &quot;/etc/default/sysstat&quot;; then
477             exit 0
478         fi
479     ;;
480     CentOS|RedHat)
481         SYSSTAT_PATH=&quot;/var/log/sa&quot;
482     ;;
483     *)
484         # nothing to do
485         exit 0
486     ;;
487 esac
488
489 SAR_DIR=&quot;$WORKSPACE/archives/sar-reports&quot;
490 mkdir -p &quot;$SAR_DIR&quot;
491 cp &quot;$SYSSTAT_PATH/&quot;* &quot;$_&quot;
492 # convert sar data to ascii format
493 while IFS=&quot;&quot; read -r sarfilenum
494 do
495     [ -f &quot;$sarfilenum&quot; ] &amp;&amp; LC_TIME=POSIX sar -A -f &quot;$sarfilenum&quot; &gt; &quot;$SAR_DIR/sar${sarfilenum//[!0-9]/}&quot;
496 done &lt; &lt;(find &quot;$SYSSTAT_PATH&quot; -name &quot;sa[0-9]*&quot; || true)
497
498 # DON'T fail build if script fails.
499 exit 0
500 </command>
501         </hudson.tasks.Shell>
502         <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
503           <managedFiles>
504             <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
505               <fileId>jenkins-log-archives-settings</fileId>
506               <targetLocation/>
507               <variable>SETTINGS_FILE</variable>
508             </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
509           </managedFiles>
510         </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
511         <EnvInjectBuilder>
512           <info>
513             <propertiesContent>SERVER_ID=logs</propertiesContent>
514           </info>
515         </EnvInjectBuilder>
516         <hudson.tasks.Shell>
517           <command>#!/bin/bash
518 # SPDX-License-Identifier: EPL-1.0
519 ##############################################################################
520 # Copyright (c) 2017 The Linux Foundation and others.
521 #
522 # All rights reserved. This program and the accompanying materials
523 # are made available under the terms of the Eclipse Public License v1.0
524 # which accompanies this distribution, and is available at
525 # http://www.eclipse.org/legal/epl-v10.html
526 ##############################################################################
527 echo &quot;---&gt; create-netrc.sh&quot;
528
529 # Ensure we fail the job if any steps fail.
530 set -eu -o pipefail
531
532 NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
533 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
534     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
535     -v x:username -o &quot;:&quot; -v x:password \
536     &quot;$SETTINGS_FILE&quot;)
537
538 machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
539 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
540 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
541
542 echo &quot;machine ${machine%:*} login $user password $pass&quot; &gt; ~/.netrc
543 </command>
544         </hudson.tasks.Shell>
545         <hudson.tasks.Shell>
546           <command>#!/bin/bash
547 # SPDX-License-Identifier: EPL-1.0
548 ##############################################################################
549 # Copyright (c) 2017 The Linux Foundation and others.
550 #
551 # All rights reserved. This program and the accompanying materials
552 # are made available under the terms of the Eclipse Public License v1.0
553 # which accompanies this distribution, and is available at
554 # http://www.eclipse.org/legal/epl-v10.html
555 ##############################################################################
556 echo &quot;---&gt; lftools-install.sh&quot;
557
558 # Script to install lftools via a version passed in via lf-infra-parameters
559 #
560 # Required parameters:
561 #
562 #     LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
563 #                      set to a strict version number like '1.2.3' or using
564 #                      PEP-440 definitions.
565 #
566 #                      Examples:
567 #                          &lt;1.0.0
568 #                          &gt;=1.0.0,&lt;2.0.0
569 #
570 # By default a released version of lftools should always be used.
571 # The purpose of the 2 variables below is so that lftools devs can test
572 # unreleased versions of lftools. There are 2 methods to install a dev version
573 # of lftools:
574 #
575 #     1) gerrit patch: Used to test a patch that has not yet been merged.
576 #                      To do this set something like this:
577 #                          LFTOOLS_MODE=gerrit
578 #                          LFTOOLS_REFSPEC=refs/changes/96/5296/7
579 #
580 #     2) git branch: Used to install an lftools version from a specific branch.
581 #                    To use this set the variables as follows:
582 #                          LFTOOLS_MODE=git
583 #                          LFTOOLS_REFSPEC=master
584 #
585 #     3) release : The intended use case and default setting.
586 #                  Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
587
588 LFTOOLS_MODE=release  # release | git | gerrit
589 LFTOOLS_REFSPEC=master
590
591 # Ensure we fail the job if any steps fail.
592 # DO NOT set -u as virtualenv's activate script has unbound variables
593 set -e -o pipefail
594
595 virtualenv --quiet &quot;/tmp/v/lftools&quot;
596 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
597 source &quot;/tmp/v/lftools/bin/activate&quot;
598 pip install --quiet --upgrade pip
599
600 case $LFTOOLS_MODE in
601     gerrit)
602         git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
603         pushd /tmp/lftools
604         git fetch origin &quot;$LFTOOLS_REFSPEC&quot;
605         git checkout FETCH_HEAD
606         pip install --quiet --upgrade -r requirements.txt
607         pip install --quiet --upgrade -e .
608         popd
609         ;;
610
611     git)
612         pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@&quot;$BRANCH&quot;
613         ;;
614
615     release)
616         if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
617             LFTOOLS_VERSION=&quot;==$LFTOOLS_VERSION&quot;
618         fi
619
620         pip install --quiet --upgrade &quot;lftools${LFTOOLS_VERSION}&quot;
621         ;;
622 esac
623
624 lftools --version
625
626 # pipdeptree prints out a lot of information because lftools pulls in many
627 # dependencies. Let's only print it if we want to debug.
628 # echo &quot;----&gt; Pip Dependency Tree&quot;
629 # pip install --quiet --upgrade pipdeptree
630 # pipdeptree
631
632 #!/bin/bash
633 # SPDX-License-Identifier: EPL-1.0
634 ##############################################################################
635 # Copyright (c) 2017 The Linux Foundation and others.
636 #
637 # All rights reserved. This program and the accompanying materials
638 # are made available under the terms of the Eclipse Public License v1.0
639 # which accompanies this distribution, and is available at
640 # http://www.eclipse.org/legal/epl-v10.html
641 ##############################################################################
642 echo &quot;---&gt; logs-deploy.sh&quot;
643
644 # Ensure we fail the job if any steps fail.
645 set -eu -o pipefail
646
647 set -x  # Trace commands for this script to make debugging easier.
648
649 ARCHIVE_ARTIFACTS=&quot;${ARCHIVE_ARTIFACTS:-}&quot;
650 LOGS_SERVER=&quot;${LOGS_SERVER:-None}&quot;
651
652 if [ &quot;${LOGS_SERVER}&quot; == 'None' ]
653 then
654     set +x # Disable trace since we no longer need it
655
656     echo &quot;WARNING: Logging server not set&quot;
657 else
658     NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
659     NEXUS_PATH=&quot;${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}&quot;
660     BUILD_URL=&quot;${BUILD_URL}&quot;
661
662     lftools deploy archives -p &quot;$ARCHIVE_ARTIFACTS&quot; &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$WORKSPACE&quot;
663     lftools deploy logs &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$BUILD_URL&quot;
664
665     set +x  # Disable trace since we no longer need it.
666
667     echo &quot;Build logs: &lt;a href=\&quot;$LOGS_SERVER/$NEXUS_PATH\&quot;&gt;$LOGS_SERVER/$NEXUS_PATH&lt;/a&gt;&quot;
668 fi
669 </command>
670         </hudson.tasks.Shell>
671         <hudson.tasks.Shell>
672           <command>#!/bin/bash
673 # SPDX-License-Identifier: EPL-1.0
674 ##############################################################################
675 # Copyright (c) 2017 The Linux Foundation and others.
676 #
677 # All rights reserved. This program and the accompanying materials
678 # are made available under the terms of the Eclipse Public License v1.0
679 # which accompanies this distribution, and is available at
680 # http://www.eclipse.org/legal/epl-v10.html
681 ##############################################################################
682
683 # Clear log credential files
684 rm &quot;$SETTINGS_FILE&quot;
685 rm ~/.netrc
686 </command>
687         </hudson.tasks.Shell>
688         <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
689           <regexp>^Build logs: .*</regexp>
690         </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
691       </buildSteps>
692       <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
693       <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
694       <markBuildUnstable>false</markBuildUnstable>
695     </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
696     <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
697       <patterns>
698         <hudson.plugins.ws__cleanup.Pattern>
699           <pattern>**/*.jenkins-trigger</pattern>
700           <type>EXCLUDE</type>
701         </hudson.plugins.ws__cleanup.Pattern>
702       </patterns>
703       <deleteDirs>false</deleteDirs>
704       <cleanupMatrixParent>false</cleanupMatrixParent>
705       <externalDelete/>
706       <cleanWhenSuccess>true</cleanWhenSuccess>
707       <cleanWhenUnstable>true</cleanWhenUnstable>
708       <cleanWhenFailure>true</cleanWhenFailure>
709       <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
710       <cleanWhenAborted>true</cleanWhenAborted>
711       <notFailBuild>true</notFailBuild>
712     </hudson.plugins.ws__cleanup.WsCleanup>
713   </publishers>
714   <buildWrappers>
715     <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
716     <hudson.plugins.build__timeout.BuildTimeoutWrapper>
717       <timeoutMinutes>30</timeoutMinutes>
718       <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
719       <failBuild>true</failBuild>
720       <writingDescription>false</writingDescription>
721       <timeoutPercentage>0</timeoutPercentage>
722       <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
723       <timeoutType>absolute</timeoutType>
724     </hudson.plugins.build__timeout.BuildTimeoutWrapper>
725     <hudson.plugins.timestamper.TimestamperBuildWrapper/>
726     <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
727       <user>test-credential</user>
728     </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
729     <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
730     <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
731       <managedFiles>
732         <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
733           <fileId>npmrc</fileId>
734           <targetLocation>$HOME/.npmrc</targetLocation>
735           <variable/>
736         </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
737       </managedFiles>
738     </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
739   </buildWrappers>
740 </project>