travis-ci/travis-worker — pull request #97 by BanzaiMan (2014-09-11 01:49:33+00:00)
Title: Feature: Blue Box template selection based on "group" and "dist"

# Overview
This PR adds a major new feature where a user can specify `group` and `dist` in their `.travis.yml` to select a different (read "non-default") template available on Blue Box.

## Template selection criteria
For example, if there is a template with the name `travis-update-ruby-2014-09-10-12-34-deadbeef`, and the user selects a Ruby template **and** has `group: update` in `.travis.yml`, this template will be chosen. The intention here is to allow easier testing of the upcoming VM updates.

Furthermore, another parameter `dist` can be specified. If **both** `group` and `dist` are specified in `.travis.yml` (e.g., `group: update` and `dist: trusty`) and there is a template `travis-update-trusty-ruby-2014-09-10-12-34-deadbeef`, then this template will be selected. This allows a gentler rollout and opt-in for Trusty update.

## Caveat
Notice that `group` takes the precedence over `dist`. If a template has only one component between `travis` and the language name (`ruby`, `perl`, `node-js`, etc.), then the `group` parameter will be matched. In other words, if Trusty images are renamed to `travis-trusty-ruby-2014-09-10-12-34-deadbeef`, the user will have to *change* (!) their `.travis.yml`.

This is not ideal. The templates only have their description as metadata, and we match it with a regular expression and capture the components. If there is only one component, we cannot know _a priori_ whether that component should be classified as `group` or `dist`. You **can** pre-list names of allowed `dist` (or `group`) values, but that seems brittle.

I suspect we will need to revisit the naming convention (for example, use `current` as the default `group` value going forward).

## Specs!
This PR adds specs to the `BlueBox` class. (I tried using factory_girl to manage the fixtures, but could not quite figure it out. Suggestions welcome.)