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