Chris Mendez in For Developers, Ruby, Tools for Software Engineers, Jenkins, Rake

Using Jenkins to Trigger Rake Tasks

This tutorial will show you how to install Jenkins on Linux Debian using VirtualBox and Vagrant. After you've installed Jenkins server, make sure you have both ruby and rake installed by typing:

Step 0 - Install Ruby and Rake

which ruby
which rake

Step 1 - Install Rake plugin

Once you have Jenkins running, visit and install the Rake plugin.

Step 2 - Create a new Job

Now it's time to visit to create a new scheduled job.

Create a new Task

Step 3 - Create a Task

Create a new file within /home/vagrant/.

vi /home/vagrant/Rakefile

Add a rake task within /home/vagrant/Rakefile.

task 'db:migrate' do
   puts 'Hello for Rake!'

Add a Rake Task

Step 4 - Invoke a Rake Task

Scroll down to the Build section and select Invoke Rake.

Select a Rake Task

Tell Jenkins where the Rakefile is located and what task to run.
Select a Rake Task

Step 5 - Manually Run the Task

Select "Build Now" to manually run the task.

Run Build Now

Double check the output by clicking on the log beneath "Build History"

Build output

Step 6 - Repeat as Needed

If you need to add more tasks, just follow steps 2 - 4 until you've completely automated yourself out of a chore.