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>true</concurrentBuild>
9 <assignedNode>build-vm</assignedNode>
10 <canRoam>false</canRoam>
12 <com.coravy.hudson.plugins.github.GithubProjectProperty>
13 <projectUrl>$GIT_URL/$GERRIT_PROJECT/example-org/releng/ciman</projectUrl>
14 </com.coravy.hudson.plugins.github.GithubProjectProperty>
15 <hudson.model.ParametersDefinitionProperty>
16 <parameterDefinitions>
17 <hudson.model.StringParameterDefinition>
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
23 <defaultValue>releng/ciman</defaultValue>
24 </hudson.model.StringParameterDefinition>
25 <hudson.model.StringParameterDefinition>
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
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
39 Note that Gerrit will override this parameter automatically if a
40 job is triggered by Gerrit.
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.
48 Note that Gerrit will override this parameter automatically if a
49 job is triggered by Gerrit.
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.
57 Note that Gerrit will override this parameter automatically if a
58 job is triggered by Gerrit.
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 '<1.0.0' or '>=1.0.0,<2.0.0'.
69 <defaultValue><1.0.0</defaultValue>
70 </hudson.model.StringParameterDefinition>
71 <hudson.model.StringParameterDefinition>
73 <description>Path to a Node project directory.</description>
75 </hudson.model.StringParameterDefinition>
76 <hudson.model.StringParameterDefinition>
77 <name>NODE_VERSION</name>
78 <description>Version of NodeJS to install.</description>
79 <defaultValue>6.11.4</defaultValue>
80 </hudson.model.StringParameterDefinition>
81 </parameterDefinitions>
82 </hudson.model.ParametersDefinitionProperty>
84 <scm class="hudson.plugins.git.GitSCM">
85 <configVersion>2</configVersion>
87 <hudson.plugins.git.UserRemoteConfig>
89 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
90 <url>git@github.com:example-org/releng/ciman</url>
91 <credentialsId>test-credential</credentialsId>
92 </hudson.plugins.git.UserRemoteConfig>
95 <hudson.plugins.git.BranchSpec>
97 </hudson.plugins.git.BranchSpec>
100 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
101 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
102 <authorOrCommitter>false</authorOrCommitter>
103 <wipeOutWorkspace>true</wipeOutWorkspace>
104 <pruneBranches>false</pruneBranches>
105 <remotePoll>false</remotePoll>
106 <gitTool>Default</gitTool>
107 <submoduleCfg class="list"/>
112 <skipTag>true</skipTag>
114 <useShallowClone>false</useShallowClone>
115 <ignoreNotifyCommit>false</ignoreNotifyCommit>
117 <hudson.plugins.git.extensions.impl.SubmoduleOption>
118 <disableSubmodules>false</disableSubmodules>
119 <recursiveSubmodules>true</recursiveSubmodules>
120 <trackingSubmodules>false</trackingSubmodules>
122 <timeout>10</timeout>
123 </hudson.plugins.git.extensions.impl.SubmoduleOption>
124 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
127 <triggers class="vector">
128 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
131 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
135 <triggerPhrase>^recheck$</triggerPhrase>
136 <onlyTriggerPhrase>false</onlyTriggerPhrase>
137 <useGitHubHooks>true</useGitHubHooks>
138 <permitAll>true</permitAll>
139 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
141 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
142 <commitStatusContext>Node Verify</commitStatusContext>
143 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
145 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
150 # SPDX-License-Identifier: EPL-1.0
151 ##############################################################################
152 # Copyright (c) 2017 The Linux Foundation and others.
154 # All rights reserved. This program and the accompanying materials
155 # are made available under the terms of the Eclipse Public License v1.0
156 # which accompanies this distribution, and is available at
157 # http://www.eclipse.org/legal/epl-v10.html
158 ##############################################################################
159 echo "---> node-install.sh"
161 # Ensure we fail the job if any steps fail.
162 # DO NOT set -u as virtualenv's activate script has unbound variables
165 virtualenv --quiet "/tmp/v/python"
166 # shellcheck source=/tmp/v/node/bin/activate disable=SC1091
167 source "/tmp/v/python/bin/activate"
168 pip install --quiet --upgrade pip
169 pip install --quiet --upgrade pipdeptree
170 pip install --quiet --upgrade nodeenv
172 echo "----> Pip Dependency Tree"
176 # SPDX-License-Identifier: EPL-1.0
177 ##############################################################################
178 # Copyright (c) 2017 The Linux Foundation and others.
180 # All rights reserved. This program and the accompanying materials
181 # are made available under the terms of the Eclipse Public License v1.0
182 # which accompanies this distribution, and is available at
183 # http://www.eclipse.org/legal/epl-v10.html
184 ##############################################################################
185 echo "---> node-run.sh"
187 # Ensure we fail the job if any steps fail.
188 # DO NOT set -u as virtualenv's activate script has unbound variables
192 nodeenv --node="$NODE_VERSION" --prebuilt "/tmp/v/node"
193 source /tmp/v/node/bin/activate
194 cd "$WORKSPACE/$NODE_DIR"
198 </hudson.tasks.Shell>
201 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
205 # SPDX-License-Identifier: EPL-1.0
206 ##############################################################################
207 # Copyright (c) 2017 The Linux Foundation and others.
209 # All rights reserved. This program and the accompanying materials
210 # are made available under the terms of the Eclipse Public License v1.0
211 # which accompanies this distribution, and is available at
212 # http://www.eclipse.org/legal/epl-v10.html
213 ##############################################################################
214 echo "---> sysstat.sh"
215 set +e # DON'T fail build if script fails.
217 OS=$(facter operatingsystem)
218 case "$OS" in
220 SYSSTAT_PATH="/var/log/sysstat"
222 # Dont run the script when systat is not enabled by default
223 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
228 SYSSTAT_PATH="/var/log/sa"
236 SAR_DIR="$WORKSPACE/archives/sar-reports"
237 mkdir -p "$SAR_DIR"
238 cp "$SYSSTAT_PATH/"* "$_"
239 # convert sar data to ascii format
240 while IFS="" read -r s
242 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
243 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
245 # DON'T fail build if script fails.
248 </hudson.tasks.Shell>
249 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
251 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
252 <fileId>jenkins-log-archives-settings</fileId>
254 <variable>SETTINGS_FILE</variable>
255 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
257 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
260 <propertiesContent>SERVER_ID=logs</propertiesContent>
265 # SPDX-License-Identifier: EPL-1.0
266 ##############################################################################
267 # Copyright (c) 2017 The Linux Foundation and others.
269 # All rights reserved. This program and the accompanying materials
270 # are made available under the terms of the Eclipse Public License v1.0
271 # which accompanies this distribution, and is available at
272 # http://www.eclipse.org/legal/epl-v10.html
273 ##############################################################################
274 echo "---> create-netrc.sh"
276 # Ensure we fail the job if any steps fail.
279 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
280 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
281 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
282 -v x:username -o ":" -v x:password \
283 "$SETTINGS_FILE")
285 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
286 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
287 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
289 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
291 </hudson.tasks.Shell>
294 # SPDX-License-Identifier: EPL-1.0
295 ##############################################################################
296 # Copyright (c) 2017 The Linux Foundation and others.
298 # All rights reserved. This program and the accompanying materials
299 # are made available under the terms of the Eclipse Public License v1.0
300 # which accompanies this distribution, and is available at
301 # http://www.eclipse.org/legal/epl-v10.html
302 ##############################################################################
303 echo "---> lftools-install.sh"
305 # Script to install lftools via a version passed in via lf-infra-parameters
307 # Required parameters:
309 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
310 # set to a strict version number like '1.2.3' or using
311 # PEP-440 definitions.
315 # >=1.0.0,<2.0.0
317 # By default a released version of lftools should always be used.
318 # The purpose of the 2 variables below is so that lftools devs can test
319 # unreleased versions of lftools. There are 2 methods to install a dev version
322 # 1) gerrit patch: Used to test a patch that has not yet been merged.
323 # To do this set something like this:
324 # LFTOOLS_MODE=gerrit
325 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
327 # 2) git branch: Used to install an lftools version from a specific branch.
328 # To use this set the variables as follows:
330 # LFTOOLS_REFSPEC=master
332 # 3) release : The intended use case and default setting.
333 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
335 LFTOOLS_MODE=release # release | git | gerrit
336 LFTOOLS_REFSPEC=master
338 # Ensure we fail the job if any steps fail.
339 # DO NOT set -u as virtualenv's activate script has unbound variables
342 virtualenv --quiet "/tmp/v/lftools"
343 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
344 source "/tmp/v/lftools/bin/activate"
345 pip install --quiet --upgrade pip
347 case $LFTOOLS_MODE in
349 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
351 git fetch origin "$LFTOOLS_REFSPEC"
352 git checkout FETCH_HEAD
353 pip install --quiet --upgrade -r requirements.txt
354 pip install --quiet --upgrade -e .
359 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
363 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
364 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
367 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
373 # pipdeptree prints out a lot of information because lftools pulls in many
374 # dependencies. Let's only print it if we want to debug.
375 # echo "----> Pip Dependency Tree"
376 # pip install --quiet --upgrade pipdeptree
380 # SPDX-License-Identifier: EPL-1.0
381 ##############################################################################
382 # Copyright (c) 2017 The Linux Foundation and others.
384 # All rights reserved. This program and the accompanying materials
385 # are made available under the terms of the Eclipse Public License v1.0
386 # which accompanies this distribution, and is available at
387 # http://www.eclipse.org/legal/epl-v10.html
388 ##############################################################################
389 echo "---> logs-deploy.sh"
391 # Ensure we fail the job if any steps fail.
394 set -x # Trace commands for this script to make debugging easier.
396 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
397 LOGS_SERVER="${LOGS_SERVER:-None}"
399 if [ "${LOGS_SERVER}" == 'None' ]
401 set +x # Disable trace since we no longer need it
403 echo "WARNING: Logging server not set"
405 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
406 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
407 BUILD_URL="${BUILD_URL}"
409 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
410 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
412 set +x # Disable trace since we no longer need it.
414 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
417 </hudson.tasks.Shell>
420 # SPDX-License-Identifier: EPL-1.0
421 ##############################################################################
422 # Copyright (c) 2017 The Linux Foundation and others.
424 # All rights reserved. This program and the accompanying materials
425 # are made available under the terms of the Eclipse Public License v1.0
426 # which accompanies this distribution, and is available at
427 # http://www.eclipse.org/legal/epl-v10.html
428 ##############################################################################
430 # Clear log credential files
431 rm "$SETTINGS_FILE"
434 </hudson.tasks.Shell>
435 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
436 <regexp>^Build logs: .*</regexp>
437 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
439 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
440 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
441 <markBuildUnstable>false</markBuildUnstable>
442 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
443 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
445 <hudson.plugins.ws__cleanup.Pattern>
446 <pattern>**/*.jenkins-trigger</pattern>
448 </hudson.plugins.ws__cleanup.Pattern>
450 <deleteDirs>false</deleteDirs>
451 <cleanupMatrixParent>false</cleanupMatrixParent>
453 <cleanWhenSuccess>true</cleanWhenSuccess>
454 <cleanWhenUnstable>true</cleanWhenUnstable>
455 <cleanWhenFailure>true</cleanWhenFailure>
456 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
457 <cleanWhenAborted>true</cleanWhenAborted>
458 <notFailBuild>true</notFailBuild>
459 </hudson.plugins.ws__cleanup.WsCleanup>
462 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
463 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
464 <timeoutMinutes>10</timeoutMinutes>
465 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
466 <failBuild>true</failBuild>
467 <writingDescription>false</writingDescription>
468 <timeoutPercentage>0</timeoutPercentage>
469 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
470 <timeoutType>absolute</timeoutType>
471 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
472 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
473 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
474 <user>test-credential</user>
475 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
476 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>