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>https://github.com/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.
61 </hudson.model.StringParameterDefinition>
62 <hudson.model.StringParameterDefinition>
63 <name>PACKER_VERSION</name>
64 <description>Packer version to download and install.</description>
65 <defaultValue>1.0.2</defaultValue>
66 </hudson.model.StringParameterDefinition>
67 </parameterDefinitions>
68 </hudson.model.ParametersDefinitionProperty>
70 <scm class="hudson.plugins.git.GitSCM">
71 <configVersion>2</configVersion>
73 <hudson.plugins.git.UserRemoteConfig>
75 <refspec>+refs/pull/*:refs/remotes/origin/pr/*</refspec>
76 <url>git@github.com:example-org/releng/ciman</url>
77 <credentialsId>test-credential</credentialsId>
78 </hudson.plugins.git.UserRemoteConfig>
81 <hudson.plugins.git.BranchSpec>
83 </hudson.plugins.git.BranchSpec>
86 <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
87 <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
88 <authorOrCommitter>false</authorOrCommitter>
89 <wipeOutWorkspace>true</wipeOutWorkspace>
90 <pruneBranches>false</pruneBranches>
91 <remotePoll>false</remotePoll>
92 <gitTool>Default</gitTool>
93 <submoduleCfg class="list"/>
98 <skipTag>true</skipTag>
100 <useShallowClone>false</useShallowClone>
101 <ignoreNotifyCommit>false</ignoreNotifyCommit>
103 <hudson.plugins.git.extensions.impl.SubmoduleOption>
104 <disableSubmodules>false</disableSubmodules>
105 <recursiveSubmodules>true</recursiveSubmodules>
106 <trackingSubmodules>false</trackingSubmodules>
108 <timeout>10</timeout>
109 </hudson.plugins.git.extensions.impl.SubmoduleOption>
110 <hudson.plugins.git.extensions.impl.WipeWorkspace/>
113 <triggers class="vector">
114 <org.jenkinsci.plugins.ghprb.GhprbTrigger>
117 <allowMembersOfWhitelistedOrgsAsAdmin>false</allowMembersOfWhitelistedOrgsAsAdmin>
121 <triggerPhrase>^recheck$</triggerPhrase>
122 <onlyTriggerPhrase>false</onlyTriggerPhrase>
123 <useGitHubHooks>true</useGitHubHooks>
124 <permitAll>true</permitAll>
125 <autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
127 <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
128 <commitStatusContext>Packer Verify</commitStatusContext>
129 </org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>
131 </org.jenkinsci.plugins.ghprb.GhprbTrigger>
134 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
136 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
137 <fileId>ci-packer-cloud-env</fileId>
139 <variable>CLOUDENV</variable>
140 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
142 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
145 <propertiesContent>PACKER_VERSION=1.0.2
151 # SPDX-License-Identifier: EPL-1.0
152 ##############################################################################
153 # Copyright (c) 2017 The Linux Foundation and others.
155 # All rights reserved. This program and the accompanying materials
156 # are made available under the terms of the Eclipse Public License v1.0
157 # which accompanies this distribution, and is available at
158 # http://www.eclipse.org/legal/epl-v10.html
159 ##############################################################################
160 echo "---> packer-install.sh"
161 # The script checks for the packer binaries and installs the binary
162 # if its not available
164 # $PACKER_VERSION : Define a packer version passed as job paramter
166 PACKER_VERSION="${PACKER_VERSION:-1.0.2}"
168 # Ensure we fail the job if any steps fail.
170 # Default packer binary made available on the build image
171 packer_bin="/usr/local/bin/packer.io"
173 if hash "$packer_bin" 2>/dev/null; then
174 echo "packer.io command is available."
176 echo "packer.io command not is available. Installing packer ..."
177 # Installs Hashicorp's Packer binary, required for verify & merge packer jobs
179 wget "https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip"
180 mkdir -p "${WORKSPACE}/bin"
181 unzip "packer_${PACKER_VERSION}_linux_amd64.zip" -d ${WORKSPACE}/bin/
182 # rename packer to avoid conflict with binary in cracklib
183 mv ${WORKSPACE}/bin/packer "${WORKSPACE}/bin/packer.io"
188 # SPDX-License-Identifier: EPL-1.0
189 ##############################################################################
190 # Copyright (c) 2017 The Linux Foundation and others.
192 # All rights reserved. This program and the accompanying materials
193 # are made available under the terms of the Eclipse Public License v1.0
194 # which accompanies this distribution, and is available at
195 # http://www.eclipse.org/legal/epl-v10.html
196 ##############################################################################
197 echo "---> packer-validate.sh"
198 # The script validates an packers files.
200 # $CLOUDENV : Provides the cloud credential file.
202 # Ensure we fail the job if any steps fail.
205 PACKER_LOGS_DIR="$WORKSPACE/archives/packer"
206 mkdir -p "$PACKER_LOGS_DIR"
207 export PATH="${WORKSPACE}/bin:$PATH"
210 varfiles=(../packer/vars/*.json)
211 templates=(../packer/templates/*.json)
213 for varfile in "${varfiles[@]}"; do
214 for template in "${templates[@]}"; do
215 export PACKER_LOG="yes" && \
216 export PACKER_LOG_PATH="$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log" && \
217 packer.io validate -var-file="$CLOUDENV" \
218 -var-file="$varfile" "$template"
219 if [ $? -ne 0 ]; then
225 </hudson.tasks.Shell>
228 # SPDX-License-Identifier: EPL-1.0
229 ##############################################################################
230 # Copyright (c) 2017 The Linux Foundation and others.
232 # All rights reserved. This program and the accompanying materials
233 # are made available under the terms of the Eclipse Public License v1.0
234 # which accompanies this distribution, and is available at
235 # http://www.eclipse.org/legal/epl-v10.html
236 ##############################################################################
237 echo "---> packer-clear-credentials.sh"
239 set +e # DO NOT cause build failure if any of the rm calls fail.
240 rm "$CLOUDENV"
243 </hudson.tasks.Shell>
246 <org.jenkinsci.plugins.postbuildscript.PostBuildScript>
250 # SPDX-License-Identifier: EPL-1.0
251 ##############################################################################
252 # Copyright (c) 2017 The Linux Foundation and others.
254 # All rights reserved. This program and the accompanying materials
255 # are made available under the terms of the Eclipse Public License v1.0
256 # which accompanies this distribution, and is available at
257 # http://www.eclipse.org/legal/epl-v10.html
258 ##############################################################################
259 echo "---> sysstat.sh"
260 set +e # DON'T fail build if script fails.
262 OS=$(facter operatingsystem)
263 case "$OS" in
265 SYSSTAT_PATH="/var/log/sysstat"
267 # Dont run the script when systat is not enabled by default
268 if ! grep --quiet 'ENABLED="true"' "/etc/default/sysstat"; then
273 SYSSTAT_PATH="/var/log/sa"
281 SAR_DIR="$WORKSPACE/archives/sar-reports"
282 mkdir -p "$SAR_DIR"
283 cp "$SYSSTAT_PATH/"* "$_"
284 # convert sar data to ascii format
285 while IFS="" read -r s
287 [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
288 done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
290 # DON'T fail build if script fails.
293 </hudson.tasks.Shell>
294 <org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
296 <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
297 <fileId>jenkins-log-archives-settings</fileId>
299 <variable>SETTINGS_FILE</variable>
300 </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
302 </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
305 <propertiesContent>SERVER_ID=logs</propertiesContent>
310 # SPDX-License-Identifier: EPL-1.0
311 ##############################################################################
312 # Copyright (c) 2017 The Linux Foundation and others.
314 # All rights reserved. This program and the accompanying materials
315 # are made available under the terms of the Eclipse Public License v1.0
316 # which accompanies this distribution, and is available at
317 # http://www.eclipse.org/legal/epl-v10.html
318 ##############################################################################
319 echo "---> create-netrc.sh"
321 # Ensure we fail the job if any steps fail.
324 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
325 CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
326 -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
327 -v x:username -o ":" -v x:password \
328 "$SETTINGS_FILE")
330 machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}')
331 user=$(echo "$CREDENTIAL" | cut -f1 -d:)
332 pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
334 echo "machine $machine login $user password $pass" > ~/.netrc
336 </hudson.tasks.Shell>
339 # SPDX-License-Identifier: EPL-1.0
340 ##############################################################################
341 # Copyright (c) 2017 The Linux Foundation and others.
343 # All rights reserved. This program and the accompanying materials
344 # are made available under the terms of the Eclipse Public License v1.0
345 # which accompanies this distribution, and is available at
346 # http://www.eclipse.org/legal/epl-v10.html
347 ##############################################################################
348 echo "---> lftools-install.sh"
350 # Ensure we fail the job if any steps fail.
351 # DO NOT set -u as virtualenv's activate script has unbound variables
354 virtualenv --quiet "/tmp/v/lftools"
355 # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
356 source "/tmp/v/lftools/bin/activate"
357 pip install --quiet --upgrade pip
358 pip install --quiet --upgrade "lftools<1.0.0"
360 # pipdeptree prints out a lot of information because lftools pulls in many
361 # dependencies. Let's only print it if we want to debug.
362 # echo "----> Pip Dependency Tree"
363 # pip install --quiet --upgrade pipdeptree
367 # SPDX-License-Identifier: EPL-1.0
368 ##############################################################################
369 # Copyright (c) 2017 The Linux Foundation and others.
371 # All rights reserved. This program and the accompanying materials
372 # are made available under the terms of the Eclipse Public License v1.0
373 # which accompanies this distribution, and is available at
374 # http://www.eclipse.org/legal/epl-v10.html
375 ##############################################################################
376 echo "---> logs-deploy.sh"
378 # Ensure we fail the job if any steps fail.
381 set -x # Trace commands for this script to make debugging easier.
383 ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}"
384 LOGS_SERVER="${LOGS_SERVER:-None}"
386 if [ "${LOGS_SERVER}" == 'None' ]
388 set +x # Disable trace since we no longer need it
390 echo "WARNING: Logging server not set"
392 NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
393 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
394 BUILD_URL="${BUILD_URL}"
396 lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE"
397 lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL"
399 set +x # Disable trace since we no longer need it.
401 echo "Build logs: <a href=\"$LOGS_SERVER/$NEXUS_PATH\">$LOGS_SERVER/$NEXUS_PATH</a>"
404 </hudson.tasks.Shell>
407 # SPDX-License-Identifier: EPL-1.0
408 ##############################################################################
409 # Copyright (c) 2017 The Linux Foundation and others.
411 # All rights reserved. This program and the accompanying materials
412 # are made available under the terms of the Eclipse Public License v1.0
413 # which accompanies this distribution, and is available at
414 # http://www.eclipse.org/legal/epl-v10.html
415 ##############################################################################
417 # Clear log credential files
418 rm "$SETTINGS_FILE"
421 </hudson.tasks.Shell>
422 <hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
423 <regexp>^Build logs: .*</regexp>
424 </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
426 <scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
427 <scriptOnlyIfFailure>false</scriptOnlyIfFailure>
428 <markBuildUnstable>false</markBuildUnstable>
429 </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
430 <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup">
432 <hudson.plugins.ws__cleanup.Pattern>
433 <pattern>**/*.jenkins-trigger</pattern>
435 </hudson.plugins.ws__cleanup.Pattern>
437 <deleteDirs>false</deleteDirs>
438 <cleanupMatrixParent>false</cleanupMatrixParent>
440 <cleanWhenSuccess>true</cleanWhenSuccess>
441 <cleanWhenUnstable>true</cleanWhenUnstable>
442 <cleanWhenFailure>true</cleanWhenFailure>
443 <cleanWhenNotBuilt>true</cleanWhenNotBuilt>
444 <cleanWhenAborted>true</cleanWhenAborted>
445 <notFailBuild>true</notFailBuild>
446 </hudson.plugins.ws__cleanup.WsCleanup>
449 <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
450 <hudson.plugins.build__timeout.BuildTimeoutWrapper>
451 <timeoutMinutes>10</timeoutMinutes>
452 <timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
453 <failBuild>true</failBuild>
454 <writingDescription>false</writingDescription>
455 <timeoutPercentage>0</timeoutPercentage>
456 <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
457 <timeoutType>absolute</timeoutType>
458 </hudson.plugins.build__timeout.BuildTimeoutWrapper>
459 <hudson.plugins.timestamper.TimestamperBuildWrapper/>
460 <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
461 <user>test-credential</user>
462 </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
463 <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>