Reputation: 19395
Currently our devs all use a clone of a VirtualBox VM that's configured with a specific set of software, and we'd like to introduce Continuous Integration into our development stack.
We're looking at using Jenkins, and preferably we'd like to configure it to do the following:
I'm pretty sure we can get 1-4 working, it's steps 5 and 6 we're concerned with.
Is this achievable? And if so, how?
Upvotes: 1
Views: 1285
Reputation: 917
There are a bunch of Jenkins plugins designed precisely to deal with this scenario.
In particular, Jenkins has a fundamental concept of a slave executor and deals with the copying of files, remote triggering and collecting of results for you (that's actually the core functionality of Jenkins - dealing with the administrative overhead of running a large number of scheduled tasks across many machines). You don't really have to do anything other than starting the slave machine (provisioned with Vagrant in your scenario) and telling Jenkins that your build should be run on that specific slave.
Here's the relevant entry point to the documentation:
https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds
Upvotes: 0
Reputation: 15062
It's certainly possible, we've got a very similar set up in place.
Collecting results
In order to collect the test results you can take advantage of Vagrant's synced folders, i.e. run the tests on the VM in a directory which is synced to your host machine (where Jenkins is running in this case).
Reporting whether the test was successful or not
As I'm sure you know the Jenkins process just needs to exit non-zero in order to fail. The way we've got our tests set up is as follows:
vagrant ssh -c 'cd /synced-folder/ && grunt test-report --force && npm test'
Firstly we collect the results using Grunt. We just generated xunit XML reports (which we then publish as a post-build action). Notice that we --force
this so that we collect results even if we have failing tests. We then run the tests using npm test
. The npm test
process's exit code will be that which is used for the Jenkins job so if that fails so will the Jenkins job.
Upvotes: 1