Tuesday, April 08, 2008

Creating Nightly Builds with Anthill Pro

Hi There

From today on I will start to post a series of posts on AnthillPro.
Just implemented a nightly build for one of our workflows. Here is the main points:

  • Stamp strategy
You will want to copy or continuous integration workflow first. After doing so, you will want to change the stamp strategy. I used the following beanshell expression (put it all in one line):

NIGHTLY-build-${bsh:java.util.GregorianCalendar calendar = new java.util.GregorianCalendar(); calendar.add(java.util.Calendar.DATE,1); Date date = calendar.getTime(); new java.text.SimpleDateFormat("MM/dd/yyyy-HH:mm").format(date)}

This will create a stamp of the following pattern: "NIGHTLY-build-04/09/2008-19:38", you can change to suit your needs.
  • Cron schedule
Then you will need a cron based schedule. Go to System-Schedules and click at "create schedule" button. Then choose "Cron Expression Schedule". Then give it a name, "Nightly builds" might be a good one.
I'm not that expert in cron expressions, but that's the one I used: "0 0 3 ? * MON-FRI"
First 0 stands for 0 seconds, then 0 minutes, and 3 is the hour (3am), then not specifying the day of the month (with '?') and for last from monday to friday, as we don't usually work at weekends.

  • Trigger
The last thing is the workflow trigger, where we will associate with the schedule we create before. Choose for the type "Scheduled trigger", give it a name, select the "Nightly builds" schedule you create before and set any workflow property you might have. For example I have two property to execute or not the tests and to choose the branch.

Now just wait until 3am to see if works : )

In the next articles I will show:
  • How to create a workflow to build from the tag
  • How to run QTP (quick test professional) from anthill
  • How to best reuse jobs and workflow definitions
  • How to deploy resources for various environments using ant and anthill without duplicating files
  • and more... : )

1 comments:

Curt Yanko said...

Just what I was looking for! Good to see your blog.