1 <?xml version="1.0" encoding="utf-8"?>
4 <description><!-- Managed by Jenkins Job Builder --></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>
12 <com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github">
13 <projectUrl>https://github.com/example-org/releng/ciman</projectUrl>
15 </com.coravy.hudson.plugins.github.GithubProjectProperty>
16 <hudson.model.ParametersDefinitionProperty>
17 <parameterDefinitions>
18 <hudson.model.StringParameterDefinition>
20 <description>Parameter to identify a Gerrit project. This is typically the
21 project repo path as exists in Gerrit.
22 For example: ofextensions/circuitsw
24 <defaultValue>releng/ciman</defaultValue>
25 </hudson.model.StringParameterDefinition>
26 <hudson.model.StringParameterDefinition>
28 <description>Stream is often set to the same name as 'branch' but can
29 sometimes be used as a name representing a project's release code
32 <defaultValue>master</defaultValue>
33 </hudson.model.StringParameterDefinition>
34 <hudson.model.StringParameterDefinition>
35 <name>GERRIT_PROJECT</name>
36 <description>Parameter to identify Gerrit project. This is typically the
37 project repo path as exists in Gerrit.
38 For example: ofextensions/circuitsw
40 Note that Gerrit will override this parameter automatically if a
41 job is triggered by Gerrit.
43 <defaultValue>releng/ciman</defaultValue>
44 </hudson.model.StringParameterDefinition>
45 <hudson.model.StringParameterDefinition>
46 <name>GERRIT_BRANCH</name>
47 <description>Parameter to identify a Gerrit branch.
49 Note that Gerrit will override this parameter automatically if a
50 job is triggered by Gerrit.
52 <defaultValue>master</defaultValue>
53 </hudson.model.StringParameterDefinition>
54 <hudson.model.StringParameterDefinition>
55 <name>GERRIT_REFSPEC</name>
56 <description>Parameter to identify a refspec when pulling from Gerrit.
58 Note that Gerrit will override this parameter automatically if a
59 job is triggered by Gerrit.
61 <defaultValue>refs/heads/master</defaultValue>
62 </hudson.model.StringParameterDefinition>
63 <hudson.model.StringParameterDefinition>
64 <name>LFTOOLS_VERSION</name>
65 <description>Version of lftools to install. Can be a specific version like
66 '0.6.0' or a PEP-440 definition.
67 https://www.python.org/dev/peps/pep-0440/
68 For example '<1.0.0' or '>=1.0.0,<2.0.0'.
70 <defaultValue><1.0.0</defaultValue>
71 </hudson.model.StringParameterDefinition>
72 </parameterDefinitions>
73 </hudson.model.ParametersDefinitionProperty>
75 <scm class="hudson.scm.NullSCM"/>
76 <triggers class="vector">
77 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
80 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
86 <triggerPhrase>^remerge$</triggerPhrase>
88 <onlyTriggerPhrase>false</onlyTriggerPhrase>
89 <useGitHubHooks>true</useGitHubHooks>
90 <permitAll>true</permitAll>
91 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
93 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
94 <commitStatusContext>RTD Merge</commitStatusContext>
95 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
97 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
98 <hudson.triggers.TimerTrigger>
99 <spec>H H * * *</spec>
100 </hudson.triggers.TimerTrigger>
105 <propertiesContent>RTD_PROJECT=github-rtd</propertiesContent>
110 # SPDX-License-Identifier: EPL-1.0
111 ##############################################################################
112 # Copyright (c) 2017 The Linux Foundation and others.
114 # All rights reserved. This program and the accompanying materials
115 # are made available under the terms of the Eclipse Public License v1.0
116 # which accompanies this distribution, and is available at
117 # http://www.eclipse.org/legal/epl-v10.html
118 ##############################################################################
119 echo "---> rtd-trigger-build.sh"
121 if [ "$GERRIT_BRANCH" == "master" ]; then
122 RTD_BUILD_VERSION=latest
124 RTD_BUILD_VERSION="${GERRIT_BRANCH/\//-}"
127 curl -X POST --data "version_slug=$RTD_BUILD_VERSION" "https://readthedocs.org/build/$RTD_PROJECT"
129 </hudson.tasks.Shell>
132 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
136 # SPDX-License-Identifier: EPL-1.0
137 ##############################################################################
138 # Copyright (c) 2017 The Linux Foundation and others.
140 # All rights reserved. This program and the accompanying materials
141 # are made available under the terms of the Eclipse Public License v1.0
142 # which accompanies this distribution, and is available at
143 # http://www.eclipse.org/legal/epl-v10.html
144 ##############################################################################
145 echo "---> sysstat.sh"
146 set +e # DON'T fail build if script fails.
148 OS=$(facter operatingsystem)
149 case "$OS" in
151 SYSSTAT_PATH="/var/log/sysstat"
153 # Dont run the script when systat is not enabled by default
154 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
159 SYSSTAT_PATH="/var/log/sa"
167 SAR_DIR="$WORKSPACE/archives/sar-reports"
168 mkdir -p "$SAR_DIR"
169 cp "$SYSSTAT_PATH/"* "$_"
170 # convert sar data to ascii format
171 while IFS="" read -r sarfilenum
173 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
174 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
176 # DON'T fail build if script fails.
179 </hudson.tasks.Shell>
180 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
182 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
183 <fileId>jenkins-log-archives-settings</fileId>
185 <variable>SETTINGS_FILE</variable>
186 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
188 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
191 <propertiesContent>SERVER_ID=logs</propertiesContent>
196 # SPDX-License-Identifier: EPL-1.0
197 ##############################################################################
198 # Copyright (c) 2017 The Linux Foundation and others.
200 # All rights reserved. This program and the accompanying materials
201 # are made available under the terms of the Eclipse Public License v1.0
202 # which accompanies this distribution, and is available at
203 # http://www.eclipse.org/legal/epl-v10.html
204 ##############################################################################
205 echo "---> create-netrc.sh"
207 # Ensure we fail the job if any steps fail.
210 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
211 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
212 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
213 -v x:username -o ":" -v x:password \
214 "$SETTINGS_FILE")
216 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
217 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
218 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
220 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
222 </hudson.tasks.Shell>
225 # SPDX-License-Identifier: EPL-1.0
226 ##############################################################################
227 # Copyright (c) 2017 The Linux Foundation and others.
229 # All rights reserved. This program and the accompanying materials
230 # are made available under the terms of the Eclipse Public License v1.0
231 # which accompanies this distribution, and is available at
232 # http://www.eclipse.org/legal/epl-v10.html
233 ##############################################################################
234 echo "---> lftools-install.sh"
236 # Script to install lftools via a version passed in via lf-infra-parameters
238 # Required parameters:
240 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
241 # set to a strict version number like '1.2.3' or using
242 # PEP-440 definitions.
246 # >=1.0.0,<2.0.0
248 # By default a released version of lftools should always be used.
249 # The purpose of the 2 variables below is so that lftools devs can test
250 # unreleased versions of lftools. There are 2 methods to install a dev version
253 # 1) gerrit patch: Used to test a patch that has not yet been merged.
254 # To do this set something like this:
255 # LFTOOLS_MODE=gerrit
256 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
258 # 2) git branch: Used to install an lftools version from a specific branch.
259 # To use this set the variables as follows:
261 # LFTOOLS_REFSPEC=master
263 # 3) release : The intended use case and default setting.
264 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
266 LFTOOLS_MODE=release # release | git | gerrit
267 LFTOOLS_REFSPEC=master
269 # Ensure we fail the job if any steps fail.
270 # DO NOT set -u as virtualenv's activate script has unbound variables
273 virtualenv --quiet "/tmp/v/lftools"
274 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
275 source "/tmp/v/lftools/bin/activate"
276 pip install --quiet --upgrade pip
278 case $LFTOOLS_MODE in
280 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
282 git fetch origin "$LFTOOLS_REFSPEC"
283 git checkout FETCH_HEAD
284 pip install --quiet --upgrade -r requirements.txt
285 pip install --quiet --upgrade -e .
290 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
294 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
295 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
298 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
304 # pipdeptree prints out a lot of information because lftools pulls in many
305 # dependencies. Let's only print it if we want to debug.
306 # echo "----> Pip Dependency Tree"
307 # pip install --quiet --upgrade pipdeptree
311 # SPDX-License-Identifier: EPL-1.0
312 ##############################################################################
313 # Copyright (c) 2017 The Linux Foundation and others.
315 # All rights reserved. This program and the accompanying materials
316 # are made available under the terms of the Eclipse Public License v1.0
317 # which accompanies this distribution, and is available at
318 # http://www.eclipse.org/legal/epl-v10.html
319 ##############################################################################
320 echo "---> logs-deploy.sh"
322 # Ensure we fail the job if any steps fail.
325 set -x # Trace commands for this script to make debugging easier.
327 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
328 LOGS_SERVER="${LOGS_SERVER:-None}"
330 if [ "${LOGS_SERVER}" == 'None' ]
332 set +x # Disable trace since we no longer need it
334 echo "WARNING: Logging server not set"
336 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
337 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
338 BUILD_URL="${BUILD_URL}"
340 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
341 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
343 set +x # Disable trace since we no longer need it.
345 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
348 </hudson.tasks.Shell>
351 # SPDX-License-Identifier: EPL-1.0
352 ##############################################################################
353 # Copyright (c) 2017 The Linux Foundation and others.
355 # All rights reserved. This program and the accompanying materials
356 # are made available under the terms of the Eclipse Public License v1.0
357 # which accompanies this distribution, and is available at
358 # http://www.eclipse.org/legal/epl-v10.html
359 ##############################################################################
361 # Clear log credential files
362 rm "$SETTINGS_FILE"
365 </hudson.tasks.Shell>
366 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
367 <regexp>^Build logs: .*</regexp>
368 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
370 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
371 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
372 <markBuildUnstable>false</markBuildUnstable>
373 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
374 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
376 <hudson.plugins.ws__cleanup.Pattern>
377 <pattern>**/*.jenkins-trigger</pattern>
379 </hudson.plugins.ws__cleanup.Pattern>
381 <deleteDirs>false</deleteDirs>
382 <cleanupMatrixParent>false</cleanupMatrixParent>
384 <cleanWhenSuccess>true</cleanWhenSuccess>
385 <cleanWhenUnstable>true</cleanWhenUnstable>
386 <cleanWhenFailure>true</cleanWhenFailure>
387 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
388 <cleanWhenAborted>true</cleanWhenAborted>
389 <notFailBuild>true</notFailBuild>
390 </hudson.plugins.ws__cleanup.WsCleanup>
393 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
394 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
395 <timeoutMinutes>15</timeoutMinutes>
396 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
397 <failBuild>true</failBuild>
398 <writingDescription>false</writingDescription>
399 <timeoutPercentage>0</timeoutPercentage>
400 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
401 <timeoutType>absolute</timeoutType>
402 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
403 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
404 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
405 <user>test-credential</user>
406 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
407 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
408 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
410 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
411 <fileId>npmrc</fileId>
412 <targetLocation>$HOME/.npmrc</targetLocation>
414 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
416 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>