X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fpacker-build.sh;h=34c4014aa2ae35efcd7267be5fe245a51b0fa26d;hb=6eefde1f463638b5021c2ec96eb67a017d379f1f;hp=714cd33db283cf0c4dfab4e9dc786c1bd4181e75;hpb=10821edc619b09e4623884b02900c39431f8a809;p=releng%2Fglobal-jjb.git diff --git a/shell/packer-build.sh b/shell/packer-build.sh index 714cd33d..34c4014a 100644 --- a/shell/packer-build.sh +++ b/shell/packer-build.sh @@ -22,16 +22,23 @@ PACKER_BUILD_LOG="$PACKER_LOGS_DIR/packer-build.log" mkdir -p "$PACKER_LOGS_DIR" export PATH="${WORKSPACE}/bin:$PATH" -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" +cd packer || exit + +# Prioritize the project's own version of vars if available +platform_file="common-packer/vars/$PACKER_PLATFORM.json" +if [ -f "vars/$PACKER_PLATFORM.json" ]; then + platform_file="vars/$PACKER_PLATFORM.json" +fi + +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