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-
This commit is contained in:
parent
2440b48ccc
commit
b0efcea3f6
@ -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=$?
|
||||
|
@ -21,13 +21,6 @@ eval "cat <<EOF
|
||||
$(<${script_dir}/templates/install.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
|
||||
|
||||
# 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'`
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user