From Bil.Kleb at NASA.gov Tue Jul 21 06:05:34 2009 From: Bil.Kleb at NASA.gov (Bil Kleb) Date: Tue, 21 Jul 2009 06:05:34 -0400 Subject: [Cruisecontrolrb-users] build trigger chaining (build same revision for entire chain) In-Reply-To: References: <4A172FE1.70900@NASA.gov> Message-ID: <4A6592EE.8000709@NASA.gov> Chad Woolley wrote: > > Check Project#build_if_necessary > It says: return build(source_control.latest_revision, reasons) > > This now hardcodes to build the latest revision. > > To accomplish what you want, maybe you could add a #revision_to_build > property on SuccessfulBuildTrigger, and use that instead of > latest_revision. This would be an API change to the trigger, though, > so you'd probably want to default to the latest revision if there was > no #revision_to_build property or it was nil. Thanks for the sketch. For posterity's sake, here's the hack we cobbled together: diff --git a/app/models/project.rb b/app/models/project.rb index 5784d2e..e6c23a6 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -210,7 +210,11 @@ class Project begin if build_necessary?(reasons = []) remove_build_requested_flag_file if build_requested? - return build(source_control.latest_revision, reasons) + revision = source_control.latest_revision + if (triggered_by.first.respond_to?(:revision_to_build) ) + revision = triggered_by.first.revision_to_build + end + return build(revision, reasons) else return nil end @@ -523,4 +527,4 @@ def plugin_loader.load_all end -plugin_loader.load_all \ No newline at end of file +plugin_loader.load_all diff --git a/app/models/successful_build_trigger.rb b/app/models/successful_build_trig index a768332..7816a79 100644 --- a/app/models/successful_build_trigger.rb +++ b/app/models/successful_build_trigger.rb @@ -40,6 +40,11 @@ class SuccessfulBuildTrigger @triggering_project = Project.new(value.to_s) end + def revision_to_build + number = last_successful(@triggering_project.builds).revision + SourceControl::Subversion::Revision.new(number) + end + private Regards, -- Bil Kleb http://fun3d.larc.nas.gov From Bil.Kleb at NASA.gov Thu Jul 23 09:35:03 2009 From: Bil.Kleb at NASA.gov (Bil Kleb) Date: Thu, 23 Jul 2009 09:35:03 -0400 Subject: [Cruisecontrolrb-users] Per Project disable_build_now? Message-ID: <4A686707.7050909@NASA.gov> Hi, From what I can tell via documentation and source, disable_build_now is only available for the entire CC.rb Configuration, not per project? (I want per project to make sure chained builds do not get short-circuited.) Thanks, -- Bil Kleb http://fun3d.larc.nasa.gov http://twitter.com/bil_kleb