Building Windows 8.1 Store Apps with Elastic Bamboo

Elastic Bamboo for Amazon  EC2 and Windows 8.1Atlassian’s Elastic Bamboo service is a useful and flexible tool for automating the compilation and testing of source code checkins.  It runs builds on pre-configured Amazon EC2 machine images, automatically spinning up and spinning down EC2 virtual machines as necessary to keep costs low.  We’ve been using this tool extensively for an ongoing project and it has proved invaluable for helping manage software releases and providing a permanent mapping between source code and executable.

However, recently this project required a Windows 8.1 Store App to be added to the software suite.  Since Bamboo’s pre-configured EC2 image is based on Windows Server 2008, it is not possible to build a Windows Store app on this server.  Fortunately however, Elastic Bamboo allows you to change the EC2 machine image to a custom one if you have special requirements.

I won’t go through the whole process of how to create and map a custom image from scratch, as this is covered in Atlassian documentation and described in easy-to-follow step-by-step detail here.  However I’ll cover some of the primary divergence points specific to 8.1 Store Apps.

First, you need to create your EC2 server with a Windows Server 2012 R2 base AMI.  This is the only server release capable of building Windows 8.1 Store Apps, and Amazon is now (finally!) offering it to users as a base machine image.  Once it’s up and running I always create a new admin-level user with a known password so you don’t have to wait for the EC2 Administrator password randomizer to run each time you reboot (which can take a while).

Next, install Visual Studio Express.  I installed both the “Windows Desktop Edition” and the “Windows Edition”, since our server builds both desktop and store apps.  While it seems wasteful to install a full IDE on a build server just for the command-line tool, these packages provide single-click installs, are free, and then things just work.  It may be possible to build store apps without installing these tools, but there’s nothing pre-packaged from Microsoft to do so, so I highly recommend just taking this route.

Next, download and install the Windows 8.1 SDK.  This contains all the headers and libraries you need to build the store apps.  Note on the download site, it states that no command-line tool is included and recommends installing an IDE to gain this functionality as well.

Finally, in our case I needed to install an F# compiler (referenced here), and the WiX toolset, since our project has both of those dependencies.  Note there is no reason to install NuGet, as I’ve found it’s easier to add NuGet.exe to the repository and have it run in the build script as described here.

Once all these are installed, grab the latest version of msysgit, clone your repo and try to kick off a build.  If everything is set up correctly the build should succeed.

From here, follow the remaining documentation from Atlassian about setting up a build agent, creating an AMI, and configuring Elastic Bamboo to use it.  I usually skip the defrag and zeroing out of disk space since they take a long time to run and the cost savings is almost nothing.  Once all this is done, it’s time to take it for a spin.  Check in your Windows 8.1 Store App source code, and watch it build.

One additional note, Bamboo still defaults to the previous-generation EC2 hardware configurations, which are lower-powered and now more-expensive than current generation hardware.  So make sure to update Bamboo to use a current generation config by default.  I’ve found for my purposes a c3.large (compute-optimized) instance provides the best value.

1 Comment

One Response to Building Windows 8.1 Store Apps with Elastic Bamboo

  1. From looking at the BAM-13103 issue on Atlassians own tracker it appears this is still a very sought after solution. Have you thought about making the ami publicly available at all? Obviously your admin password would be a consideration!
    (Partially me being lazy here…)

Add your thoughts