Pswadi/buddy approval for release

The tag / SHA specified in the deploy will be used for checking if the same deploy to another production stage was already approved in last 4 hours. If so, the buddy will be "carried forward" for the new stage.   BUDDY_CHECK_GRACE_PERIOD decides how long we want to search for.

This does not start the queued up deploys, yet.

/cc @zendesk/samson @grosser @steved555 

### References
 - Jira link: 

### Risks
 - Buddy approval anomalies?
period should be 4.hours, and then we can do period.ago

On Thu, Oct 30, 2014 at 4:11 PM, Praveen Swadi <notifications@github.com>
wrote:

> In app/models/deploy_service.rb:
>
> > @@ -31,6 +31,25 @@ def auto_confirm?(stage)
> >      !BuddyCheck.enabled? || !stage.production?
> >    end
> >
> > +  def latest_approved_deploy(deploy)
> > +    Deploy.where('reference = ? AND buddy_id is NOT NULL AND started_at > ?', deploy.reference, (Time.now - (BuddyCheck.grace_period*60*60)))
>
> @princemaple <https://github.com/princemaple> i think with MG's
> suggestion, grace_period.hours.ago, it will be obvious. Correct?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/zendesk/samson/pull/182/files#r19643016>.
>