I have a last version Jenkis (run under the Tomcat) and the Vagrant and LXC container.
Tomcat running under jenkins
user. I have next Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "arjenvrielink/xenial64-lxc"
config.vm.provider :lxc do |lxc|
lxc.backingstore = 'dir'
end
end
So, when I ran lxc container from bash by vagrant up
everything was fine. And vagrant ssh
worked. But if I run it via Jenkins job I get this
Started by user admin
[EnvInject] - Loading node environment variables.
Building in workspace /home/jenkins/workspaces/server
[server] $ /bin/bash /opt/tomcat/temp/jenkins204809790857124992.sh
Bringing machine 'default' up with 'lxc' provider...
==> default: Importing base box 'arjenvrielink/xenial64-lxc'...
==> default: Checking if box 'arjenvrielink/xenial64-lxc' is up to date...
==> default: Setting up mount entries for shared folders...
default: /vagrant => /home/jenkins/workspaces/server/vagrant
==> default: Starting container...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 10.0.3.29:22
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
Build was aborted
Aborted by admin
Finished: ABORTED
Jenkins job contains only these commands
!#/bin/bash
cd vagrant
vagrant up
In process of investigation I found next different. Then I ran from bash the vagrant ssh-config
out this:
Host default
HostName 10.0.3.212
User vagrant
Port 22
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/jenkins/workspaces/server/vagrant/.vagrant/machines/default/lxc/private_key
IdentitiesOnly yes
LogLevel FATAL
But then I ran from Jenkins job I got this
Host default
HostName 10.0.3.217
User vagrant
Port 22
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/jenkins/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
What did I do wrong?