1 <?xml version="1.0" encoding="utf-8"?>
5 <description><!-- Managed by Jenkins Job Builder --></description>
6 <keepDependencies>false</keepDependencies>
7 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
8 <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
9 <concurrentBuild>false</concurrentBuild>
10 <assignedNode>build-vm</assignedNode>
11 <canRoam>false</canRoam>
13 <jenkins.model.BuildDiscarderProperty>
14 <strategy class="hudson.tasks.LogRotator">
15 <daysToKeep>30</daysToKeep>
16 <numToKeep>-1</numToKeep>
17 <artifactDaysToKeep>-1</artifactDaysToKeep>
18 <artifactNumToKeep>0</artifactNumToKeep>
20 </jenkins.model.BuildDiscarderProperty>
21 <hudson.model.ParametersDefinitionProperty>
22 <parameterDefinitions>
23 <hudson.model.StringParameterDefinition>
25 <description>Parameter to identify a Gerrit project. This is typically the
26 project repo path as exists in Gerrit.
27 For example: ofextensions/circuitsw
29 <defaultValue>releng/ciman</defaultValue>
30 </hudson.model.StringParameterDefinition>
31 <hudson.model.StringParameterDefinition>
33 <description>Stream is often set to the same name as 'branch' but can
34 sometimes be used as a name representing a project's release code
37 <defaultValue>master</defaultValue>
38 </hudson.model.StringParameterDefinition>
39 <hudson.model.StringParameterDefinition>
40 <name>GERRIT_PROJECT</name>
41 <description>Parameter to identify Gerrit project. This is typically the
42 project repo path as exists in Gerrit.
43 For example: ofextensions/circuitsw
45 Note that Gerrit will override this parameter automatically if a
46 job is triggered by Gerrit.
48 <defaultValue>releng/ciman</defaultValue>
49 </hudson.model.StringParameterDefinition>
50 <hudson.model.StringParameterDefinition>
51 <name>GERRIT_BRANCH</name>
52 <description>Parameter to identify a Gerrit branch.
54 Note that Gerrit will override this parameter automatically if a
55 job is triggered by Gerrit.
57 <defaultValue>master</defaultValue>
58 </hudson.model.StringParameterDefinition>
59 <hudson.model.StringParameterDefinition>
60 <name>GERRIT_REFSPEC</name>
61 <description>Parameter to identify a refspec when pulling from Gerrit.
63 Note that Gerrit will override this parameter automatically if a
64 job is triggered by Gerrit.
66 <defaultValue>refs/heads/master</defaultValue>
67 </hudson.model.StringParameterDefinition>
68 <hudson.model.StringParameterDefinition>
69 <name>LFTOOLS_VERSION</name>
70 <description>Version of lftools to install. Can be a specific version like
71 '0.6.0' or a PEP-440 definition.
72 https://www.python.org/dev/peps/pep-0440/
73 For example '<1.0.0' or '>=1.0.0,<2.0.0'.
75 <defaultValue><1.0.0</defaultValue>
76 </hudson.model.StringParameterDefinition>
77 <hudson.model.StringParameterDefinition>
79 <description>Maven selector to be used by shell scripts</description>
80 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33</defaultValue>
81 </hudson.model.StringParameterDefinition>
82 <hudson.model.StringParameterDefinition>
83 <name>MAVEN_OPTS</name>
84 <description>Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
87 </hudson.model.StringParameterDefinition>
88 <hudson.model.StringParameterDefinition>
89 <name>MAVEN_PARAMS</name>
90 <description>Maven parameters to pass to the mvn command.
92 <defaultValue>-Dmerge</defaultValue>
93 </hudson.model.StringParameterDefinition>
94 <hudson.model.StringParameterDefinition>
96 <description>Maven selector to be used by shell scripts</description>
97 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn</defaultValue>
98 </hudson.model.StringParameterDefinition>
99 <hudson.model.StringParameterDefinition>
100 <name>STAGING_PROFILE_ID</name>
101 <description>Nexus staging profile ID.
103 <defaultValue>uuddlrlrba</defaultValue>
104 </hudson.model.StringParameterDefinition>
105 <hudson.model.StringParameterDefinition>
106 <name>ARCHIVE_ARTIFACTS</name>
107 <description>Artifacts to archive to the logs server.</description>
109 </hudson.model.StringParameterDefinition>
110 </parameterDefinitions>
111 </hudson.model.ParametersDefinitionProperty>
113 <scm class="hudson.plugins.git.GitSCM">
114 <configVersion>2</configVersion>
116 <hudson.plugins.git.UserRemoteConfig>
118 <refspec>$GERRIT_REFSPEC</refspec>
119 <url>$GIT_URL/$PROJECT</url>
120 <credentialsId>test-credential</credentialsId>
121 </hudson.plugins.git.UserRemoteConfig>
124 <hudson.plugins.git.BranchSpec>
125 <name>refs/heads/$GERRIT_BRANCH</name>
126 </hudson.plugins.git.BranchSpec>
129 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
130 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
131 <authorOrCommitter>false</authorOrCommitter>
132 <wipeOutWorkspace>true</wipeOutWorkspace>
133 <pruneBranches>false</pruneBranches>
134 <remotePoll>false</remotePoll>
135 <gitTool>Default</gitTool>
136 <submoduleCfg class="list"/>
141 <skipTag>true</skipTag>
143 <useShallowClone>false</useShallowClone>
144 <ignoreNotifyCommit>false</ignoreNotifyCommit>
146 <hudson.plugins.git.extensions.impl.SubmoduleOption>
147 <disableSubmodules>false</disableSubmodules>
148 <recursiveSubmodules>true</recursiveSubmodules>
149 <trackingSubmodules>false</trackingSubmodules>
151 <timeout>10</timeout>
152 </hudson.plugins.git.extensions.impl.SubmoduleOption>
153 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
156 <triggers class="vector">
157 <hudson.triggers.TimerTrigger>
158 <spec>H H * * 0</spec>
159 </hudson.triggers.TimerTrigger>
160 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
163 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
164 <compareType>ANT</compareType>
165 <pattern>releng/ciman</pattern>
167 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
168 <compareType>ANT</compareType>
169 <pattern>**/master</pattern>
170 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
173 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
174 <compareType>ANT</compareType>
175 <pattern>**</pattern>
176 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
178 <disableStrictForbiddenFileVerification>false</disableStrictForbiddenFileVerification>
179 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
182 <onSuccessful>false</onSuccessful>
183 <onFailed>false</onFailed>
184 <onUnstable>false</onUnstable>
185 <onNotBuilt>false</onNotBuilt>
187 <silentMode>false</silentMode>
188 <silentStartMode>false</silentStartMode>
189 <escapeQuotes>true</escapeQuotes>
190 <noNameAndEmailParameters>false</noNameAndEmailParameters>
191 <readableMessage>false</readableMessage>
192 <dependencyJobsNames/>
194 <dynamicTriggerConfiguration>False</dynamicTriggerConfiguration>
196 <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
198 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginChangeMergedEvent/>
199 <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
200 <commentAddedCommentContains>remerge$</commentAddedCommentContains>
201 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedContainsEvent>
204 <buildFailureMessage/>
205 <buildSuccessfulMessage/>
206 <buildUnstableMessage/>
207 <buildNotBuiltMessage/>
208 <buildUnsuccessfulFilepath/>
210 <serverName>test-server</serverName>
211 </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
215 <command>mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes</command>
216 </hudson.tasks.Shell>
218 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
219 </hudson.tasks.Shell>
221 <targets>--version</targets>
223 <mavenName>mvn33</mavenName>
224 <usePrivateRepository>false</usePrivateRepository>
225 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
226 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
227 </hudson.tasks.Maven>
229 <command>rm "$HOME/.wgetrc"</command>
230 </hudson.tasks.Shell>
231 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
233 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
234 <fileId>global-settings</fileId>
236 <variable>GLOBAL_SETTINGS_FILE</variable>
237 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
238 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
239 <fileId>gerrit-maven-project-settings</fileId>
241 <variable>SETTINGS_FILE</variable>
242 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
244 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
247 <propertiesContent>SERVER_ID=fakeproject-snapshots</propertiesContent>
252 # SPDX-License-Identifier: EPL-1.0
253 ##############################################################################
254 # Copyright (c) 2017 The Linux Foundation and others.
256 # All rights reserved. This program and the accompanying materials
257 # are made available under the terms of the Eclipse Public License v1.0
258 # which accompanies this distribution, and is available at
259 # http://www.eclipse.org/legal/epl-v10.html
260 ##############################################################################
261 echo "---> create-netrc.sh"
263 # Ensure we fail the job if any steps fail.
266 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
267 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
268 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
269 -v x:username -o ":" -v x:password \
270 "$SETTINGS_FILE")
272 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
273 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
274 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
276 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
278 </hudson.tasks.Shell>
281 <propertiesContent>NEXUS_CUT_DIRS=6
282 NEXUS_REPO=fakeproject-snapshots
288 # SPDX-License-Identifier: EPL-1.0
289 ##############################################################################
290 # Copyright (c) 2017 The Linux Foundation and others.
292 # All rights reserved. This program and the accompanying materials
293 # are made available under the terms of the Eclipse Public License v1.0
294 # which accompanies this distribution, and is available at
295 # http://www.eclipse.org/legal/epl-v10.html
296 ##############################################################################
297 echo "---> lftools-install.sh"
299 # Script to install lftools via a version passed in via lf-infra-parameters
301 # Required parameters:
303 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
304 # set to a strict version number like '1.2.3' or using
305 # PEP-440 definitions.
309 # >=1.0.0,<2.0.0
311 # By default a released version of lftools should always be used.
312 # The purpose of the 2 variables below is so that lftools devs can test
313 # unreleased versions of lftools. There are 2 methods to install a dev version
316 # 1) gerrit patch: Used to test a patch that has not yet been merged.
317 # To do this set something like this:
318 # LFTOOLS_MODE=gerrit
319 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
321 # 2) git branch: Used to install an lftools version from a specific branch.
322 # To use this set the variables as follows:
324 # LFTOOLS_REFSPEC=master
326 # 3) release : The intended use case and default setting.
327 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
329 LFTOOLS_MODE=release # release | git | gerrit
330 LFTOOLS_REFSPEC=master
332 # Ensure we fail the job if any steps fail.
333 # DO NOT set -u as virtualenv's activate script has unbound variables
336 virtualenv --quiet "/tmp/v/lftools"
337 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
338 source "/tmp/v/lftools/bin/activate"
339 pip install --quiet --upgrade pip
341 case $LFTOOLS_MODE in
343 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
345 git fetch origin "$LFTOOLS_REFSPEC"
346 git checkout FETCH_HEAD
347 pip install --quiet --upgrade -r requirements.txt
348 pip install --quiet --upgrade -e .
353 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
357 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
358 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
361 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
367 # pipdeptree prints out a lot of information because lftools pulls in many
368 # dependencies. Let's only print it if we want to debug.
369 # echo "----> Pip Dependency Tree"
370 # pip install --quiet --upgrade pipdeptree
374 # SPDX-License-Identifier: EPL-1.0
375 ##############################################################################
376 # Copyright (c) 2017 The Linux Foundation and others.
378 # All rights reserved. This program and the accompanying materials
379 # are made available under the terms of the Eclipse Public License v1.0
380 # which accompanies this distribution, and is available at
381 # http://www.eclipse.org/legal/epl-v10.html
382 ##############################################################################
384 # This file contains a list of variables that are generally useful in many
385 # scripts. It is meant to be sourced in other scripts so that the variables can
388 MAVEN_OPTIONS="$(echo --show-version \
391 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
392 -Dmaven.repo.local=/tmp/r \
393 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
394 echo "$MAVEN_OPTIONS"
397 # SPDX-License-Identifier: EPL-1.0
398 ##############################################################################
399 # Copyright (c) 2017 The Linux Foundation and others.
401 # All rights reserved. This program and the accompanying materials
402 # are made available under the terms of the Eclipse Public License v1.0
403 # which accompanies this distribution, and is available at
404 # http://www.eclipse.org/legal/epl-v10.html
405 ##############################################################################
407 # Uses wget to fetch a project's maven-metadata.xml files from a Maven repository.
409 # Ensure we fail the job if any steps fail.
412 project=$(xmlstarlet sel \
413 -N "x=http://maven.apache.org/POM/4.0.0" -t \
414 --if "/x:project/x:groupId" \
415 -v "/x:project/x:groupId" \
416 --elif "/x:project/x:parent/x:groupId" \
417 -v "/x:project/x:parent/x:groupId" \
418 --else -o "" pom.xml)
419 project_path="${project//.//}"
421 mkdir -p "$WORKSPACE/m2repo/$project_path"
422 pushd "$WORKSPACE/m2repo/$project_path"
423 # Temporarily disable failing for wget
424 # If 404 happens we don't care because it might be a new project.
426 wget -nv --recursive \
427 --accept maven-metadata.xml \
428 -R "index.html*" \
429 --execute robots=off \
431 --no-host-directories \
432 --cut-dirs="$NEXUS_CUT_DIRS" \
433 "$NEXUS_URL/content/repositories/$NEXUS_REPO/$project_path/"
437 # Backup metadata - Used later to find metadata files that have not been modified
438 mkdir -p "$WORKSPACE/m2repo-backup"
439 cp -a "$WORKSPACE/m2repo/"* "$WORKSPACE/m2repo-backup"
442 # SPDX-License-Identifier: EPL-1.0
443 ##############################################################################
444 # Copyright (c) 2017 The Linux Foundation and others.
446 # All rights reserved. This program and the accompanying materials
447 # are made available under the terms of the Eclipse Public License v1.0
448 # which accompanies this distribution, and is available at
449 # http://www.eclipse.org/legal/epl-v10.html
450 ##############################################################################
452 # This script builds a Maven project and deploys it into a staging repo which
453 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
455 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
456 # Ensure we fail the job if any steps fail.
462 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
463 # shellcheck disable=SC2086
465 --global-settings "$GLOBAL_SETTINGS_FILE" \
466 --settings "$SETTINGS_FILE" \
467 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
468 $MAVEN_OPTIONS $MAVEN_PARAMS
471 # SPDX-License-Identifier: EPL-1.0
472 ##############################################################################
473 # Copyright (c) 2017 The Linux Foundation and others.
475 # All rights reserved. This program and the accompanying materials
476 # are made available under the terms of the Eclipse Public License v1.0
477 # which accompanies this distribution, and is available at
478 # http://www.eclipse.org/legal/epl-v10.html
479 ##############################################################################
480 # Upload the snapshot files to a snapshot repo.
482 # Requires the existance of $WORKSPACE/m2repo and $WORKSPACE/m2repo-backup to
483 # compare if maven metadata files have changed. Unchanged files are then
484 # removed from $WORKSPACE/m2repo before uploading to the snapshot repo.
486 # Ensure we fail the job if any steps fail.
489 m2repo_dir="$WORKSPACE/m2repo"
490 nexus_repo_url="$NEXUS_URL/content/repositories/$NEXUS_REPO"
492 # Remove metadata files that were not updated.
493 set +e # Temporarily disable to run diff command.
494 IFS=" " read -r -a metadata_files <<< "$(diff -s -r "$m2repo_dir" "$WORKSPACE/m2repo-backup" \
495 | grep 'Files .* and .* are identical' \
496 | awk '{print $2}')"
499 set +u # $metadata_files could be unbound if project is new.
500 if [ -n "${metadata_files[*]}" ]; then
501 for i in "${metadata_files[@]}"; do
507 find "$m2repo_dir" -type d -empty -delete
509 lftools deploy nexus -s "$nexus_repo_url" "$m2repo_dir"
511 </hudson.tasks.Shell>
514 set +e # DO NOT cause build failure if any of the rm calls fail.
516 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
518 # In some cases we use the lf-provide-maven-settings macro to produce
519 # a "$HOME/.netrc" file containing credentials. Remove that file here
521 rm "$HOME/.netrc"
523 # DO NOT fail build if any of the above lines fail.
526 </hudson.tasks.Shell>
529 <hudson.plugins.findbugs.FindBugsPublisher plugin="findbugs">
530 <isRankActivated>false</isRankActivated>
535 <thresholdLimit>low</thresholdLimit>
536 <pluginName>[FINDBUGS] </pluginName>
538 <canRunOnFailed>false</canRunOnFailed>
539 <useStableBuildAsReference>false</useStableBuildAsReference>
540 <usePreviousBuildAsReference>false</usePreviousBuildAsReference>
541 <useDeltaValues>false</useDeltaValues>
545 <unstableTotalNormal/>
552 <shouldDetectModules>false</shouldDetectModules>
553 <dontComputeNew>true</dontComputeNew>
554 <doNotResolveRelativePaths>false</doNotResolveRelativePaths>
556 </hudson.plugins.findbugs.FindBugsPublisher>
557 <hudson.plugins.jacoco.JacocoPublisher>
558 <execPattern>**/**.exec</execPattern>
559 <classPattern>**/classes</classPattern>
560 <sourcePattern>**/src/main/java</sourcePattern>
563 <exclusionPattern>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</exclusionPattern>
564 <maximumBranchCoverage>10</maximumBranchCoverage>
565 <minimumBranchCoverage>20</minimumBranchCoverage>
566 <maximumMethodCoverage>50</maximumMethodCoverage>
567 <minimumMethodCoverage>40</minimumMethodCoverage>
568 </hudson.plugins.jacoco.JacocoPublisher>
569 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
573 # SPDX-License-Identifier: EPL-1.0
574 ##############################################################################
575 # Copyright (c) 2017 The Linux Foundation and others.
577 # All rights reserved. This program and the accompanying materials
578 # are made available under the terms of the Eclipse Public License v1.0
579 # which accompanies this distribution, and is available at
580 # http://www.eclipse.org/legal/epl-v10.html
581 ##############################################################################
582 echo "---> sysstat.sh"
583 set +e # DON'T fail build if script fails.
585 OS=$(facter operatingsystem)
586 case "$OS" in
588 SYSSTAT_PATH="/var/log/sysstat"
590 # Dont run the script when systat is not enabled by default
591 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
596 SYSSTAT_PATH="/var/log/sa"
604 SAR_DIR="$WORKSPACE/archives/sar-reports"
605 mkdir -p "$SAR_DIR"
606 cp "$SYSSTAT_PATH/"* "$_"
607 # convert sar data to ascii format
608 while IFS="" read -r sarfilenum
610 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
611 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
613 # DON'T fail build if script fails.
616 </hudson.tasks.Shell>
617 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
619 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
620 <fileId>jenkins-log-archives-settings</fileId>
622 <variable>SETTINGS_FILE</variable>
623 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
625 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
628 <propertiesContent>SERVER_ID=logs</propertiesContent>
633 # SPDX-License-Identifier: EPL-1.0
634 ##############################################################################
635 # Copyright (c) 2017 The Linux Foundation and others.
637 # All rights reserved. This program and the accompanying materials
638 # are made available under the terms of the Eclipse Public License v1.0
639 # which accompanies this distribution, and is available at
640 # http://www.eclipse.org/legal/epl-v10.html
641 ##############################################################################
642 echo "---> create-netrc.sh"
644 # Ensure we fail the job if any steps fail.
647 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
648 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
649 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
650 -v x:username -o ":" -v x:password \
651 "$SETTINGS_FILE")
653 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
654 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
655 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
657 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
659 </hudson.tasks.Shell>
662 # SPDX-License-Identifier: EPL-1.0
663 ##############################################################################
664 # Copyright (c) 2017 The Linux Foundation and others.
666 # All rights reserved. This program and the accompanying materials
667 # are made available under the terms of the Eclipse Public License v1.0
668 # which accompanies this distribution, and is available at
669 # http://www.eclipse.org/legal/epl-v10.html
670 ##############################################################################
671 echo "---> lftools-install.sh"
673 # Script to install lftools via a version passed in via lf-infra-parameters
675 # Required parameters:
677 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
678 # set to a strict version number like '1.2.3' or using
679 # PEP-440 definitions.
683 # >=1.0.0,<2.0.0
685 # By default a released version of lftools should always be used.
686 # The purpose of the 2 variables below is so that lftools devs can test
687 # unreleased versions of lftools. There are 2 methods to install a dev version
690 # 1) gerrit patch: Used to test a patch that has not yet been merged.
691 # To do this set something like this:
692 # LFTOOLS_MODE=gerrit
693 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
695 # 2) git branch: Used to install an lftools version from a specific branch.
696 # To use this set the variables as follows:
698 # LFTOOLS_REFSPEC=master
700 # 3) release : The intended use case and default setting.
701 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
703 LFTOOLS_MODE=release # release | git | gerrit
704 LFTOOLS_REFSPEC=master
706 # Ensure we fail the job if any steps fail.
707 # DO NOT set -u as virtualenv's activate script has unbound variables
710 virtualenv --quiet "/tmp/v/lftools"
711 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
712 source "/tmp/v/lftools/bin/activate"
713 pip install --quiet --upgrade pip
715 case $LFTOOLS_MODE in
717 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
719 git fetch origin "$LFTOOLS_REFSPEC"
720 git checkout FETCH_HEAD
721 pip install --quiet --upgrade -r requirements.txt
722 pip install --quiet --upgrade -e .
727 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
731 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
732 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
735 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
741 # pipdeptree prints out a lot of information because lftools pulls in many
742 # dependencies. Let's only print it if we want to debug.
743 # echo "----> Pip Dependency Tree"
744 # pip install --quiet --upgrade pipdeptree
748 # SPDX-License-Identifier: EPL-1.0
749 ##############################################################################
750 # Copyright (c) 2017 The Linux Foundation and others.
752 # All rights reserved. This program and the accompanying materials
753 # are made available under the terms of the Eclipse Public License v1.0
754 # which accompanies this distribution, and is available at
755 # http://www.eclipse.org/legal/epl-v10.html
756 ##############################################################################
757 echo "---> logs-deploy.sh"
759 # Ensure we fail the job if any steps fail.
762 set -x # Trace commands for this script to make debugging easier.
764 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
765 LOGS_SERVER="${LOGS_SERVER:-None}"
767 if [ "${LOGS_SERVER}" == 'None' ]
769 set +x # Disable trace since we no longer need it
771 echo "WARNING: Logging server not set"
773 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
774 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
775 BUILD_URL="${BUILD_URL}"
777 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
778 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
780 set +x # Disable trace since we no longer need it.
782 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
785 </hudson.tasks.Shell>
788 # SPDX-License-Identifier: EPL-1.0
789 ##############################################################################
790 # Copyright (c) 2017 The Linux Foundation and others.
792 # All rights reserved. This program and the accompanying materials
793 # are made available under the terms of the Eclipse Public License v1.0
794 # which accompanies this distribution, and is available at
795 # http://www.eclipse.org/legal/epl-v10.html
796 ##############################################################################
798 # Clear log credential files
799 rm "$SETTINGS_FILE"
802 </hudson.tasks.Shell>
803 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
804 <regexp>^Build logs: .*</regexp>
805 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
807 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
808 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
809 <markBuildUnstable>false</markBuildUnstable>
810 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
811 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
813 <hudson.plugins.ws__cleanup.Pattern>
814 <pattern>**/*.jenkins-trigger</pattern>
816 </hudson.plugins.ws__cleanup.Pattern>
818 <deleteDirs>false</deleteDirs>
819 <cleanupMatrixParent>false</cleanupMatrixParent>
821 <cleanWhenSuccess>true</cleanWhenSuccess>
822 <cleanWhenUnstable>true</cleanWhenUnstable>
823 <cleanWhenFailure>true</cleanWhenFailure>
824 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
825 <cleanWhenAborted>true</cleanWhenAborted>
826 <notFailBuild>true</notFailBuild>
827 </hudson.plugins.ws__cleanup.WsCleanup>
828 <hudson.plugins.parameterizedtrigger.BuildTrigger>
830 </hudson.plugins.parameterizedtrigger.BuildTrigger>
833 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
834 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
835 <timeoutMinutes>30</timeoutMinutes>
836 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
837 <failBuild>true</failBuild>
838 <writingDescription>false</writingDescription>
839 <timeoutPercentage>0</timeoutPercentage>
840 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
841 <timeoutType>absolute</timeoutType>
842 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
843 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
844 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
845 <user>test-credential</user>
846 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
847 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
848 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
850 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
851 <fileId>npmrc</fileId>
852 <targetLocation>$HOME/.npmrc</targetLocation>
854 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
856 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>