Periodicaly 'full' build

View: New views
7 Messages — Rating Filter:   Alert me  

Periodicaly 'full' build

by Sebastian Nowak-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
I wonder if there is possible to do something like this:
- on every commit CC execute rake test
- once a day CC execute rake test:coverage

In my idea I want to do time-consumming artifacts not every commit.

Is this possible and make sense?

--
Pozdrawiam, Sebastian Nowak
http://blog.sebastiannowak.net
XMPP: seban@...
_______________________________________________
Cruisecontrolrb-users mailing list
Cruisecontrolrb-users@...
http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users

Re: Periodicaly 'full' build

by Alexey Verkhovsky-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Feb 21, 2009 at 10:35 AM, Sebastian Nowak <sebastian.nowak@...> wrote:
Hello,
I wonder if there is possible to do something like this:
- on every commit CC execute rake test
- once a day CC execute rake test:coverage

This sounds like a piece of logic that you can easily implement within the Rake build.

The idea with CC.rb is that it doesn't provide unusual fancy features - if you need them, you either put it in the build or hack the tool itself. It's rather simple, and written in an interpreted language. Therefore, easy to hack.

--
Alexey Verkhovsky
http://alex-verkhovsky.blogspot.com/
CruiseControl.rb [http://cruisecontrolrb.thoughtworks.com]


_______________________________________________
Cruisecontrolrb-users mailing list
Cruisecontrolrb-users@...
http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users

Re: Periodicaly 'full' build

by Bret Pettichord :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Another approach would be to create a separate project that ran the test:coverage rake task, no? This project could have a time-driven trigger. Or it might run only when the other project's task isn't running.

Bret

On Sat, Feb 21, 2009 at 1:32 PM, Alexey Verkhovsky <alexey.verkhovsky@...> wrote:
On Sat, Feb 21, 2009 at 10:35 AM, Sebastian Nowak <sebastian.nowak@...> wrote:
Hello,
I wonder if there is possible to do something like this:
- on every commit CC execute rake test
- once a day CC execute rake test:coverage

This sounds like a piece of logic that you can easily implement within the Rake build.

The idea with CC.rb is that it doesn't provide unusual fancy features - if you need them, you either put it in the build or hack the tool itself. It's rather simple, and written in an interpreted language. Therefore, easy to hack.

--
Alexey Verkhovsky
http://alex-verkhovsky.blogspot.com/
CruiseControl.rb [http://cruisecontrolrb.thoughtworks.com]


_______________________________________________
Cruisecontrolrb-users mailing list
Cruisecontrolrb-users@...
http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users




--
Bret Pettichord
GTalk: bpettichord@...
CTO, WatirCraft LLC, http://www.watircraft.com
Lead Developer, Watir, http://www.watir.com
Blog (Essays), http://www.io.com/~wazmo/blog
MiniBlog (Links), http://feeds.feedburner.com/bretshotlist
Training, http://www.watircraft.com/watir-training

_______________________________________________
Cruisecontrolrb-users mailing list
Cruisecontrolrb-users@...
http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users

Re: Periodicaly 'full' build

by Alexey Verkhovsky-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Feb 21, 2009 at 3:19 PM, Bret Pettichord <bret@...> wrote:
Another approach would be to create a separate project that ran the test:coverage rake task, no?

Sure, that could be another option.

--
Alexey Verkhovsky
http://alex-verkhovsky.blogspot.com/
CruiseControl.rb [http://cruisecontrolrb.thoughtworks.com]


_______________________________________________
Cruisecontrolrb-users mailing list
Cruisecontrolrb-users@...
http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users

Re: Periodicaly 'full' build

by Chad Woolley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Feb 21, 2009 at 12:32 PM, Alexey Verkhovsky
<alexey.verkhovsky@...> wrote:

> On Sat, Feb 21, 2009 at 10:35 AM, Sebastian Nowak
> <sebastian.nowak@...> wrote:
>>
>> Hello,
>> I wonder if there is possible to do something like this:
>> - on every commit CC execute rake test
>> - once a day CC execute rake test:coverage
>
> This sounds like a piece of logic that you can easily implement within the
> Rake build.
>
> The idea with CC.rb is that it doesn't provide unusual fancy features - if
> you need them, you either put it in the build or hack the tool itself. It's
> rather simple, and written in an interpreted language. Therefore, easy to
> hack.

I looked at the source briefly.  You'd have to make a custom trigger
that ran only periodically, I think?

Does anyone have code to do this?  I think Jeremy mentioned it once...
_______________________________________________
Cruisecontrolrb-users mailing list
Cruisecontrolrb-users@...
http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users

Re: Periodicaly 'full' build

by ManfredU :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, 21 Feb 2009 22:09:32 -0700
Chad Woolley <thewoolleyman@...> wrote:

> On Sat, Feb 21, 2009 at 12:32 PM, Alexey Verkhovsky
> <alexey.verkhovsky@...> wrote:
> > On Sat, Feb 21, 2009 at 10:35 AM, Sebastian Nowak
> > <sebastian.nowak@...> wrote:
> >>
> >> Hello,
> >> I wonder if there is possible to do something like this:
> >> - on every commit CC execute rake test
> >> - once a day CC execute rake test:coverage
> >
> > This sounds like a piece of logic that you can easily implement
> > within the Rake build.
> >
> > The idea with CC.rb is that it doesn't provide unusual fancy
> > features - if you need them, you either put it in the build or hack
> > the tool itself. It's rather simple, and written in an interpreted
> > language. Therefore, easy to hack.
>
> I looked at the source briefly.  You'd have to make a custom trigger
> that ran only periodically, I think?
>
> Does anyone have code to do this?  I think Jeremy mentioned it once...

I had a similiar need and created my own scheduler using
rufus/scheduler.  I did setup a separate project for the full rebuild
which uses this scheduler:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project-specific configuration for CruiseControl.rb

Struct.new( "RebuildDef", :cronline, :type )  #type = :full or :quick

Project.configure do |project|
 
  # // Build the project by invoking rake task 'custom' _OR_ by invoking shell script
  project.rake_task = 'cruise'
 
  build_defs = [ Struct::RebuildDef.new( '0 12 * * 1-6', :quick ),
                 Struct::RebuildDef.new( '0 23 * * 1-6', :quick ),
                 Struct::RebuildDef.new( '0 12 * * 0',   :full  )  ]
                         
  project.scheduler = CronScheduler.new( project, build_defs )

end
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



cruisecontrol/lib/builder_plugins/cron_scheduler.rb
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
require 'rubygems'
require 'rufus/scheduler'

class CronScheduler

  def initialize(project, build_defs)
    @project = project
    @last_build_loop_error_source = nil
    @last_build_loop_error_time = nil
   
    @build_defs = build_defs
  end

  def run
    scheduler = Rufus::Scheduler.new()
    scheduler.start
   
    @build_defs.each do |build_def|
      puts "Creating cron job #{build_def.cronline} #{build_def.type}..."
      scheduler.schedule(build_def.cronline) do
        puts "Job #{build_def.cronline} #{build_def.type} running..."
        begin
          ENV['CC_BUILD_TYPE'] = "#{build_def.type}"
          case build_def.type
          when :quick  # Quick build if new revision available or build requested
            @project.build_if_necessary
          when :full   # Compulsory full rebuild
            @project.remove_build_requested_flag_file if @project.build_requested?
            @project.build(@project.source_control.latest_revision, ['Scheduled full rebuild'])
          end
          clean_last_build_loop_error
          throw :reload_project if @project.config_modified?
        rescue => e
          log_error(e) unless (same_error_as_before(e) and last_logged_less_than_an_hour_ago)
        end
      end
    end

    scheduler.join    
  end
 
  def same_error_as_before(error)
    @last_build_loop_error_source and (error.backtrace.first == @last_build_loop_error_source)
  end
 
  def last_logged_less_than_an_hour_ago
    @last_build_loop_error_time and @last_build_loop_error_time >= 1.hour.ago
  end
 
  def log_error(error)
    begin
      CruiseControl::Log.error(error)
    rescue
      STDERR.puts(error.message)
      STDERR.puts(error.backtrace.map { |l| "  #{l}"}.join("\n"))
    end
    @last_build_loop_error_source = error.backtrace.first
    @last_build_loop_error_time = Time.now
  end

  def clean_last_build_loop_error
    @last_build_loop_error_source = @last_build_loop_error_time = nil
  end
 
end

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -





_______________________________________________
Cruisecontrolrb-users mailing list
Cruisecontrolrb-users@...
http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users

Re: Periodicaly 'full' build

by Chad Woolley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Feb 27, 2009 at 7:40 AM, Manfred Usselmann
<usselmann.m@...> wrote:
> I had a similiar need and created my own scheduler using
> rufus/scheduler.  I did setup a separate project for the full rebuild
> which uses this scheduler:

This is nice, thanks.  I'd like to see something like this included in
cruise itself.  Not sure if Alexey would want to freeze the scheduler
gem into cruise.   If not it could be a simple specific-hours and/or
minute-interval-based schedule.  This should handle most cases, I
doubt everyone needs full cron-level granularity of control.

-- Chad
_______________________________________________
Cruisecontrolrb-users mailing list
Cruisecontrolrb-users@...
http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users