From 98d358eb917ed9de44a6f71b8d90d58b3829cf97 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sat, 18 Apr 2020 20:42:56 +0200 Subject: [PATCH] validation: Use blucon.sh if python3 not available The Validation project supports running the test suites using nothing more than Docker as a prerequisite (i.e. if no python3 is available), so leverage `blucon.sh` now that it supports overriding the validation git repository path and results dir path. For most slaves, the new method is merely a fail-safe, since they already have python3. JIRA: VAL-95 Depends-on: I4d3c10881de28c64bcca05ff23aa1025f67a1f5e Change-Id: I08e89300637862e40344131532ec40efd5f68501 Signed-off-by: Alexandru Avadanii --- jjb/shell/run_bluval.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/jjb/shell/run_bluval.sh b/jjb/shell/run_bluval.sh index 844c611..fbe9aed 100755 --- a/jjb/shell/run_bluval.sh +++ b/jjb/shell/run_bluval.sh @@ -49,6 +49,7 @@ usage() { verify_connectivity() { local ip=$1 info "Verifying connectivity to $ip..." + # shellcheck disable=SC2034 for i in $(seq 0 10); do if ping -c 1 -W 1 "$ip" > /dev/null; then info "$ip is reachable!" @@ -141,10 +142,10 @@ sed -i \ "$volumes_path" # create ssh_key_dir -mkdir -p $cwd/ssh_key_dir +mkdir -p "$cwd/ssh_key_dir" # copy ssh_key in ssh_key_dir -cp $ssh_key $cwd/ssh_key_dir/id_rsa +cp "$ssh_key" "$cwd/ssh_key_dir/id_rsa" variables_path="$cwd/tests/variables.yaml" # update information in variables yaml @@ -163,10 +164,17 @@ then fi set +e -# even if the script fails we need to change the owner of results -# shellcheck disable=SC2086 -python3 bluval/blucon.py $options "$blueprint_name" +if python3 --version > /dev/null; then + # shellcheck disable=SC2086 + python3 bluval/blucon.py $options "$blueprint_name" +else + # shellcheck disable=SC2086 + VALIDATION_DIR="$WORKSPACE" RESULTS_DIR="$WORKSPACE/results" \ + bluval/blucon.sh $options "$blueprint_name" +fi +# even if the script fails we need to change the owner of results +# shellcheck disable=SC2181 if [ $? -ne 0 ]; then change_res_owner error "Bluval validation FAIL " @@ -181,11 +189,9 @@ else TIMESTAMP=$(date +'%Y%m%d-%H%M%S') NEXUS_URL=https://nexus.akraino.org/ NEXUS_PATH="${LAB_SILO}/bluval_results/${blueprint_name}/${VERSION}/${TIMESTAMP}" - BUILD_URL="${JENKINS_HOSTNAME}/job/${JOB_NAME}/${BUILD_NUMBER}/" zip -r results.zip ./results lftools deploy nexus-zip "$NEXUS_URL" logs "$NEXUS_PATH" results.zip rm results.zip fi rm -f ~/.netrc - -- 2.16.6