X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;ds=sidebyside;f=.jjb-test%2Fexpected-xml%2Fgerrit-ciman-packer-merge-ubuntu1604-java-builder;h=ebcd8ae4b35a5029190217a51424df0dd9523284;hb=refs%2Fchanges%2F94%2F8394%2F1;hp=012fac5d385e3d9bfc0b1dac7ff33f4d90744e07;hpb=6f46b9b1fdec62f4fa7f435cb9b0b11cd151a99a;p=releng%2Fglobal-jjb.git
diff --git a/.jjb-test/expected-xml/gerrit-ciman-packer-merge-ubuntu1604-java-builder b/.jjb-test/expected-xml/gerrit-ciman-packer-merge-ubuntu1604-java-builder
index 012fac5d..ebcd8ae4 100644
--- a/.jjb-test/expected-xml/gerrit-ciman-packer-merge-ubuntu1604-java-builder
+++ b/.jjb-test/expected-xml/gerrit-ciman-packer-merge-ubuntu1604-java-builder
@@ -76,7 +76,7 @@ For example '<1.0.0' or '>=1.0.0,<2.0.0'.
PACKER_VERSION
Packer version to download and install.
- 1.1.1
+ 1.1.3
@@ -96,28 +96,22 @@ For example '<1.0.0' or '>=1.0.0,<2.0.0'.
refs/heads/$GERRIT_BRANCH
-
-
false
- false
- true
- false
false
Default
-
- true
-
- false
- false
+
+
+
false
true
false
+ false
10
@@ -151,7 +145,11 @@ For example '<1.0.0' or '>=1.0.0,<2.0.0'.
ANT
- packer/provision/java-builder.sh
+ packer/provision/*.sh
+
+
+ ANT
+ packer/provision/java-builder.yaml
ANT
@@ -205,7 +203,7 @@ For example '<1.0.0' or '>=1.0.0,<2.0.0'.
- PACKER_VERSION=1.1.1
+ PACKER_VERSION=1.1.3
@@ -226,7 +224,7 @@ echo "---> packer-install.sh"
# $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
@@ -236,12 +234,12 @@ if hash packer.io 2>/dev/null; then
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
@@ -268,17 +266,26 @@ mkdir -p "$PACKER_LOGS_DIR"
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
@@ -315,7 +322,7 @@ exit 0
PACKER_PLATFORM=ubuntu1604
PACKER_TEMPLATE=java-builder
-PACKER_VERSION=1.1.1
+PACKER_VERSION=1.1.3
@@ -336,7 +343,7 @@ echo "---> packer-install.sh"
# $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
@@ -346,12 +353,12 @@ if hash packer.io 2>/dev/null; then
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
@@ -379,16 +386,22 @@ PACKER_BUILD_LOG="$PACKER_LOGS_DIR/packer-build.log"
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
@@ -679,7 +692,7 @@ rm ~/.netrc
- 45
+ 90
BUILD_TIMEOUT
true
false