2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> packer-validate.sh"
12 # The script validates an packers files.
14 # $CLOUDENV : Provides the cloud credential file.
16 # Ensure we fail the job if any steps fail.
19 PACKER_LOGS_DIR="$WORKSPACE/archives/packer"
20 mkdir -p "$PACKER_LOGS_DIR"
21 export PATH="${WORKSPACE}/bin:$PATH"
24 varfiles=(../packer/vars/*.json)
25 templates=(../packer/templates/*.json)
27 for varfile in "${varfiles[@]}"; do
28 for template in "${templates[@]}"; do
29 export PACKER_LOG="yes" && \
30 export PACKER_LOG_PATH="$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log" && \
31 packer.io validate -var-file="$CLOUDENV" \
32 -var-file="$varfile" "$template"