我正在尝试从Jenkins启动Vagrant VM。我在'Boot up Vagrant VM'中给出了Vagrantfile路径。 作业运行时,我收到以下错误:
Failed to iterate on remote directory vagrant_projs
[ vagrant ]: Executing command :[vagrant, up] in folder /Users/abc/Desktop/vagrant_projs
[vagrant_projs] $ vagrant up
[ vagrant ]: Error starting up vagrant, caught IOException, message: Cannot run program "vagrant" (in directory "/Users/abc/Desktop/vagrant_projs"): error=13, Permission denied
[ vagrant ]: [Ljava.lang.StackTraceElement;@5e144dc9
Build step 'Boot up Vagrant VM' marked build as failure
Finished: FAILURE
我认为这可能是因为Vagrantfile的权限,因此我手动使用chmod 777。即便如此,它也给了我同样的错误。
更新 我将 Vagrantfile 所在的文件夹从桌面移动到用户文件夹,我得到了不同的堆栈跟踪。
[workspace] $ vagrant -v
Vagrant 1.7.2
[ vagrant ]: Executing command :[vagrant, up] in folder /Users/abalan15/vagrant_projs
[vagrant_projs] $ vagrant up
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:313:in `unlink': Permission denied - /Users/abalan15/vagrant_projs/.vagrant/machines/default/virtualbox/id (Errno::EACCES)
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:313:in `delete'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:313:in `id='
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:142:in `initialize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/vagrantfile.rb:75:in `new'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/vagrantfile.rb:75:in `machine'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:614:in `machine'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:168:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:192:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:192:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:174:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:174:in `with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/commands/up/command.rb:74:in `block in execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:277:in `block (2 levels) in batch'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:275:in `tap'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:275:in `block in batch'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:274:in `synchronize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:274:in `batch'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/commands/up/command.rb:58:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/cli.rb:42:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:301:in `cli'
from /opt/vagrant/bin/../embedded/gems/gems/vagrant-1.7.2/bin/vagrant:174:in `<main>'
Build step 'Boot up Vagrant VM' marked build as failure
Finished: FAILURE
答案 0 :(得分:1)
最后! 当我们尝试从Jenkins(带有vagrant插件)调用/启动Vagrant VM时, .vagrant.d &amp;将调用带有vagrantfile 的文件夹。应该为这些文件夹提供jenkins用户的权限。
在Mac中,右键单击这些文件夹,获取信息,在底部(权限),单击+符号并将jenkins添加到'Users&amp;基团
答案 1 :(得分:0)
在处理Jenkins中的权限问题时要检查的一些事项: