X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=.jjb-test%2Fexpected-xml%2Fgithub-ciman-packer-merge-ubuntu1604-java-builder;h=02cfae67666ac597bc4aae7c167eac2c1c844178;hb=333d661d90ff0291664d49ea5de5866a0ed8b94d;hp=d7df79562eac32c3087aa9d2ce3ab36475d8c4f0;hpb=0ea33652f2dbed50a617fc62a80d1df9d56fb3ae;p=releng%2Fglobal-jjb.git diff --git a/.jjb-test/expected-xml/github-ciman-packer-merge-ubuntu1604-java-builder b/.jjb-test/expected-xml/github-ciman-packer-merge-ubuntu1604-java-builder index d7df7956..02cfae67 100644 --- a/.jjb-test/expected-xml/github-ciman-packer-merge-ubuntu1604-java-builder +++ b/.jjb-test/expected-xml/github-ciman-packer-merge-ubuntu1604-java-builder @@ -71,7 +71,7 @@ For example '<1.0.0' or '>=1.0.0,<2.0.0'. PACKER_VERSION Packer version to download and install. - 1.0.2 + 1.1.3 @@ -88,7 +88,7 @@ For example '<1.0.0' or '>=1.0.0,<2.0.0'. - ** + refs/heads/master @@ -163,7 +163,7 @@ zxiiro - PACKER_VERSION=1.0.2 + PACKER_VERSION=1.1.3 @@ -184,24 +184,22 @@ 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 -# Default packer binary made available on the build image -packer_bin="/usr/local/bin/packer.io" -if hash "$packer_bin" 2>/dev/null; then +if hash packer.io 2>/dev/null; then echo "packer.io command is available." else echo "packer.io command not is available. Installing packer ..." # Installs Hashicorp's Packer binary, required for verify & merge packer jobs - pushd packer - wget "https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip" + 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 @@ -228,17 +226,25 @@ 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. + if [[ "$varfile" == *"cloud-env.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 @@ -275,7 +281,7 @@ exit 0 PACKER_PLATFORM=ubuntu1604 PACKER_TEMPLATE=java-builder -PACKER_VERSION=1.0.2 +PACKER_VERSION=1.1.3 @@ -296,24 +302,22 @@ 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 -# Default packer binary made available on the build image -packer_bin="/usr/local/bin/packer.io" -if hash "$packer_bin" 2>/dev/null; then +if hash packer.io 2>/dev/null; then echo "packer.io command is available." else echo "packer.io command not is available. Installing packer ..." # Installs Hashicorp's Packer binary, required for verify & merge packer jobs - pushd packer - wget "https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip" + 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 @@ -341,16 +345,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="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 @@ -417,9 +427,9 @@ SAR_DIR="$WORKSPACE/archives/sar-reports" 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. @@ -456,7 +466,7 @@ echo "---> create-netrc.sh" # 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 \ @@ -466,7 +476,7 @@ machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}') 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 @@ -582,7 +592,7 @@ then 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}" @@ -654,5 +664,14 @@ rm ~/.netrc test-credential + + + + npmrc + $HOME/.npmrc + + + +