From b0efcea3f6149388c37f96e48f1b982a0629f710 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Mon, 25 Feb 2019 14:22:32 +0200 Subject: [PATCH] Remove vagrant lock from build.sh and run_test.sh (#190) vagrant_lock was created in order to prevent parallel execution of two 'Vagrant up' operations in parallel. Previously it was necessary due to Vagrant internal Chef issue. Now several bugs in Vagrant are fixed and MDBCI uses own Chef to provision nodes for builds and tests. There is no need to wait for previous Vagrant run finished, removing all waiting from all scripts. 'rm vagrant_lock is still present to remove locks created by previous versions of build and test scripts- --- BUILD/mdbci/build.sh | 11 ----------- BUILD/mdbci/upgrade_test.sh | 11 ++--------- .../Documentation/LOCAL_DEPLOYMENT.md | 7 ------- maxscale-system-test/JENKINS.md | 4 ---- maxscale-system-test/mdbci/create_config.sh | 13 ++----------- maxscale-system-test/mdbci/run_test.sh | 4 ++-- 6 files changed, 6 insertions(+), 44 deletions(-) diff --git a/BUILD/mdbci/build.sh b/BUILD/mdbci/build.sh index cbeb7d992..02cdcc629 100755 --- a/BUILD/mdbci/build.sh +++ b/BUILD/mdbci/build.sh @@ -63,13 +63,6 @@ if [ "$already_running" != "ok" ]; then $(<${script_dir}/templates/build.json.template) " 2> /dev/null > $MDBCI_VM_PATH/${name}.json - while [ -f ~/vagrant_lock ] - do - sleep 5 - done - touch ~/vagrant_lock - echo $JOB_NAME-$BUILD_NUMBER >> ~/vagrant_lock - # starting VM for build echo "Generating build VM template" ${mdbci_dir}/mdbci --override --template $MDBCI_VM_PATH/$name.json generate $name @@ -77,7 +70,6 @@ $(<${script_dir}/templates/build.json.template) ${mdbci_dir}/mdbci up --attempts=1 $name if [ $? != 0 ] ; then echo "Error starting VM" - rm ~/vagrant_lock exit 1 fi echo "copying public keys to VM" @@ -92,9 +84,6 @@ export sshkey=`${mdbci_dir}/mdbci show keyfile $name/build --silent 2> /dev/null export scpopt="-i $sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=120 " export sshopt="$scpopt $sshuser@$IP" -echo "Release Vagrant lock" -rm ~/vagrant_lock - echo "Starting build" ${script_dir}/remote_build.sh export build_result=$? diff --git a/BUILD/mdbci/upgrade_test.sh b/BUILD/mdbci/upgrade_test.sh index fbac44d70..24695b5b0 100755 --- a/BUILD/mdbci/upgrade_test.sh +++ b/BUILD/mdbci/upgrade_test.sh @@ -21,13 +21,6 @@ eval "cat < /dev/null > $MDBCI_VM_PATH/${name}.json -while [ -f ~/vagrant_lock ] -do - sleep 5 -done -touch ~/vagrant_lock -echo $JOB_NAME-$BUILD_NUMBER >> ~/vagrant_lock - # destroying existing box if [ -d "install_$box" ]; then ${mdbci_dir}/mdbci destroy $name @@ -42,12 +35,12 @@ if [ $? != 0 ] ; then if [ "x$do_not_destroy_vm" != "xyes" ] ; then ${mdbci_dir}/mdbci destroy $name fi - rm ~/vagrant_lock + rm -f ~/vagrant_lock exit 1 fi fi -rm ~/vagrant_lock +rm -f ~/vagrant_lock # get VM info export sshuser=`${mdbci_dir}/mdbci ssh --command 'whoami' --silent $name/maxscale 2> /dev/null | tr -d '\r'` diff --git a/maxscale-system-test/Documentation/LOCAL_DEPLOYMENT.md b/maxscale-system-test/Documentation/LOCAL_DEPLOYMENT.md index 39c1ba337..6beb5c3d8 100644 --- a/maxscale-system-test/Documentation/LOCAL_DEPLOYMENT.md +++ b/maxscale-system-test/Documentation/LOCAL_DEPLOYMENT.md @@ -141,13 +141,6 @@ https://help.ubuntu.com/lts/serverguide/libvirt.html https://github.com/vagrant-libvirt/vagrant-libvirt#installation -### vagrant is locked, waiting ... - -```bash -rm ~/vagrant_lock -``` - - ### Random VM creation failures Plese check the amount of free memory and amount of running VMs diff --git a/maxscale-system-test/JENKINS.md b/maxscale-system-test/JENKINS.md index d43344bff..44d4956dd 100644 --- a/maxscale-system-test/JENKINS.md +++ b/maxscale-system-test/JENKINS.md @@ -121,7 +121,3 @@ If test run was executed with parameter 'do_not_destroy' set yo 'yes' please do [destroy](http://max-tst-01.mariadb.com:8089/view/axilary/job/destroy/) against your 'target' This job also have to be executed if test run job crashed or it was interrupted. - -In case of build or test job crash, interruption, Jenkins crash during Vagrant operation it is possible that Vagrant lock -stays in locked state and no other job can progress (job can be started, but it is waiting for Vagrant lock - -'/home/vagrant/vagrant_lock' can be seen in the job log). In this case lock can be removed by [remove_lock](http://max-tst-01.mariadb.com:8089/view/axilary/job/remove_lock/) job. diff --git a/maxscale-system-test/mdbci/create_config.sh b/maxscale-system-test/mdbci/create_config.sh index 1e2795486..697ff4cac 100755 --- a/maxscale-system-test/mdbci/create_config.sh +++ b/maxscale-system-test/mdbci/create_config.sh @@ -32,26 +32,17 @@ ${mdbci_dir}/mdbci --override --template ${MDBCI_VM_PATH}/${name}.json generate mkdir ${MDBCI_VM_PATH}/$name/cnf cp -r ${script_dir}/cnf/* ${MDBCI_VM_PATH}/$name/cnf/ - -while [ -f ~/vagrant_lock ] -do - echo "vagrant is locked, waiting ..." - sleep 5 -done -touch ~/vagrant_lock -echo ${JOB_NAME}-${BUILD_NUMBER} >> ~/vagrant_lock - echo "running vagrant up $provider" ${mdbci_dir}/mdbci up $name --attempts 3 if [ $? != 0 ]; then echo "Error creating configuration" - rm ~/vagrant_lock + rm -f ~/vagrant_lock exit 1 fi #cp ~/build-scripts/team_keys . ${mdbci_dir}/mdbci public_keys --key ${team_keys} $name -rm ~/vagrant_lock +rm -f ~/vagrant_lock exit 0 diff --git a/maxscale-system-test/mdbci/run_test.sh b/maxscale-system-test/mdbci/run_test.sh index 95ce814f5..16574e342 100755 --- a/maxscale-system-test/mdbci/run_test.sh +++ b/maxscale-system-test/mdbci/run_test.sh @@ -91,7 +91,7 @@ set -x if [ "${do_not_destroy_vm}" != "yes" ] ; then ${mdbci_dir}/mdbci destroy $name fi - rm ~/vagrant_lock + rm -f ~/vagrant_lock exit 1 fi ${mdbci_dir}/mdbci snapshot take --path-to-nodes $name --snapshot-name clean @@ -105,7 +105,7 @@ else if [ "${do_not_destroy_vm}" != "yes" ] ; then ${mdbci_dir}/mdbci destroy $name fi - rm ~/vagrant_lock + rm -f ~/vagrant_lock exit 1 fi