Question

I'm using Jenkins to achieve Continuous Delivery on some infrastructure projects. ATM Master-Slave Jenkins model is used where the jobs are always built by some some slave and not by the master, my intentions are to build and run test-kitchen and leibniz tests using LXC. All the requirements are matched vagrant-lxc, lxc boxes, leibniz and test-kitchen configured, everything works ok on my PC or any other of my team members but when it comes to run the Job through Master-Slave on Jenkins it seems there are some problems with environment, in details:

1- When I run as part of a build step "which lxc-create" it works and shows /usr/bin/lxc-create as it should but

2- When it runs kitchen test is fails showing:

+ kitchen test
-----> Starting Kitchen (v1.1.1)
-----> Cleaning up any prior instances of <default-ubuntu-1204>
-----> Destroying <default-ubuntu-1204>...
       Finished destroying <default-ubuntu-1204> (0m0.00s).
-----> Testing <default-ubuntu-1204>
-----> Creating <default-ubuntu-1204>...
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #create action: [Expected process to exit with [0], but received '1'
---- Begin output of vagrant up --no-provision --provider=lxc ----
STDOUT: 
STDERR: The `lxc` package does not seem to be installed or is not accessible on the PATH.
---- End output of vagrant up --no-provision --provider=lxc ----
Ran vagrant up --no-provision --provider=lxc returned 1]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details

It seems some environment variable is missing or something wired, It matters to say that sshing into the slave and building manually it works fine so is not a setup problem but a Master-Slave environment transmission problem or I'm missing something crucial on the configurations. Can anyone provide some help?

lxc version: 1.0.0

vagrant-lxc: 0.8.0

jenkins: 1.5.49

UPDATE 1: Here is my kitchen configuration:

---
driver:
  name: vagrant
  require_chef_omnibus: false
  require_chef_berkshelf: true
  customize:
      memory: 1024

provisioner:
  name: chef_solo

platforms:
  - name: ubuntu-12.04
    driver:
      box: "ubuntu-12.04"
      box_url: "http://dl.company.com/ubuntu1204-lxc-amd64.box"
      provider: lxc

suites:
  ....
Was it helpful?

Solution

Solved the issue!. The error message raised by Jenkins was wrong, I added Jenkins user to sudoers with NOPASSWORD and it worked just fine. I figured out because on my personal PC creating a container always asks for the sudo password.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top