Merge "Remove port from NEXUS_URL for netrc"
[releng/global-jjb.git] / .jjb-test / expected-xml / gerrit-rtd-rtd-merge-master
1 <?xml version="1.0" encoding="utf-8"?>
2 <project>
3   <actions/>
4   <description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
5   <keepDependencies>false</keepDependencies>
6   <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
7   <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
8   <concurrentBuild>false</concurrentBuild>
9   <assignedNode>build-vm</assignedNode>
10   <canRoam>false</canRoam>
11   <properties>
12     <jenkins.model.BuildDiscarderProperty>
13       <strategy class="hudson.tasks.LogRotator">
14         <daysToKeep>7</daysToKeep>
15         <numToKeep>-1</numToKeep>
16         <artifactDaysToKeep>-1</artifactDaysToKeep>
17         <artifactNumToKeep>0</artifactNumToKeep>
18       </strategy>
19     </jenkins.model.BuildDiscarderProperty>
20     <hudson.model.ParametersDefinitionProperty>
21       <parameterDefinitions>
22         <hudson.model.StringParameterDefinition>
23           <name>PROJECT</name>
24           <description>Parameter to identify a Gerrit project. This is typically the
25 project repo path as exists in Gerrit.
26 For example: ofextensions/circuitsw
27 </description>
28           <defaultValue>releng/ciman</defaultValue>
29         </hudson.model.StringParameterDefinition>
30         <hudson.model.StringParameterDefinition>
31           <name>STREAM</name>
32           <description>Stream is often set to the same name as 'branch' but can
33 sometimes be used as a name representing a project's release code
34 name.
35 </description>
36           <defaultValue>master</defaultValue>
37         </hudson.model.StringParameterDefinition>
38         <hudson.model.StringParameterDefinition>
39           <name>GERRIT_PROJECT</name>
40           <description>Parameter to identify Gerrit project. This is typically the
41 project repo path as exists in Gerrit.
42 For example: ofextensions/circuitsw
43
44 Note that Gerrit will override this parameter automatically if a
45 job is triggered by Gerrit.
46 </description>
47           <defaultValue>releng/ciman</defaultValue>
48         </hudson.model.StringParameterDefinition>
49         <hudson.model.StringParameterDefinition>
50           <name>GERRIT_BRANCH</name>
51           <description>Parameter to identify a Gerrit branch.
52
53 Note that Gerrit will override this parameter automatically if a
54 job is triggered by Gerrit.
55 </description>
56           <defaultValue>master</defaultValue>
57         </hudson.model.StringParameterDefinition>
58         <hudson.model.StringParameterDefinition>
59           <name>GERRIT_REFSPEC</name>
60           <description>Parameter to identify a refspec when pulling from Gerrit.
61
62 Note that Gerrit will override this parameter automatically if a
63 job is triggered by Gerrit.
64 </description>
65           <defaultValue>refs/heads/master</defaultValue>
66         </hudson.model.StringParameterDefinition>
67         <hudson.model.StringParameterDefinition>
68           <name>LFTOOLS_VERSION</name>
69           <description>Version of lftools to install. Can be a specific version like
70 '0.6.0' or a PEP-440 definition.
71 https://www.python.org/dev/peps/pep-0440/
72 For example '&lt;1.0.0' or '&gt;=1.0.0,&lt;2.0.0'.
73 </description>
74           <defaultValue>&lt;1.0.0</defaultValue>
75         </hudson.model.StringParameterDefinition>
76       </parameterDefinitions>
77     </hudson.model.ParametersDefinitionProperty>
78   </properties>
79   <scm class="hudson.scm.NullSCM"/>
80   <triggers class="vector">
81     <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
82       <spec/>
83       <gerritProjects>
84         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
85           <compareType>ANT</compareType>
86           <pattern>**</pattern>
87           <branches>
88             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
89               <compareType>ANT</compareType>
90               <pattern>**/master</pattern>
91             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
92           </branches>
93           <filePaths>
94             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
95               <compareType>ANT</compareType>
96               <pattern>**/*.rst</pattern>
97             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
98             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
99               <compareType>ANT</compareType>
100               <pattern>**/conf.py</pattern>
101             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
102           </filePaths>
103           <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
104         </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
105       </gerritProjects>
106       <skipVote>
107         <onSuccessful>false</onSuccessful>
108         <onFailed>false</onFailed>
109         <onUnstable>false</onUnstable>
110         <onNotBuilt>false</onNotBuilt>
111       </skipVote>
112       <silentMode>false</silentMode>
113       <silentStartMode>false</silentStartMode>
114       <escapeQuotes>true</escapeQuotes>
115       <noNameAndEmailParameters>false</noNameAndEmailParameters>
116       <readableMessage>false</readableMessage>
117       <dependencyJobsNames/>
118       <notificationLevel/>
119       <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
120       <triggerConfigURL/>
121       <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
122       <triggerOnEvents>
123         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginChangeMergedEvent/>
124         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
125           <commentAddedCommentContains>remerge$</commentAddedCommentContains>
126         </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
127       </triggerOnEvents>
128       <buildStartMessage/>
129       <buildFailureMessage/>
130       <buildSuccessfulMessage/>
131       <buildUnstableMessage/>
132       <buildNotBuiltMessage/>
133       <buildUnsuccessfulFilepath/>
134       <customUrl/>
135       <serverName>test-server</serverName>
136     </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
137   </triggers>
138   <builders>
139     <EnvInjectBuilder>
140       <info>
141         <propertiesContent>RTD_PROJECT=gerrit-rtd</propertiesContent>
142       </info>
143     </EnvInjectBuilder>
144     <hudson.tasks.Shell>
145       <command>#!/bin/bash
146 # SPDX-License-Identifier: EPL-1.0
147 ##############################################################################
148 # Copyright (c) 2017 The Linux Foundation and others.
149 #
150 # All rights reserved. This program and the accompanying materials
151 # are made available under the terms of the Eclipse Public License v1.0
152 # which accompanies this distribution, and is available at
153 # http://www.eclipse.org/legal/epl-v10.html
154 ##############################################################################
155 echo &quot;---&gt; rtd-trigger-build.sh&quot;
156
157 if [ &quot;$GERRIT_BRANCH&quot; == &quot;master&quot; ]; then
158     RTD_BUILD_VERSION=latest
159 else
160     RTD_BUILD_VERSION=&quot;${GERRIT_BRANCH/\//-}&quot;
161 fi
162
163 curl -X POST --data &quot;version_slug=$RTD_BUILD_VERSION&quot; &quot;https://readthedocs.org/build/$RTD_PROJECT&quot;
164 </command>
165     </hudson.tasks.Shell>
166   </builders>
167   <publishers>
168     <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
169       <buildSteps>
170         <hudson.tasks.Shell>
171           <command>#!/bin/bash
172 # SPDX-License-Identifier: EPL-1.0
173 ##############################################################################
174 # Copyright (c) 2017 The Linux Foundation and others.
175 #
176 # All rights reserved. This program and the accompanying materials
177 # are made available under the terms of the Eclipse Public License v1.0
178 # which accompanies this distribution, and is available at
179 # http://www.eclipse.org/legal/epl-v10.html
180 ##############################################################################
181 echo &quot;---&gt; sysstat.sh&quot;
182 set +e  # DON'T fail build if script fails.
183
184 OS=$(facter operatingsystem)
185 case &quot;$OS&quot; in
186     Ubuntu)
187         SYSSTAT_PATH=&quot;/var/log/sysstat&quot;
188
189         # Dont run the script when systat is not enabled by default
190         if ! grep --quiet 'ENABLED=&quot;true&quot;' &quot;/etc/default/sysstat&quot;; then
191             exit 0
192         fi
193     ;;
194     CentOS|RedHat)
195         SYSSTAT_PATH=&quot;/var/log/sa&quot;
196     ;;
197     *)
198         # nothing to do
199         exit 0
200     ;;
201 esac
202
203 SAR_DIR=&quot;$WORKSPACE/archives/sar-reports&quot;
204 mkdir -p &quot;$SAR_DIR&quot;
205 cp &quot;$SYSSTAT_PATH/&quot;* &quot;$_&quot;
206 # convert sar data to ascii format
207 while IFS=&quot;&quot; read -r s
208 do
209     [ -f &quot;$s&quot; ] &amp;&amp; LC_TIME=POSIX sar -A -f &quot;$s&quot; &gt; &quot;$SAR_DIR/sar${s//[!0-9]/}&quot;
210 done &lt; &lt;(find &quot;$SYSSTAT_PATH&quot; -name &quot;sa[0-9]*&quot; || true)
211
212 # DON'T fail build if script fails.
213 exit 0
214 </command>
215         </hudson.tasks.Shell>
216         <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
217           <managedFiles>
218             <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
219               <fileId>jenkins-log-archives-settings</fileId>
220               <targetLocation/>
221               <variable>SETTINGS_FILE</variable>
222             </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
223           </managedFiles>
224         </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
225         <EnvInjectBuilder>
226           <info>
227             <propertiesContent>SERVER_ID=logs</propertiesContent>
228           </info>
229         </EnvInjectBuilder>
230         <hudson.tasks.Shell>
231           <command>#!/bin/bash
232 # SPDX-License-Identifier: EPL-1.0
233 ##############################################################################
234 # Copyright (c) 2017 The Linux Foundation and others.
235 #
236 # All rights reserved. This program and the accompanying materials
237 # are made available under the terms of the Eclipse Public License v1.0
238 # which accompanies this distribution, and is available at
239 # http://www.eclipse.org/legal/epl-v10.html
240 ##############################################################################
241 echo &quot;---&gt; create-netrc.sh&quot;
242
243 # Ensure we fail the job if any steps fail.
244 set -eu -o pipefail
245
246 NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
247 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
248     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
249     -v x:username -o &quot;:&quot; -v x:password \
250     &quot;$SETTINGS_FILE&quot;)
251
252 machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
253 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
254 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
255
256 echo &quot;machine ${machine%:*} login $user password $pass&quot; &gt; ~/.netrc
257 </command>
258         </hudson.tasks.Shell>
259         <hudson.tasks.Shell>
260           <command>#!/bin/bash
261 # SPDX-License-Identifier: EPL-1.0
262 ##############################################################################
263 # Copyright (c) 2017 The Linux Foundation and others.
264 #
265 # All rights reserved. This program and the accompanying materials
266 # are made available under the terms of the Eclipse Public License v1.0
267 # which accompanies this distribution, and is available at
268 # http://www.eclipse.org/legal/epl-v10.html
269 ##############################################################################
270 echo &quot;---&gt; lftools-install.sh&quot;
271
272 # Script to install lftools via a version passed in via lf-infra-parameters
273 #
274 # Required parameters:
275 #
276 #     LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
277 #                      set to a strict version number like '1.2.3' or using
278 #                      PEP-440 definitions.
279 #
280 #                      Examples:
281 #                          &lt;1.0.0
282 #                          &gt;=1.0.0,&lt;2.0.0
283 #
284 # By default a released version of lftools should always be used.
285 # The purpose of the 2 variables below is so that lftools devs can test
286 # unreleased versions of lftools. There are 2 methods to install a dev version
287 # of lftools:
288 #
289 #     1) gerrit patch: Used to test a patch that has not yet been merged.
290 #                      To do this set something like this:
291 #                          LFTOOLS_MODE=gerrit
292 #                          LFTOOLS_REFSPEC=refs/changes/96/5296/7
293 #
294 #     2) git branch: Used to install an lftools version from a specific branch.
295 #                    To use this set the variables as follows:
296 #                          LFTOOLS_MODE=git
297 #                          LFTOOLS_REFSPEC=master
298 #
299 #     3) release : The intended use case and default setting.
300 #                  Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
301
302 LFTOOLS_MODE=release  # release | git | gerrit
303 LFTOOLS_REFSPEC=master
304
305 # Ensure we fail the job if any steps fail.
306 # DO NOT set -u as virtualenv's activate script has unbound variables
307 set -e -o pipefail
308
309 virtualenv --quiet &quot;/tmp/v/lftools&quot;
310 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
311 source &quot;/tmp/v/lftools/bin/activate&quot;
312 pip install --quiet --upgrade pip
313
314 case $LFTOOLS_MODE in
315     gerrit)
316         git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
317         pushd /tmp/lftools
318         git fetch origin &quot;$LFTOOLS_REFSPEC&quot;
319         git checkout FETCH_HEAD
320         pip install --quiet --upgrade -r requirements.txt
321         pip install --quiet --upgrade -e .
322         popd
323         ;;
324
325     git)
326         pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@&quot;$BRANCH&quot;
327         ;;
328
329     release)
330         if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
331             LFTOOLS_VERSION=&quot;==$LFTOOLS_VERSION&quot;
332         fi
333
334         pip install --quiet --upgrade &quot;lftools${LFTOOLS_VERSION}&quot;
335         ;;
336 esac
337
338 lftools --version
339
340 # pipdeptree prints out a lot of information because lftools pulls in many
341 # dependencies. Let's only print it if we want to debug.
342 # echo &quot;----&gt; Pip Dependency Tree&quot;
343 # pip install --quiet --upgrade pipdeptree
344 # pipdeptree
345
346 #!/bin/bash
347 # SPDX-License-Identifier: EPL-1.0
348 ##############################################################################
349 # Copyright (c) 2017 The Linux Foundation and others.
350 #
351 # All rights reserved. This program and the accompanying materials
352 # are made available under the terms of the Eclipse Public License v1.0
353 # which accompanies this distribution, and is available at
354 # http://www.eclipse.org/legal/epl-v10.html
355 ##############################################################################
356 echo &quot;---&gt; logs-deploy.sh&quot;
357
358 # Ensure we fail the job if any steps fail.
359 set -eu -o pipefail
360
361 set -x  # Trace commands for this script to make debugging easier.
362
363 ARCHIVE_ARTIFACTS=&quot;${ARCHIVE_ARTIFACTS:-}&quot;
364 LOGS_SERVER=&quot;${LOGS_SERVER:-None}&quot;
365
366 if [ &quot;${LOGS_SERVER}&quot; == 'None' ]
367 then
368     set +x # Disable trace since we no longer need it
369
370     echo &quot;WARNING: Logging server not set&quot;
371 else
372     NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
373     NEXUS_PATH=&quot;${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}&quot;
374     BUILD_URL=&quot;${BUILD_URL}&quot;
375
376     lftools deploy archives -p &quot;$ARCHIVE_ARTIFACTS&quot; &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$WORKSPACE&quot;
377     lftools deploy logs &quot;$NEXUS_URL&quot; &quot;$NEXUS_PATH&quot; &quot;$BUILD_URL&quot;
378
379     set +x  # Disable trace since we no longer need it.
380
381     echo &quot;Build logs: &lt;a href=\&quot;$LOGS_SERVER/$NEXUS_PATH\&quot;&gt;$LOGS_SERVER/$NEXUS_PATH&lt;/a&gt;&quot;
382 fi
383 </command>
384         </hudson.tasks.Shell>
385         <hudson.tasks.Shell>
386           <command>#!/bin/bash
387 # SPDX-License-Identifier: EPL-1.0
388 ##############################################################################
389 # Copyright (c) 2017 The Linux Foundation and others.
390 #
391 # All rights reserved. This program and the accompanying materials
392 # are made available under the terms of the Eclipse Public License v1.0
393 # which accompanies this distribution, and is available at
394 # http://www.eclipse.org/legal/epl-v10.html
395 ##############################################################################
396
397 # Clear log credential files
398 rm &quot;$SETTINGS_FILE&quot;
399 rm ~/.netrc
400 </command>
401         </hudson.tasks.Shell>
402         <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
403           <regexp>^Build logs: .*</regexp>
404         </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
405       </buildSteps>
406       <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
407       <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
408       <markBuildUnstable>false</markBuildUnstable>
409     </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
410     <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
411       <patterns>
412         <hudson.plugins.ws__cleanup.Pattern>
413           <pattern>**/*.jenkins-trigger</pattern>
414           <type>EXCLUDE</type>
415         </hudson.plugins.ws__cleanup.Pattern>
416       </patterns>
417       <deleteDirs>false</deleteDirs>
418       <cleanupMatrixParent>false</cleanupMatrixParent>
419       <externalDelete/>
420       <cleanWhenSuccess>true</cleanWhenSuccess>
421       <cleanWhenUnstable>true</cleanWhenUnstable>
422       <cleanWhenFailure>true</cleanWhenFailure>
423       <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
424       <cleanWhenAborted>true</cleanWhenAborted>
425       <notFailBuild>true</notFailBuild>
426     </hudson.plugins.ws__cleanup.WsCleanup>
427   </publishers>
428   <buildWrappers>
429     <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
430     <hudson.plugins.build__timeout.BuildTimeoutWrapper>
431       <timeoutMinutes>15</timeoutMinutes>
432       <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
433       <failBuild>true</failBuild>
434       <writingDescription>false</writingDescription>
435       <timeoutPercentage>0</timeoutPercentage>
436       <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
437       <timeoutType>absolute</timeoutType>
438     </hudson.plugins.build__timeout.BuildTimeoutWrapper>
439     <hudson.plugins.timestamper.TimestamperBuildWrapper/>
440     <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
441       <user>test-credential</user>
442     </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
443     <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
444   </buildWrappers>
445 </project>