puppetlabs/packaging — pull request #149 by MosesMendoza (2013-05-23 21:59:08+00:00)
Title: Managed builds, reworked

This PR sets up managed builds, but only for pl:jenkins:uber_build and pe:jenkins:uber_build. It builds on @branan's work, but takes a different approach. Rather than create new tasks and redefine existing ones, this PR modifies the affected tasks on the fly, based on if you have specified that the build is managed. It reorders some files to add 00_monkey_patches.rake, which includes two modifications to rake. The first is to add an instance variable to instances of the Rake::Task class - @count, which we will use to determine how many tasks a particularly rake task is going to kick off. The second is adding #unshift, an instance method that allows us to insert blocks for execution at the beginning of the existing Rake::Task @actions instance variable, which is an array of blocks that Rake will execute while executing a task. Rake::Task already provides #enhance, which appends to the array. We use these entry points to set set up pre- and post- calls to the build manager.

This PR also creates the BuildManager, a class that encapsulates the per-aggregate-job data and methods that the individual jobs use to post once they've completed. This enables a cleaner and less global handling of the data and behavior of managing the build, shared between the aggregate tasks and the tasks that make up its components.

This PR also adds a RakeUtils module that will be used to hold utilities we define for interacting with Rake tasks. It includes a find_task utility, which allows us to retrieve a Rake::Task object in our application by its name.