<assignedNode>build-vm</assignedNode>
<canRoam>false</canRoam>
<properties>
- <com.coravy.hudson.plugins.github.GithubProjectProperty>
+ <com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github">
<projectUrl>https://github.com/example-org/releng/ciman</projectUrl>
+ <displayName/>
</com.coravy.hudson.plugins.github.GithubProjectProperty>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.StringParameterDefinition>
<name>PACKER_VERSION</name>
<description>Packer version to download and install.</description>
- <defaultValue>1.1.1</defaultValue>
+ <defaultValue>1.1.3</defaultValue>
</hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
- <name>**</name>
+ <name>refs/heads/master</name>
</hudson.plugins.git.BranchSpec>
</branches>
- <excludedUsers/>
- <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
- <authorOrCommitter>false</authorOrCommitter>
- <wipeOutWorkspace>true</wipeOutWorkspace>
- <pruneBranches>false</pruneBranches>
<remotePoll>false</remotePoll>
<gitTool>Default</gitTool>
<submoduleCfg class="list"/>
- <relativeTargetDir/>
<reference/>
<gitConfigName/>
<gitConfigEmail/>
- <skipTag>true</skipTag>
- <scmName/>
- <useShallowClone>false</useShallowClone>
- <ignoreNotifyCommit>false</ignoreNotifyCommit>
<extensions>
+ <hudson.plugins.git.extensions.impl.BuildChooserSetting>
+ <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
+ </hudson.plugins.git.extensions.impl.BuildChooserSetting>
<hudson.plugins.git.extensions.impl.SubmoduleOption>
<disableSubmodules>false</disableSubmodules>
<recursiveSubmodules>true</recursiveSubmodules>
<trackingSubmodules>false</trackingSubmodules>
+ <parentCredentials>false</parentCredentials>
<reference/>
<timeout>10</timeout>
</hudson.plugins.git.extensions.impl.SubmoduleOption>
tykeal
zxiiro</whitelist>
<orgslist>example-org</orgslist>
+ <whiteListLabels/>
+ <blackListLabels/>
<cron/>
<triggerPhrase>^remerge$</triggerPhrase>
+ <skipBuildPhrase/>
<onlyTriggerPhrase>true</onlyTriggerPhrase>
<useGitHubHooks>true</useGitHubHooks>
<permitAll>false</permitAll>
</org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
<EnvInjectBuilder>
<info>
- <propertiesContent>PACKER_VERSION=1.1.1
+ <propertiesContent>PACKER_VERSION=1.1.3
</propertiesContent>
</info>
</EnvInjectBuilder>
# $PACKER_VERSION : Define a packer version passed as job paramter
-PACKER_VERSION="${PACKER_VERSION:-1.0.2}"
+PACKER_VERSION="${PACKER_VERSION:-1.1.3}"
# Ensure we fail the job if any steps fail.
set -eu -o pipefail
else
echo "packer.io command not is available. Installing packer ..."
# Installs Hashicorp's Packer binary, required for verify & merge packer jobs
- pushd packer
+ pushd "${WORKSPACE}"
wget -nv "https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip"
mkdir -p "${WORKSPACE}/bin"
- unzip "packer_${PACKER_VERSION}_linux_amd64.zip" -d ${WORKSPACE}/bin/
+ unzip "packer_${PACKER_VERSION}_linux_amd64.zip" -d "${WORKSPACE}/bin/"
# rename packer to avoid conflict with binary in cracklib
- mv ${WORKSPACE}/bin/packer "${WORKSPACE}/bin/packer.io"
+ mv "${WORKSPACE}/bin/packer" "${WORKSPACE}/bin/packer.io"
popd
fi
export PATH="${WORKSPACE}/bin:$PATH"
cd packer
-varfiles=(../packer/vars/*.json)
-templates=(../packer/templates/*.json)
+varfiles=(vars/*.json common-packer/vars/*.json)
+templates=(templates/*.json)
for varfile in "${varfiles[@]}"; do
+ # cloud-env.json is a file containing credentials which is pulled in via
+ # CLOUDENV variable so skip it here. Also handle the case where a project
+ # has not vars/*.json file.
+ if [[ "$varfile" == *"cloud-env.json"* ]] || [[ "$varfile" == 'vars/*.json' ]]; then
+ continue
+ fi
+
+ echo "-----> Testing varfile: $varfile"
for template in "${templates[@]}"; do
- export PACKER_LOG="yes" && \
- export PACKER_LOG_PATH="$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log" && \
- packer.io validate -var-file="$CLOUDENV" \
- -var-file="$varfile" "$template"
- if [ $? -ne 0 ]; then
- break
+ export PACKER_LOG="yes"
+ export PACKER_LOG_PATH="$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log"
+ if output=$(packer.io validate -var-file="$CLOUDENV" -var-file="$varfile" "$template"); then
+ echo "$template: $output"
+ else
+ echo "$template: $output"
+ exit 1
fi
done
done
<info>
<propertiesContent>PACKER_PLATFORM=ubuntu1604
PACKER_TEMPLATE=mininet
-PACKER_VERSION=1.1.1
+PACKER_VERSION=1.1.3
</propertiesContent>
</info>
</EnvInjectBuilder>
# $PACKER_VERSION : Define a packer version passed as job paramter
-PACKER_VERSION="${PACKER_VERSION:-1.0.2}"
+PACKER_VERSION="${PACKER_VERSION:-1.1.3}"
# Ensure we fail the job if any steps fail.
set -eu -o pipefail
else
echo "packer.io command not is available. Installing packer ..."
# Installs Hashicorp's Packer binary, required for verify & merge packer jobs
- pushd packer
+ pushd "${WORKSPACE}"
wget -nv "https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip"
mkdir -p "${WORKSPACE}/bin"
- unzip "packer_${PACKER_VERSION}_linux_amd64.zip" -d ${WORKSPACE}/bin/
+ unzip "packer_${PACKER_VERSION}_linux_amd64.zip" -d "${WORKSPACE}/bin/"
# rename packer to avoid conflict with binary in cracklib
- mv ${WORKSPACE}/bin/packer "${WORKSPACE}/bin/packer.io"
+ mv "${WORKSPACE}/bin/packer" "${WORKSPACE}/bin/packer.io"
popd
fi
mkdir -p "$PACKER_LOGS_DIR"
export PATH="${WORKSPACE}/bin:$PATH"
+# Prioritize the project's own version of vars if available
+platform_file="common-packer/vars/$PACKER_PLATFORM.json"
+if [ -f "$PACKER_PLATFORM" ]; then
+ platform_file="vars/$PACKER_PLATFORM.json"
+fi
+
cd packer
-export PACKER_LOG="yes" && \
-export PACKER_LOG_PATH="$PACKER_BUILD_LOG" && \
- packer.io build -color=false \
- -var-file="$CLOUDENV" \
- -var-file="../packer/vars/$PACKER_PLATFORM.json" \
- "../packer/templates/$PACKER_TEMPLATE.json"
+export PACKER_LOG="yes"
+export PACKER_LOG_PATH="$PACKER_BUILD_LOG"
+packer.io build -color=false \
+ -var-file="$CLOUDENV" \
+ -var-file="$platform_file" \
+ "templates/$PACKER_TEMPLATE.json"
# Retrive the list of cloud providers
-clouds=($(jq -r '.builders[].name' "../packer/templates/$PACKER_TEMPLATE.json"))
+mapfile -t clouds < <(jq -r '.builders[].name' "templates/$PACKER_TEMPLATE.json")
# Split public/private clouds logs
for cloud in "${clouds[@]}"; do
mkdir -p "$SAR_DIR"
cp "$SYSSTAT_PATH/"* "$_"
# convert sar data to ascii format
-while IFS="" read -r s
+while IFS="" read -r sarfilenum
do
- [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/sar${s//[!0-9]/}"
+ [ -f "$sarfilenum" ] && LC_TIME=POSIX sar -A -f "$sarfilenum" > "$SAR_DIR/sar${sarfilenum//[!0-9]/}"
done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true)
# DON'T fail build if script fails.
# Ensure we fail the job if any steps fail.
set -eu -o pipefail
-NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
+NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
-t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \
-v x:username -o ":" -v x:password \
user=$(echo "$CREDENTIAL" | cut -f1 -d:)
pass=$(echo "$CREDENTIAL" | cut -f2 -d:)
-echo "machine $machine login $user password $pass" > ~/.netrc
+echo "machine ${machine%:*} login $user password $pass" > ~/.netrc
</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
echo "WARNING: Logging server not set"
else
- NEXUS_URL="${NEXUS_URL:-$NEXUSPROXY}"
+ NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}"
BUILD_URL="${BUILD_URL}"
<buildWrappers>
<com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
<hudson.plugins.build__timeout.BuildTimeoutWrapper>
- <timeoutMinutes>45</timeoutMinutes>
+ <timeoutMinutes>90</timeoutMinutes>
<timeoutEnvVar>BUILD_TIMEOUT</timeoutEnvVar>
<failBuild>true</failBuild>
<writingDescription>false</writingDescription>
<user>test-credential</user>
</com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
<jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
+ <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
+ <managedFiles>
+ <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
+ <fileId>npmrc</fileId>
+ <targetLocation>$HOME/.npmrc</targetLocation>
+ <variable/>
+ </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
+ </managedFiles>
+ </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
</buildWrappers>
</project>