Buildbot and EC2

From CDOT Wiki
Revision as of 21:20, 5 December 2007 by Dominic (talk | contribs) (Tasks)
Jump to: navigation, search

Project Name

Buildbot and EC2

Project Description

The BuildBot is software for automatically building and testing other software. EC2 is Amazon's "Elastic Compute Cloud", a service that lets you run Virtual Machines on Amazon's computing grid using a web API. It would be awesome if BuildBot had an EC2 module, and could spawn Virtual Machines on-demand to perform tasks. Conveniently, BuildBot is written in Python, and there's a Python library for interfacing with EC2.

References: Amazon EC2 Basics For Python Programmers

Project Leader(s)

Adam Delyea

Project Contributor(s)

Project Details

Release 0.1

Goals

  • Add in a new build step to Buildbot
  • Allow Buildbot to connect with Amazon's EC2 service

Downloads

    EC2_build_step_nokeys.py

    Note: You will need to install the boto library located here.


About

Basically, this first version attempts to connect to an EC2 account, and then display the connection information to show that it has connected.

It uses a library called "boto", and this library is used to connect to all of Amazon's Web Services

To use this in a Buildbot configuration file, simply call the connect_to_ec2() function, which takes in as paramaters, an Amazon id key, and an Amazon secret key.

Example:

    connection = connect_to_ec2("73ghf9h38fh", "75vo87rVO*&V%O7o75v7i%i75I&5li7%i75")

Release 0.2

Goals

  • Start New Instances
  • Add new instances to build slave list
  • Start a build on an EC2 instance build slave

Downloads

    EC2BuildSlave.py     *Just put this file into your buildbot installation folder so python can access it
    Master.cfg

About

To use the EC2 service with Buildbot, there needs to be some way for Buildbot to dynamically generate a list of build slaves. These build slaves (or just slaves) are hosted as a virtual machine on the EC2 service.

This will work by extending the BuildSlave class to add in some new functionality for starting a new EC2 instance. So, every time you add a new slave to the slave list, another instance will be spwaned, so that you can spawn as many instances as you think you will need to complete a build.

This new BuildSlave class will start a new instance, which will then proceed to send the connection information of the master to the new instance. How exactly, I'm not exactly sure, because it takes a minute for the virtual instance to start up.

The rest basically takes care of itself.

Still have to think about how to turn the new EC2 instances off after the build is done.

0.2.1

About

I have made a slight modification to the EC2BuildSlave.
It now requires some additional input, because I had been hardcoding some values in, and thats sloppy, so I corrected it to allow you to put any variable parameters in the config file.
Basically, you will lay out a new EC2BuildSlave like this:

   from buildbot.EC2BuildSlave import EC2BuildSlave
   c['slaves'] = [EC2BuildSlave("bot1name", "bot1passwd", "public key", "private key", "dns", "instance-id")]
   //Where dns = www.whatever.com:8898, or 88.123.55.456:8898
   //and public/private key is your public/private key from Amazon
   //and instance-id is the instance you would like to launch ("ami-87d530ee")
Downloads
   The EC2BuildSlave.py goes into your python's framework folder for Buildbot (note: on my mac, this is
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/buildbot/)

Release 0.3

Goals

  • Build Mozilla using an EC2 Instance
  • Complete Documentation
  • Generic EC2 instance for Buildbot Slaves
  • Startup Scripts for making your own EC2 instances

Downloads

About

The main goal of this release is to make this project as useable and accessible to as many people as possible. Right now, the EC2 instance that is set up will only work for connecting to one server, because the build masters IP address is hard coded into the instance. There is a way of sending the build masters IP address to the instance at run time, so the instance can use the build masters IP address in the startup script.

I would also like to get a script written for people to use in their startup to allow the creation of custom EC2 instances that will have the same Buildbot functionality.

Also, can't forget the whole point to this project. Building Mozilla on EC2 Using Buildbot. Builds work now, so I don't see a reason why I wouldn't be able to use EC2 to build mozilla, but I guess we'll see.

Tasks

Task Details Priority Contributors Status Link(s)
Define new build step Add a new build step to the build master config file. The build step will be in an external file and imported into the build master config file. Done Adam Delyea   Writing New Build Steps
Connect To EC2 using Python Utilize the EC2 python library to connect to an account on the EC2 network. Once connected, display some information about the users account to prove it's actually connecting. Done Adam Delyea  
Start new instances Allow Buildbot to spawn an instance on demand. This could possibly be a function called right before the build slave list is populated, and would pass back an array of build slaves. Done Adam Delyea  
Add new instances to build slave list Allow newly created EC2 instances to be added to the build slave list.

After looking more closely at how the buildslave is created, this goal doesn't make any sense, since this is not really how the buildslave list works.

Cut Adam Delyea  
Start a new build on an EC2 instance Allow Buildbot to successfully start a build using a build slave on an EC2 instance Done Adam Delyea  
Load a script on startup in Linux Make it possible to have a script load when Linux starts Done Adam Delyea  
Testing People needed to download the revisions and test them to make sure it works in different environments. Note, this will require you to have your own EC2 account. Low NEEDED! ***
Dominic Baranski
Not Started  
Different Builds Need different projects to try and build, to make sure it works to build projects other than Mozilla Low NEEDED! ***
Dominic Baranski
Not Started  
Build Mozilla using an EC2 Instance Allow Buildbot to successfully build mozilla using a build slave on an EC2 instance In Progress Adam Delyea  
Complete Documentation In Progress Adam Delyea  
Generic EC2 instance for Buildbot Slaves Making a generic EC2 Instance for Buildbot In Progress Adam Delyea  
Startup Scripts for making your own EC2 instances In Progress Adam Delyea  

Contributions


*** Would you like to contribute? Well here's an excellent opportunity for you to do just that! Feel free to e-mail me at <awdelyea@learn.senecac.on.ca>


Project Resources

Project News

2007-09-17: Project claimed!

2007-10-11: Found a python EC2 library that has all of the functions I will need for interacting with EC2. Just need to write a custom build step to run these library functions.

2007-10-12: Release v0.1 is complete and available for download.

2007-10-12: Release v0.2 loosely defined. More detail to follow.

2007-11-17: Release v0.2 is complete and available for download: can start an instance and start an EC2BuildSlave

2007-11-21: Release v0.2.1 is complete and available for download: now to include variable EC2 users, and instances, and DNS'