Ticket #37 (closed enhancement: fixed)

Opened 2 years ago

Last modified 8 months ago

Buildbot config file tester

Reported by: bhearsum Assigned to: warner
Priority: minor Milestone: 0.7.7
Component: configuration Version:
Keywords: config Cc: bhearsum@mozilla.com

Description

This is a little script I wrote to test a master.cfg file without running Buildbot. It accepts an optional parameter of the configuration file, defaulting to 'master.cfg'. It returns 2 if the file does not exist, 1 if the configuration file is bad, and 0 otherwise.

Attachments

checkconfig.py (509 bytes) - added by bhearsum on 05/14/07 14:13:27.
buildbot config file tester
integrateConfigTester.diff (3.2 kB) - added by bhearsum on 12/28/07 10:06:50.
integrate checkconfig.py into the runner
integrateConfigTester-v2.diff (3.3 kB) - added by bhearsum on 01/18/08 06:28:39.
fix stupid indentation error
integrateConfigTester-v3.diff (4.0 kB) - added by bhearsum on 03/24/08 11:48:52.
config file tester - works on windows

Change History

05/14/07 14:13:27 changed by bhearsum

  • attachment checkconfig.py added.

buildbot config file tester

07/17/07 00:59:22 changed by warner

  • priority changed from major to minor.

hm, maybe we should build this into the 'buildbot' command? like, 'buildbot check-config master.cfg', and have it emit a message like "good config"/"bad config" in addition to the exit code? And if it sees a --quiet flag, set the exit code but don't emit the message?

source:buildbot/scripts/runner.py is the place where this would want to go..

07/27/07 23:17:37 changed by warner

hm, and maybe there's a way we could watch for warnings raised or messages that get put in the logfile while the config-checker runs..

09/29/07 01:45:12 changed by warner

  • milestone set to 0.7.7.

12/28/07 00:50:50 changed by warner

no progress on this yet, bumping to 0.7.8

12/28/07 08:04:19 changed by bhearsum

  • owner changed from warner to bhearsum.
  • status changed from new to assigned.

This totally fell off my radar. I'm working on it now, should be able to finish it in time for 0.7.7.

12/28/07 10:06:50 changed by bhearsum

  • attachment integrateConfigTester.diff added.

integrate checkconfig.py into the runner

12/28/07 10:13:59 changed by bhearsum

This patch integrates checkconfig.py into runner.py. It copies files to a temporary directory and checks the config from there. This means it will not mess up your working directory with subdirs or .pyc files.

If you have code that you import from a subdirectory it will not work. It _will_ work if you have subdirectories for code, config files, etc, and those files are symlinked back to the basedir. I didn't want to do a full copytree()...this would make it icky to run in an existing master's basedir (which could have subdirectories/logfiles that are hundreds of megs in size).

01/18/08 06:28:39 changed by bhearsum

  • attachment integrateConfigTester-v2.diff added.

fix stupid indentation error

01/18/08 06:29:10 changed by bhearsum

All of the unit tests pass (23 skipped) w/ integrateConfigTester-v2.diff

02/27/08 11:34:32 changed by bhearsum

The latest patch here will require Python 2.5, because of its use of 'finally'. I've got a version that doesn't use it, if you'd prefer that, let me know.

03/18/08 17:43:54 changed by bhearsum

The latest patch causes problems on Windows. It imports BuildMaster? buildbot.master so it can subclass master.BuildMaster? for the ConfigLoader?. I'm not sure there's any way to prevent twisted.internet.reactor from getting imported when doing this. I'll have a look at this soon, though.

03/22/08 18:02:48 changed by warner

Yeah, we need a version that's compatible with python2.3,2.4, and 2.5 to get this into trunk. Plus the windows reactor-import problem needs to be fixed.

To fix the latter, move most of the code off into a separate module, called buildbot/scripts/checkconfig.py . Then only import that module from buildbot/scripts/runner.py in the function that handles the "check-config" subcommand. That should remove the reactor-import from the top level and allow the other subcommands to work properly.

If you can fix this by tuesday, we'll get it into 0.7.7. If not, we'll get it in at the beginning of the 0.7.8 cycle.

03/24/08 11:48:31 changed by bhearsum

Alright, here's an updated patch. It passes all of the unit tests and even works on Windows. Nice bonus here is that checkconfig.py can be copied around or run manually in addition to 'buildbot checkconfig'.

I've tested this on Windows (Python 2.4) and Mac (Python 2.5). This version doesn't use 'finally' so I expect that it works with Python 2.3, too.

03/24/08 11:48:52 changed by bhearsum

  • attachment integrateConfigTester-v3.diff added.

config file tester - works on windows

03/25/08 11:45:53 changed by warner

  • owner changed from bhearsum to warner.
  • status changed from assigned to new.

excellent, thanks

03/25/08 12:24:53 changed by bhearsum

  • cc set to bhearsum@mozilla.com.

03/27/08 23:44:35 changed by warner

  • status changed from new to closed.
  • resolution set to fixed.

Applied, in [585]. My only change was to remove an unused 'file =' definition statement. I wrote up some quick docs too.

thanks!