15 June 2007

Perforce Implementation for CruiseControl.rb

While I haven't had a chance to clean up the code, folks have asked for it, so I'm making my Perforce implementation for CruiseControl available. There are some important notes:

  • You need to set up your project manually, you can't do an "add" via CruiseControl.
  • Some work needs to be done on the text retrieval for checkin messages, and how that's displayed on the CC.rb results pages.
However, so far it's been working fairly well for me. Feel free to use this as you need. I have not yet submitted it to the CC.rb folks, as I hadn't had time to clean it up yet. So, if you dial it in better, please do submit it to them, or send me your changes, and I'll submit it, etc.

To install/use it:
  • Put the perforce.rb file into your cruisecontrol/app/models directory.
  • Manually setup your project:

    • Create a directory under the cruisecontrol/projects directory.
    • Place a cruise_config.rb file in it. It should contain something like the following in order to use Perforce:
    Project.configure do |project|
    # Use Perforce for source control
    project.source_control = Perforce.new(
    :port => 'your.perforce.server:1666',
    :clientspec => 'clientspec-for-cruisecontrol',
    :user => 'buildusername',
    :password => 'builduserpassword',
    :path => '//depot/path/to/your/rails/app/...')
    end
    • Sync your code once.
    • Fire up CruiseControl, and let the games begin.
Usual disclaimer: I take no responsibility for your systems, code, etc. Read the code, test it out, backup your systems, etc.

Update: I've now given this an official home on GitHub. See the cruisecontrolrb_perforce project there. Fork at will, and please do send me Pull requests if you enhance the code, or at least tell me about your version, and I'll put that in the README or on the wiki, etc.

12 comments:

Joe said...

Is this still the latest version? Do you have a public SVN repository that this can be checked out from?

Ironically I came across your site by accident right before I started work on a similar plugin... so now I'm thinking I should just take a closer look at what you have before I try to re-invent the wheel.

Chris said...

Joe, yes, this is still the latest version. I'm not currently working on it. Please use it as you see fit, and if you enhance it or whatnot, let me know.

No SVN, it's just that version of the file up there. If I wind up working on it more in the future, I will do SVN for sure, and will post new info then.

Joe said...

Chris, thanks for the response. I'm going to try to integrate one of our Rails projects into CruiseControl.rb with your Perforce plugin early next week. At a minimum I will add some unit tests at that time; and possibly edit the existing code a bit if the need exists.

Trent Brown said...

Hey, Chris. Seeing that you'd written this Perforce plugin, I was inspired to switch from plain-old CruiseControl to the Ruby version the other day. It's chugging along nicely. Thanks for posting it. Now, if I could just get CCTray to work...

Cosmin Lehene said...

Hey Chris,

The perforce.rb file seems to be unavailable. Perhaps it would be good to send it to ThoughtWorks maybe they could integrate it.

Thanks,

Cosmin

Chris said...

I've fixed the link to the perforce.rb file above. Also, I've set up a page dedicated to this on my company site: Perforce support for CruiseControl.rb.

Unknown said...

Do you still have the preforce implementation of cruisecontrol.rb?

Chris said...

Thomas, thanks for asking. You motivated me to put this up on GitHub. So, now you can get ahold of it in my cruisecontrolrb_perforce project on GitHub. Do read the README for caveats. Also I'll update this blog post, or you can see my new official one on my company site here

Unknown said...

EXCELLENT! I just inherited a project with over a thousand tests and most we broke. One of the dudes on my team and I fixed them all. 10 minutes after I merged my fixes and all the tests passing, someone broke them. This will help out a ton. Thanks!

Chris said...

Thomas, that's great, glad to hear it and good job fixing all the tests! If you enhance the P4 code for this, do pass along anything that'd be good for others. Thanks.

Anonymous said...

Wanted to let you know I have updated a newer version here http://github.com/bcurren/cruisecontrolrb_perforce/tree/master. It has been fully tested on CruiseControl.rb and we implemented all the methods to parse changesets properly. You'll now find that the website and emails will correctly show all changesets since the last build.

Chris said...

Ben, this is great. I've been swamped, but I will update my page and other stuff to point people to yours.