This is a revision of a post I originally posted at the http://consultingblogs.emc.com/gracemollison/ but it’s quite useful until Atlassian get round to supporting windows as part of Jira Studio.
Jira Studio uses elastic bamboo as its build controller which in turn uses elastic agents (AWS ec2 instances that are spun up by the build controller to run the build) rather than the standard remote agents.
The Diagram from Atlassian below illustrates the Elastic Bamboo configuration:
You will need to have an Amazon AWS account and will have to create a custom windows AMI to be used to create your elastic-agents.. This post outlines what I did to get this working for a recent project. Please note that this is unsupported by Atlassian but hopefully they’ll be supporting windows soon.
Please note that this post assumes you have some basic knowledge of using AWS.
Start a Windows 2008 instance from an Amazon base windows 2008 AMI in the us-east-1 region. It needs to be in the US-East region as this is where Jira Studio expects to find the build agent.
All actions below are carried out from the instance you have started.
Turn off windows firewall
Install the latest JDK. (You will need tools.jar in your JAVA_HOME path hence why the JDK is required)
Install whatever components you need to be able to undertake a build e.g visual studio, msbuild, SDK’s etc and other bits
Use the link here as a guide : http://confluence.atlassian.com/display/BAMBOO/Creating+a+Custom+Elastic+Image
Set up the Amazon ec2 API tools as outlined in the Atlassian guide ( section 5.4). Specific guidance for windows can be obtained from the AWS documentation.
Check the version of Bamboo by clicking on administration then expand under system \ system information :
Scroll down to see the Bamboo version
Download the bamboo-elastic-agent that matches the version of Bamboo that is being used in Jira Studio: http://www.atlassian.com/software/bamboo/BambooDownloadCenter.jspa Make sure you click show all.
Create the folder c:\bamboo-elastic-agent . Unzip the bamboo-elastic-agent-2.6.2.zip to this folder.
Download the latest zip of ant from http://www.apache.org/dist/ant/binaries/ and unzip into c:\ant\
Download the latest zip of maven and unzip e.g into c:\ apache-maven-2.0.11
Set up environment variables and paths
Example Summary of relevant Environment variables ( depends on versions you have downloaded):
JAVA_HOME C:\Program Files\Java\jre6
Example path variables:
……. c:/ant\bin;C:\Program Files\Java\jdk1.6.0_23;c:\apache-maven-2.0.11\bin;C:\ec2-api-toolsbin;c:\bamboo-elastic-agent\bin
Create a batch file that consists of two lines:
Line 1: the Java classpath (This was obtained by using a simple Powershell script to scrape the lib folder under bamboo-elastic-agent and setting the result as a CLASSPATH variable)
Line2: This will run the actual elastic-agent
Note there are over a hundred jar files but to date Atlassian have been unable to let me know which ones are actually needed hence the snippet of the batch file I used rather than the full list.
java -server -Xms32m -Xmx512m -XX:MaxPermSize=256m -classpath %CLASSPATH% com.atlassian.bamboo.agent.elastic.client.ElasticAgentBootstrap 2>&1 > c:\bamboo-elastic-agent\bamboo-elastic-agent.log
Test that everything is set up okay by running the batch file interactively. You should see output similar to:
……… Java.io.FileNotFoundException: http://169.254.169.254/2008-02-01/user-data
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So
at java.net.URL.openStream(Unknown Source)
0 [main] INFO com.atlassian.bamboo.agent.elastic.client.ElasticAgentBootstrap –
Using tunnnelling. Registering ‘httpt’ and ‘httpst’ protocols.
577 [com.sun.sungrid.service.tunnel.server.TunnelServer] INFO com.sun.sungrid.service.tunnel.server.TunnelServer – Waiting for tunnel connection.
The key points are it trying to get userdata and attempting to create the tunnel. The agent needs to be started by the bamboo controller hence the errors
The agent needs to start automatically on starting the instance so the batch file needs to be wrapped as a service . The nssm works well https://iain.cx/src/nssm/
Set the service to start automatically:
Create an AMI based on this instance
Log onto Jira Studio and register the AMI, Set up the capabilities , test that it will spin up the instance and test a basic build .
Jira Studio recognises both Visual Studio and msbuild so you just need to add the paths in when setting up the capabilities: