Ticket #37 (closed enhancement: fixed)

Opened 6 years ago

Last modified 5 years ago

Buildbot config file tester

Reported by: bhearsum Owned by: warner
Priority: minor Milestone: 0.7.7
Version: Keywords: config
Cc: bhearsum@…

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 Download (509 bytes) - added by bhearsum 6 years ago.
buildbot config file tester
integrateConfigTester.diff Download (3.2 KB) - added by bhearsum 5 years ago.
integrate checkconfig.py into the runner
integrateConfigTester-v2.diff Download (3.3 KB) - added by bhearsum 5 years ago.
fix stupid indentation error
integrateConfigTester-v3.diff Download (4.0 KB) - added by bhearsum 5 years ago.
config file tester - works on windows

Change History

Changed 6 years ago by bhearsum

buildbot config file tester

comment:1 Changed 6 years ago 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..

comment:2 Changed 6 years ago 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..

comment:3 Changed 6 years ago by warner

  • Milestone set to 0.7.7

comment:4 Changed 5 years ago by warner

no progress on this yet, bumping to 0.7.8

comment:5 Changed 5 years ago 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.

Changed 5 years ago by bhearsum

integrate checkconfig.py into the runner

comment:6 Changed 5 years ago 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).

Changed 5 years ago by bhearsum

fix stupid indentation error

comment:7 Changed 5 years ago by bhearsum

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

comment:8 Changed 5 years ago 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.

comment:9 Changed 5 years ago 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.

comment:10 Changed 5 years ago 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.

comment:11 Changed 5 years ago 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.

Changed 5 years ago by bhearsum

config file tester - works on windows

comment:12 Changed 5 years ago by warner

  • Owner changed from bhearsum to warner
  • Status changed from assigned to new

excellent, thanks

comment:13 Changed 5 years ago by bhearsum

  • Cc bhearsum@… added

comment:14 Changed 5 years ago by warner

  • Status changed from new to closed
  • Resolution set to fixed

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

thanks!

Note: See TracTickets for help on using tickets.