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 plugin="github">
13 <projectUrl>$GIT_URL/$GERRIT_PROJECT/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 <hudson.model.StringParameterDefinition>
74 <description>Path to a Node project directory.</description>
76 </hudson.model.StringParameterDefinition>
77 <hudson.model.StringParameterDefinition>
78 <name>NODE_VERSION</name>
79 <description>Version of NodeJS to install.</description>
80 <defaultValue>6.11.4</defaultValue>
81 </hudson.model.StringParameterDefinition>
82 </parameterDefinitions>
83 </hudson.model.ParametersDefinitionProperty>
85 <scm class="hudson.plugins.git.GitSCM">
86 <configVersion>2</configVersion>
88 <hudson.plugins.git.UserRemoteConfig>
90 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
91 <url>git@github.com:example-org/releng/ciman</url>
92 <credentialsId>test-credential</credentialsId>
93 </hudson.plugins.git.UserRemoteConfig>
96 <hudson.plugins.git.BranchSpec>
98 </hudson.plugins.git.BranchSpec>
100 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
101 <remotePoll>false</remotePoll>
102 <gitTool>Default</gitTool>
103 <submoduleCfg class="list"/>
108 <hudson.plugins.git.extensions.impl.BuildChooserSetting>
109 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
110 </hudson.plugins.git.extensions.impl.BuildChooserSetting>
111 <hudson.plugins.git.extensions.impl.SubmoduleOption>
112 <disableSubmodules>false</disableSubmodules>
113 <recursiveSubmodules>true</recursiveSubmodules>
114 <trackingSubmodules>false</trackingSubmodules>
115 <parentCredentials>false</parentCredentials>
117 <timeout>10</timeout>
118 </hudson.plugins.git.extensions.impl.SubmoduleOption>
119 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
122 <triggers class="vector">
123 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
126 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
132 <triggerPhrase>^recheck$</triggerPhrase>
134 <onlyTriggerPhrase>false</onlyTriggerPhrase>
135 <useGitHubHooks>true</useGitHubHooks>
136 <permitAll>true</permitAll>
137 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
139 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
140 <commitStatusContext>Node Verify</commitStatusContext>
141 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
143 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
148 # SPDX-License-Identifier: EPL-1.0
149 ##############################################################################
150 # Copyright (c) 2017 The Linux Foundation and others.
152 # All rights reserved. This program and the accompanying materials
153 # are made available under the terms of the Eclipse Public License v1.0
154 # which accompanies this distribution, and is available at
155 # http://www.eclipse.org/legal/epl-v10.html
156 ##############################################################################
157 echo "---> node-install.sh"
159 # Ensure we fail the job if any steps fail.
160 # DO NOT set -u as virtualenv's activate script has unbound variables
163 virtualenv --quiet "/tmp/v/python"
164 # shellcheck source=/tmp/v/node/bin/activate disable=SC1091
165 source "/tmp/v/python/bin/activate"
166 pip install --quiet --upgrade pip
167 pip install --quiet --upgrade pipdeptree
168 pip install --quiet --upgrade nodeenv
170 echo "----> Pip Dependency Tree"
174 # SPDX-License-Identifier: EPL-1.0
175 ##############################################################################
176 # Copyright (c) 2017 The Linux Foundation and others.
178 # All rights reserved. This program and the accompanying materials
179 # are made available under the terms of the Eclipse Public License v1.0
180 # which accompanies this distribution, and is available at
181 # http://www.eclipse.org/legal/epl-v10.html
182 ##############################################################################
183 echo "---> node-run.sh"
185 # Ensure we fail the job if any steps fail.
186 # DO NOT set -u as virtualenv's activate script has unbound variables
190 nodeenv --node="$NODE_VERSION" --prebuilt "/tmp/v/node"
191 source /tmp/v/node/bin/activate
192 cd "$WORKSPACE/$NODE_DIR"
196 </hudson.tasks.Shell>
199 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
203 # SPDX-License-Identifier: EPL-1.0
204 ##############################################################################
205 # Copyright (c) 2017 The Linux Foundation and others.
207 # All rights reserved. This program and the accompanying materials
208 # are made available under the terms of the Eclipse Public License v1.0
209 # which accompanies this distribution, and is available at
210 # http://www.eclipse.org/legal/epl-v10.html
211 ##############################################################################
212 echo "---> sysstat.sh"
213 set +e # DON'T fail build if script fails.
215 OS=$(facter operatingsystem)
216 case "$OS" in
218 SYSSTAT_PATH="/var/log/sysstat"
220 # Dont run the script when systat is not enabled by default
221 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
226 SYSSTAT_PATH="/var/log/sa"
234 SAR_DIR="$WORKSPACE/archives/sar-reports"
235 mkdir -p "$SAR_DIR"
236 cp "$SYSSTAT_PATH/"* "$_"
237 # convert sar data to ascii format
238 while IFS="" read -r sarfilenum
240 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
241 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
243 # DON'T fail build if script fails.
246 </hudson.tasks.Shell>
247 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
249 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
250 <fileId>jenkins-log-archives-settings</fileId>
252 <variable>SETTINGS_FILE</variable>
253 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
255 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
258 <propertiesContent>SERVER_ID=logs</propertiesContent>
263 # SPDX-License-Identifier: EPL-1.0
264 ##############################################################################
265 # Copyright (c) 2017 The Linux Foundation and others.
267 # All rights reserved. This program and the accompanying materials
268 # are made available under the terms of the Eclipse Public License v1.0
269 # which accompanies this distribution, and is available at
270 # http://www.eclipse.org/legal/epl-v10.html
271 ##############################################################################
272 echo "---> create-netrc.sh"
274 # Ensure we fail the job if any steps fail.
277 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
278 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
279 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
280 -v x:username -o ":" -v x:password \
281 "$SETTINGS_FILE")
283 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
284 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
285 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
287 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
289 </hudson.tasks.Shell>
292 # SPDX-License-Identifier: EPL-1.0
293 ##############################################################################
294 # Copyright (c) 2017 The Linux Foundation and others.
296 # All rights reserved. This program and the accompanying materials
297 # are made available under the terms of the Eclipse Public License v1.0
298 # which accompanies this distribution, and is available at
299 # http://www.eclipse.org/legal/epl-v10.html
300 ##############################################################################
301 echo "---> lftools-install.sh"
303 # Script to install lftools via a version passed in via lf-infra-parameters
305 # Required parameters:
307 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
308 # set to a strict version number like '1.2.3' or using
309 # PEP-440 definitions.
313 # >=1.0.0,<2.0.0
315 # By default a released version of lftools should always be used.
316 # The purpose of the 2 variables below is so that lftools devs can test
317 # unreleased versions of lftools. There are 2 methods to install a dev version
320 # 1) gerrit patch: Used to test a patch that has not yet been merged.
321 # To do this set something like this:
322 # LFTOOLS_MODE=gerrit
323 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
325 # 2) git branch: Used to install an lftools version from a specific branch.
326 # To use this set the variables as follows:
328 # LFTOOLS_REFSPEC=master
330 # 3) release : The intended use case and default setting.
331 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
333 LFTOOLS_MODE=release # release | git | gerrit
334 LFTOOLS_REFSPEC=master
336 # Ensure we fail the job if any steps fail.
337 # DO NOT set -u as virtualenv's activate script has unbound variables
340 virtualenv --quiet "/tmp/v/lftools"
341 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
342 source "/tmp/v/lftools/bin/activate"
343 pip install --quiet --upgrade pip
345 case $LFTOOLS_MODE in
347 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
349 git fetch origin "$LFTOOLS_REFSPEC"
350 git checkout FETCH_HEAD
351 pip install --quiet --upgrade -r requirements.txt
352 pip install --quiet --upgrade -e .
357 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
361 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
362 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
365 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
371 # pipdeptree prints out a lot of information because lftools pulls in many
372 # dependencies. Let's only print it if we want to debug.
373 # echo "----> Pip Dependency Tree"
374 # pip install --quiet --upgrade pipdeptree
378 # SPDX-License-Identifier: EPL-1.0
379 ##############################################################################
380 # Copyright (c) 2017 The Linux Foundation and others.
382 # All rights reserved. This program and the accompanying materials
383 # are made available under the terms of the Eclipse Public License v1.0
384 # which accompanies this distribution, and is available at
385 # http://www.eclipse.org/legal/epl-v10.html
386 ##############################################################################
387 echo "---> logs-deploy.sh"
389 # Ensure we fail the job if any steps fail.
392 set -x # Trace commands for this script to make debugging easier.
394 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
395 LOGS_SERVER="${LOGS_SERVER:-None}"
397 if [ "${LOGS_SERVER}" == 'None' ]
399 set +x # Disable trace since we no longer need it
401 echo "WARNING: Logging server not set"
403 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
404 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
405 BUILD_URL="${BUILD_URL}"
407 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
408 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
410 set +x # Disable trace since we no longer need it.
412 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
415 </hudson.tasks.Shell>
418 # SPDX-License-Identifier: EPL-1.0
419 ##############################################################################
420 # Copyright (c) 2017 The Linux Foundation and others.
422 # All rights reserved. This program and the accompanying materials
423 # are made available under the terms of the Eclipse Public License v1.0
424 # which accompanies this distribution, and is available at
425 # http://www.eclipse.org/legal/epl-v10.html
426 ##############################################################################
428 # Clear log credential files
429 rm "$SETTINGS_FILE"
432 </hudson.tasks.Shell>
433 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
434 <regexp>^Build logs: .*</regexp>
435 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
437 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
438 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
439 <markBuildUnstable>false</markBuildUnstable>
440 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
441 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
443 <hudson.plugins.ws__cleanup.Pattern>
444 <pattern>**/*.jenkins-trigger</pattern>
446 </hudson.plugins.ws__cleanup.Pattern>
448 <deleteDirs>false</deleteDirs>
449 <cleanupMatrixParent>false</cleanupMatrixParent>
451 <cleanWhenSuccess>true</cleanWhenSuccess>
452 <cleanWhenUnstable>true</cleanWhenUnstable>
453 <cleanWhenFailure>true</cleanWhenFailure>
454 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
455 <cleanWhenAborted>true</cleanWhenAborted>
456 <notFailBuild>true</notFailBuild>
457 </hudson.plugins.ws__cleanup.WsCleanup>
460 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
461 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
462 <timeoutMinutes>10</timeoutMinutes>
463 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
464 <failBuild>true</failBuild>
465 <writingDescription>false</writingDescription>
466 <timeoutPercentage>0</timeoutPercentage>
467 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
468 <timeoutType>absolute</timeoutType>
469 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
470 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
471 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
472 <user>test-credential</user>
473 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
474 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
475 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
477 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
478 <fileId>npmrc</fileId>
479 <targetLocation>$HOME/.npmrc</targetLocation>
481 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
483 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>