Просмотр исходного кода

Enable chown on installs directory inside vagrant

Hamilton Turner 10 лет назад
Родитель
Сommit
ce5220f29f
2 измененных файлов с 23 добавлено и 3 удалено
  1. 10 1
      deployment/vagrant-common/bootstrap.sh
  2. 13 2
      deployment/vagrant-common/core.rb

+ 10 - 1
deployment/vagrant-common/bootstrap.sh

@@ -106,8 +106,17 @@ if [ ! -e "~/.firstboot" ]; then
   # If they didn't sync, we need to clone it
   if [ -d "/FrameworkBenchmarks" ]; then
     ln -s /FrameworkBenchmarks $FWROOT
-    echo "Removing installs/ and results/ folders so they do not interfere"
+    echo "Removing your current results folder to avoid interference"
     rm -rf $FWROOT/installs $FWROOT/results
+
+    # vboxfs does not support chown or chmod, which we need. 
+    # We therefore bind-mount a normal linux directory so we can
+    # use these operations. This enables us to 
+    # use `chown -R testrunner:testrunner $FWROOT/installs` later
+    echo "Mounting over your installs folder"
+    mkdir -p /tmp/TFB_installs
+    mkdir -p /FrameworkBenchmarks/installs
+    sudo mount -o bind /tmp/TFB_installs $FWROOT/installs
   else
     # If there is no synced folder, clone the project
     echo "Cloning project from $GH_REPO $GH_BRANCH"

+ 13 - 2
deployment/vagrant-common/core.rb

@@ -98,8 +98,19 @@ def provider_virtualbox(config, role, ip_address='172.16.0.16')
     vb.memory = ENV.fetch('TFB_VB_MEM', 3022)
     vb.cpus = ENV.fetch('TFB_VB_CPU', 2)
 
-    # mount_options addresses issue mitchellh/vagrant#4997
-    override.vm.synced_folder "../..", "/FrameworkBenchmarks", mount_options: ['fmode=777', 'dmode=777']
+    # The VirtualBox file system for shared folders (vboxfs)
+    # does not support posix's chown/chmod - these can only 
+    # be set at mount time, and they are uniform for the entire
+    # shared directory. We require chown, because we have the 
+    # testrunner user account, so this is a problem. To mitigate
+    # the effects, we set the folders and files to 777 permissions. 
+    # Even though we cannot chown them to testrunner, with 777 and 
+    # owner vagrant *most* of the software works ok. Occasional 
+    # issues are still possible. 
+    #
+    # See mitchellh/vagrant#4997
+    # See http://superuser.com/a/640028/136050
+    override.vm.synced_folder "../..", "/FrameworkBenchmarks", :mount_options => ["dmode=777", "fmode=777"]
 
     if role.eql? "all" or role.eql? "app"
       override.vm.network :forwarded_port, guest: 8080, host: 28080