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 <com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github">
14 <projectUrl>$GIT_URL/$PROJECT/example-org/releng/ciman</projectUrl>
16 </com.coravy.hudson.plugins.github.GithubProjectProperty>
17 <hudson.model.ParametersDefinitionProperty>
18 <parameterDefinitions>
19 <hudson.model.StringParameterDefinition>
21 <description>Parameter to identify a Gerrit project. This is typically the
22 project repo path as exists in Gerrit.
23 For example: ofextensions/circuitsw
25 <defaultValue>releng/ciman</defaultValue>
26 </hudson.model.StringParameterDefinition>
27 <hudson.model.StringParameterDefinition>
29 <description>Stream is often set to the same name as 'branch' but can
30 sometimes be used as a name representing a project's release code
33 <defaultValue>master</defaultValue>
34 </hudson.model.StringParameterDefinition>
35 <hudson.model.StringParameterDefinition>
36 <name>GERRIT_PROJECT</name>
37 <description>Parameter to identify Gerrit project. This is typically the
38 project repo path as exists in Gerrit.
39 For example: ofextensions/circuitsw
41 Note that Gerrit will override this parameter automatically if a
42 job is triggered by Gerrit.
44 <defaultValue>releng/ciman</defaultValue>
45 </hudson.model.StringParameterDefinition>
46 <hudson.model.StringParameterDefinition>
47 <name>GERRIT_BRANCH</name>
48 <description>Parameter to identify a Gerrit branch.
50 Note that Gerrit will override this parameter automatically if a
51 job is triggered by Gerrit.
53 <defaultValue>master</defaultValue>
54 </hudson.model.StringParameterDefinition>
55 <hudson.model.StringParameterDefinition>
56 <name>GERRIT_REFSPEC</name>
57 <description>Parameter to identify a refspec when pulling from Gerrit.
59 Note that Gerrit will override this parameter automatically if a
60 job is triggered by Gerrit.
62 <defaultValue>refs/heads/master</defaultValue>
63 </hudson.model.StringParameterDefinition>
64 <hudson.model.StringParameterDefinition>
65 <name>LFTOOLS_VERSION</name>
66 <description>Version of lftools to install. Can be a specific version like
67 '0.6.0' or a PEP-440 definition.
68 https://www.python.org/dev/peps/pep-0440/
69 For example '<1.0.0' or '>=1.0.0,<2.0.0'.
71 <defaultValue><1.0.0</defaultValue>
72 </hudson.model.StringParameterDefinition>
73 <hudson.model.StringParameterDefinition>
75 <description>Maven selector to be used by shell scripts</description>
76 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33</defaultValue>
77 </hudson.model.StringParameterDefinition>
78 <hudson.model.StringParameterDefinition>
79 <name>MAVEN_OPTS</name>
80 <description>Maven Java opts. Example: -Xmx1024m -XX:MaxPermSize=256m
83 </hudson.model.StringParameterDefinition>
84 <hudson.model.StringParameterDefinition>
85 <name>MAVEN_PARAMS</name>
86 <description>Maven parameters to pass to the mvn command.
88 <defaultValue>-Dmerge</defaultValue>
89 </hudson.model.StringParameterDefinition>
90 <hudson.model.StringParameterDefinition>
92 <description>Maven selector to be used by shell scripts</description>
93 <defaultValue>/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn</defaultValue>
94 </hudson.model.StringParameterDefinition>
95 <hudson.model.StringParameterDefinition>
96 <name>STAGING_PROFILE_ID</name>
97 <description>Nexus staging profile ID.
99 <defaultValue>uuddlrlrba</defaultValue>
100 </hudson.model.StringParameterDefinition>
101 <hudson.model.StringParameterDefinition>
102 <name>ARCHIVE_ARTIFACTS</name>
103 <description>Artifacts to archive to the logs server.</description>
105 </hudson.model.StringParameterDefinition>
106 </parameterDefinitions>
107 </hudson.model.ParametersDefinitionProperty>
109 <scm class="hudson.plugins.git.GitSCM">
110 <configVersion>2</configVersion>
112 <hudson.plugins.git.UserRemoteConfig>
114 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
115 <url>git@github.com:example-org/releng/ciman</url>
116 <credentialsId>test-credential</credentialsId>
117 </hudson.plugins.git.UserRemoteConfig>
120 <hudson.plugins.git.BranchSpec>
122 </hudson.plugins.git.BranchSpec>
124 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
125 <remotePoll>false</remotePoll>
126 <gitTool>Default</gitTool>
127 <submoduleCfg class="list"/>
132 <hudson.plugins.git.extensions.impl.BuildChooserSetting>
133 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
134 </hudson.plugins.git.extensions.impl.BuildChooserSetting>
135 <hudson.plugins.git.extensions.impl.SubmoduleOption>
136 <disableSubmodules>false</disableSubmodules>
137 <recursiveSubmodules>true</recursiveSubmodules>
138 <trackingSubmodules>false</trackingSubmodules>
139 <parentCredentials>false</parentCredentials>
141 <timeout>10</timeout>
142 </hudson.plugins.git.extensions.impl.SubmoduleOption>
143 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
146 <triggers class="vector">
147 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
150 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
156 <triggerPhrase>^remerge$</triggerPhrase>
158 <onlyTriggerPhrase>false</onlyTriggerPhrase>
159 <useGitHubHooks>true</useGitHubHooks>
160 <permitAll>true</permitAll>
161 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
163 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
164 <commitStatusContext>Maven Merge</commitStatusContext>
165 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
167 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
171 <command>mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes</command>
172 </hudson.tasks.Shell>
174 <command>echo "quiet=on" > "$HOME/.wgetrc"</command>
175 </hudson.tasks.Shell>
177 <targets>--version</targets>
179 <mavenName>mvn33</mavenName>
180 <usePrivateRepository>false</usePrivateRepository>
181 <settings class="jenkins.mvn.DefaultSettingsProvider"/>
182 <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
183 </hudson.tasks.Maven>
185 <command>rm "$HOME/.wgetrc"</command>
186 </hudson.tasks.Shell>
187 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
189 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
190 <fileId>global-settings</fileId>
192 <variable>GLOBAL_SETTINGS_FILE</variable>
193 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
194 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
195 <fileId>aproject-settings</fileId>
197 <variable>SETTINGS_FILE</variable>
198 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
200 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
203 <propertiesContent>SERVER_ID=fakeproject-snapshots</propertiesContent>
208 # SPDX-License-Identifier: EPL-1.0
209 ##############################################################################
210 # Copyright (c) 2017 The Linux Foundation and others.
212 # All rights reserved. This program and the accompanying materials
213 # are made available under the terms of the Eclipse Public License v1.0
214 # which accompanies this distribution, and is available at
215 # http://www.eclipse.org/legal/epl-v10.html
216 ##############################################################################
217 echo "---> create-netrc.sh"
219 # Ensure we fail the job if any steps fail.
222 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
223 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
224 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
225 -v x:username -o ":" -v x:password \
226 "$SETTINGS_FILE")
228 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
229 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
230 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
232 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
234 </hudson.tasks.Shell>
237 <propertiesContent>NEXUS_CUT_DIRS=6
238 NEXUS_REPO=fakeproject-snapshots
244 # SPDX-License-Identifier: EPL-1.0
245 ##############################################################################
246 # Copyright (c) 2017 The Linux Foundation and others.
248 # All rights reserved. This program and the accompanying materials
249 # are made available under the terms of the Eclipse Public License v1.0
250 # which accompanies this distribution, and is available at
251 # http://www.eclipse.org/legal/epl-v10.html
252 ##############################################################################
253 echo "---> lftools-install.sh"
255 # Script to install lftools via a version passed in via lf-infra-parameters
257 # Required parameters:
259 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
260 # set to a strict version number like '1.2.3' or using
261 # PEP-440 definitions.
265 # >=1.0.0,<2.0.0
267 # By default a released version of lftools should always be used.
268 # The purpose of the 2 variables below is so that lftools devs can test
269 # unreleased versions of lftools. There are 2 methods to install a dev version
272 # 1) gerrit patch: Used to test a patch that has not yet been merged.
273 # To do this set something like this:
274 # LFTOOLS_MODE=gerrit
275 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
277 # 2) git branch: Used to install an lftools version from a specific branch.
278 # To use this set the variables as follows:
280 # LFTOOLS_REFSPEC=master
282 # 3) release : The intended use case and default setting.
283 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
285 LFTOOLS_MODE=release # release | git | gerrit
286 LFTOOLS_REFSPEC=master
288 # Ensure we fail the job if any steps fail.
289 # DO NOT set -u as virtualenv's activate script has unbound variables
292 virtualenv --quiet "/tmp/v/lftools"
293 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
294 source "/tmp/v/lftools/bin/activate"
295 pip install --quiet --upgrade pip
297 case $LFTOOLS_MODE in
299 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
301 git fetch origin "$LFTOOLS_REFSPEC"
302 git checkout FETCH_HEAD
303 pip install --quiet --upgrade -r requirements.txt
304 pip install --quiet --upgrade -e .
309 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
313 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
314 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
317 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
323 # pipdeptree prints out a lot of information because lftools pulls in many
324 # dependencies. Let's only print it if we want to debug.
325 # echo "----> Pip Dependency Tree"
326 # pip install --quiet --upgrade pipdeptree
330 # SPDX-License-Identifier: EPL-1.0
331 ##############################################################################
332 # Copyright (c) 2017 The Linux Foundation and others.
334 # All rights reserved. This program and the accompanying materials
335 # are made available under the terms of the Eclipse Public License v1.0
336 # which accompanies this distribution, and is available at
337 # http://www.eclipse.org/legal/epl-v10.html
338 ##############################################################################
340 # This file contains a list of variables that are generally useful in many
341 # scripts. It is meant to be sourced in other scripts so that the variables can
344 MAVEN_OPTIONS="$(echo --show-version \
347 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
348 -Dmaven.repo.local=/tmp/r \
349 -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)"
350 echo "$MAVEN_OPTIONS"
353 # SPDX-License-Identifier: EPL-1.0
354 ##############################################################################
355 # Copyright (c) 2017 The Linux Foundation and others.
357 # All rights reserved. This program and the accompanying materials
358 # are made available under the terms of the Eclipse Public License v1.0
359 # which accompanies this distribution, and is available at
360 # http://www.eclipse.org/legal/epl-v10.html
361 ##############################################################################
363 # Uses wget to fetch a project's maven-metadata.xml files from a Maven repository.
365 # Ensure we fail the job if any steps fail.
368 project=$(xmlstarlet sel \
369 -N "x=http://maven.apache.org/POM/4.0.0" -t \
370 --if "/x:project/x:groupId" \
371 -v "/x:project/x:groupId" \
372 --elif "/x:project/x:parent/x:groupId" \
373 -v "/x:project/x:parent/x:groupId" \
374 --else -o "" pom.xml)
375 project_path="${project//.//}"
377 mkdir -p "$WORKSPACE/m2repo/$project_path"
378 pushd "$WORKSPACE/m2repo/$project_path"
379 # Temporarily disable failing for wget
380 # If 404 happens we don't care because it might be a new project.
382 wget -nv --recursive \
383 --accept maven-metadata.xml \
384 -R "index.html*" \
385 --execute robots=off \
387 --no-host-directories \
388 --cut-dirs="$NEXUS_CUT_DIRS" \
389 "$NEXUS_URL/content/repositories/$NEXUS_REPO/$project_path/"
393 # Backup metadata - Used later to find metadata files that have not been modified
394 mkdir -p "$WORKSPACE/m2repo-backup"
395 cp -a "$WORKSPACE/m2repo/"* "$WORKSPACE/m2repo-backup"
398 # SPDX-License-Identifier: EPL-1.0
399 ##############################################################################
400 # Copyright (c) 2017 The Linux Foundation and others.
402 # All rights reserved. This program and the accompanying materials
403 # are made available under the terms of the Eclipse Public License v1.0
404 # which accompanies this distribution, and is available at
405 # http://www.eclipse.org/legal/epl-v10.html
406 ##############################################################################
408 # This script builds a Maven project and deploys it into a staging repo which
409 # can be used to deploy elsewhere later eg. Nexus staging / snapshot repos.
411 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
412 # Ensure we fail the job if any steps fail.
418 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
419 # shellcheck disable=SC2086
421 --global-settings "$GLOBAL_SETTINGS_FILE" \
422 --settings "$SETTINGS_FILE" \
423 -DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo \
424 $MAVEN_OPTIONS $MAVEN_PARAMS
427 # SPDX-License-Identifier: EPL-1.0
428 ##############################################################################
429 # Copyright (c) 2017 The Linux Foundation and others.
431 # All rights reserved. This program and the accompanying materials
432 # are made available under the terms of the Eclipse Public License v1.0
433 # which accompanies this distribution, and is available at
434 # http://www.eclipse.org/legal/epl-v10.html
435 ##############################################################################
436 # Upload the snapshot files to a snapshot repo.
438 # Requires the existance of $WORKSPACE/m2repo and $WORKSPACE/m2repo-backup to
439 # compare if maven metadata files have changed. Unchanged files are then
440 # removed from $WORKSPACE/m2repo before uploading to the snapshot repo.
442 # Ensure we fail the job if any steps fail.
445 m2repo_dir="$WORKSPACE/m2repo"
446 nexus_repo_url="$NEXUS_URL/content/repositories/$NEXUS_REPO"
448 # Remove metadata files that were not updated.
449 set +e # Temporarily disable to run diff command.
450 IFS=" " read -r -a metadata_files <<< "$(diff -s -r "$m2repo_dir" "$WORKSPACE/m2repo-backup" \
451 | grep 'Files .* and .* are identical' \
452 | awk '{print $2}')"
455 set +u # $metadata_files could be unbound if project is new.
456 if [ -n "${metadata_files[*]}" ]; then
457 for i in "${metadata_files[@]}"; do
463 find "$m2repo_dir" -type d -empty -delete
465 lftools deploy nexus -s "$nexus_repo_url" "$m2repo_dir"
467 </hudson.tasks.Shell>
470 set +e # DO NOT cause build failure if any of the rm calls fail.
472 rm "$GLOBAL_SETTINGS_FILE" "$SETTINGS_FILE"
474 # In some cases we use the lf-provide-maven-settings macro to produce
475 # a "$HOME/.netrc" file containing credentials. Remove that file here
477 rm "$HOME/.netrc"
479 # DO NOT fail build if any of the above lines fail.
482 </hudson.tasks.Shell>
485 <hudson.plugins.findbugs.FindBugsPublisher plugin="findbugs">
486 <isRankActivated>false</isRankActivated>
491 <thresholdLimit>low</thresholdLimit>
492 <pluginName>[FINDBUGS] </pluginName>
494 <canRunOnFailed>false</canRunOnFailed>
495 <useStableBuildAsReference>false</useStableBuildAsReference>
496 <usePreviousBuildAsReference>false</usePreviousBuildAsReference>
497 <useDeltaValues>false</useDeltaValues>
501 <unstableTotalNormal/>
508 <shouldDetectModules>false</shouldDetectModules>
509 <dontComputeNew>true</dontComputeNew>
510 <doNotResolveRelativePaths>false</doNotResolveRelativePaths>
512 </hudson.plugins.findbugs.FindBugsPublisher>
513 <hudson.plugins.jacoco.JacocoPublisher plugin="jacoco">
514 <execPattern>**/**.exec</execPattern>
515 <classPattern>**/classes</classPattern>
516 <sourcePattern>**/src/main/java</sourcePattern>
517 <changeBuildStatus>false</changeBuildStatus>
519 <exclusionPattern>**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**</exclusionPattern>
520 <maximumBranchCoverage>10</maximumBranchCoverage>
521 <minimumBranchCoverage>20</minimumBranchCoverage>
522 <maximumMethodCoverage>50</maximumMethodCoverage>
523 <minimumMethodCoverage>40</minimumMethodCoverage>
524 </hudson.plugins.jacoco.JacocoPublisher>
525 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
529 # SPDX-License-Identifier: EPL-1.0
530 ##############################################################################
531 # Copyright (c) 2017 The Linux Foundation and others.
533 # All rights reserved. This program and the accompanying materials
534 # are made available under the terms of the Eclipse Public License v1.0
535 # which accompanies this distribution, and is available at
536 # http://www.eclipse.org/legal/epl-v10.html
537 ##############################################################################
538 echo "---> sysstat.sh"
539 set +e # DON'T fail build if script fails.
541 OS=$(facter operatingsystem)
542 case "$OS" in
544 SYSSTAT_PATH="/var/log/sysstat"
546 # Dont run the script when systat is not enabled by default
547 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
552 SYSSTAT_PATH="/var/log/sa"
560 SAR_DIR="$WORKSPACE/archives/sar-reports"
561 mkdir -p "$SAR_DIR"
562 cp "$SYSSTAT_PATH/"* "$_"
563 # convert sar data to ascii format
564 while IFS="" read -r sarfilenum
566 [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
567 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
569 # DON'T fail build if script fails.
572 </hudson.tasks.Shell>
573 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
575 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
576 <fileId>jenkins-log-archives-settings</fileId>
578 <variable>SETTINGS_FILE</variable>
579 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
581 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
584 <propertiesContent>SERVER_ID=logs</propertiesContent>
589 # SPDX-License-Identifier: EPL-1.0
590 ##############################################################################
591 # Copyright (c) 2017 The Linux Foundation and others.
593 # All rights reserved. This program and the accompanying materials
594 # are made available under the terms of the Eclipse Public License v1.0
595 # which accompanies this distribution, and is available at
596 # http://www.eclipse.org/legal/epl-v10.html
597 ##############################################################################
598 echo "---> create-netrc.sh"
600 # Ensure we fail the job if any steps fail.
603 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
604 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
605 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
606 -v x:username -o ":" -v x:password \
607 "$SETTINGS_FILE")
609 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
610 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
611 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
613 echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
615 </hudson.tasks.Shell>
618 # SPDX-License-Identifier: EPL-1.0
619 ##############################################################################
620 # Copyright (c) 2017 The Linux Foundation and others.
622 # All rights reserved. This program and the accompanying materials
623 # are made available under the terms of the Eclipse Public License v1.0
624 # which accompanies this distribution, and is available at
625 # http://www.eclipse.org/legal/epl-v10.html
626 ##############################################################################
627 echo "---> lftools-install.sh"
629 # Script to install lftools via a version passed in via lf-infra-parameters
631 # Required parameters:
633 # LFTOOLS_VERSION: Passed in via lf-infra-parameters configuration. Can be
634 # set to a strict version number like '1.2.3' or using
635 # PEP-440 definitions.
639 # >=1.0.0,<2.0.0
641 # By default a released version of lftools should always be used.
642 # The purpose of the 2 variables below is so that lftools devs can test
643 # unreleased versions of lftools. There are 2 methods to install a dev version
646 # 1) gerrit patch: Used to test a patch that has not yet been merged.
647 # To do this set something like this:
648 # LFTOOLS_MODE=gerrit
649 # LFTOOLS_REFSPEC=refs/changes/96/5296/7
651 # 2) git branch: Used to install an lftools version from a specific branch.
652 # To use this set the variables as follows:
654 # LFTOOLS_REFSPEC=master
656 # 3) release : The intended use case and default setting.
657 # Set LFTOOLS_MODE=release, in this case LFTOOLS_REFSPEC is unused.
659 LFTOOLS_MODE=release # release | git | gerrit
660 LFTOOLS_REFSPEC=master
662 # Ensure we fail the job if any steps fail.
663 # DO NOT set -u as virtualenv's activate script has unbound variables
666 virtualenv --quiet "/tmp/v/lftools"
667 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
668 source "/tmp/v/lftools/bin/activate"
669 pip install --quiet --upgrade pip
671 case $LFTOOLS_MODE in
673 git clone https://gerrit.linuxfoundation.org/infra/releng/lftools.git /tmp/lftools
675 git fetch origin "$LFTOOLS_REFSPEC"
676 git checkout FETCH_HEAD
677 pip install --quiet --upgrade -r requirements.txt
678 pip install --quiet --upgrade -e .
683 pip install --quiet --upgrade git+https://gerrit.linuxfoundation.org/infra/releng/lftools.git@"$BRANCH"
687 if [[ $LFTOOLS_VERSION =~ ^[0-9] ]]; then
688 LFTOOLS_VERSION="==$LFTOOLS_VERSION"
691 pip install --quiet --upgrade "lftools${LFTOOLS_VERSION}"
697 # pipdeptree prints out a lot of information because lftools pulls in many
698 # dependencies. Let's only print it if we want to debug.
699 # echo "----> Pip Dependency Tree"
700 # pip install --quiet --upgrade pipdeptree
704 # SPDX-License-Identifier: EPL-1.0
705 ##############################################################################
706 # Copyright (c) 2017 The Linux Foundation and others.
708 # All rights reserved. This program and the accompanying materials
709 # are made available under the terms of the Eclipse Public License v1.0
710 # which accompanies this distribution, and is available at
711 # http://www.eclipse.org/legal/epl-v10.html
712 ##############################################################################
713 echo "---> logs-deploy.sh"
715 # Ensure we fail the job if any steps fail.
718 set -x # Trace commands for this script to make debugging easier.
720 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
721 LOGS_SERVER="${LOGS_SERVER:-None}"
723 if [ "${LOGS_SERVER}" == 'None' ]
725 set +x # Disable trace since we no longer need it
727 echo "WARNING: Logging server not set"
729 NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
730 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
731 BUILD_URL="${BUILD_URL}"
733 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
734 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
736 set +x # Disable trace since we no longer need it.
738 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
741 </hudson.tasks.Shell>
744 # SPDX-License-Identifier: EPL-1.0
745 ##############################################################################
746 # Copyright (c) 2017 The Linux Foundation and others.
748 # All rights reserved. This program and the accompanying materials
749 # are made available under the terms of the Eclipse Public License v1.0
750 # which accompanies this distribution, and is available at
751 # http://www.eclipse.org/legal/epl-v10.html
752 ##############################################################################
754 # Clear log credential files
755 rm "$SETTINGS_FILE"
758 </hudson.tasks.Shell>
759 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
760 <regexp>^Build logs: .*</regexp>
761 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
763 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
764 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
765 <markBuildUnstable>false</markBuildUnstable>
766 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
767 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
769 <hudson.plugins.ws__cleanup.Pattern>
770 <pattern>**/*.jenkins-trigger</pattern>
772 </hudson.plugins.ws__cleanup.Pattern>
774 <deleteDirs>false</deleteDirs>
775 <cleanupMatrixParent>false</cleanupMatrixParent>
777 <cleanWhenSuccess>true</cleanWhenSuccess>
778 <cleanWhenUnstable>true</cleanWhenUnstable>
779 <cleanWhenFailure>true</cleanWhenFailure>
780 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
781 <cleanWhenAborted>true</cleanWhenAborted>
782 <notFailBuild>true</notFailBuild>
783 </hudson.plugins.ws__cleanup.WsCleanup>
784 <hudson.plugins.parameterizedtrigger.BuildTrigger>
786 </hudson.plugins.parameterizedtrigger.BuildTrigger>
789 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
790 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
791 <timeoutMinutes>30</timeoutMinutes>
792 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
793 <failBuild>true</failBuild>
794 <writingDescription>false</writingDescription>
795 <timeoutPercentage>0</timeoutPercentage>
796 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
797 <timeoutType>absolute</timeoutType>
798 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
799 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
800 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
801 <user>test-credential</user>
802 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
803 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
804 <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
806 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
807 <fileId>npmrc</fileId>
808 <targetLocation>$HOME/.npmrc</targetLocation>
810 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
812 </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>