David, That would indeed be a nice addition to the wiki. Or maybe even to the example directory. I'll add that somewhere over the weekend.
If you have other useful additions to the wiki i'm happy to add them. One thing though: the easiest way for the devs to add changes to the wiki is when you edit the wiki markup code of existing pages and send the whole files or attach it to a JIRA issue. New pages are also fine as a plain text file without the markup parts. The code looks like the main application logic (writing to the log file etc.) resides in the MainForm. It could be quite easy to pull the method to write the output out of the MainForm and make it more configurable (switching between console and/or logfile). I might try a few things later, but you are also welcome to contribute patches. Best regards, Daniel On Fri, 2011-01-21 at 17:23 +0000, David Taylor wrote: > Daniel, > > I took a look at the source code for the validator project and found > that it does return 0 for success and 1 for fail. So it can be used > for my purpose. I have done it in the ccnet.config file but you are > right you could use NAnt just as easily. The script segement I used > was: > > <tasks> > <exec> > <executable>C:\Windows\SysWOW64\cmd.exe</executable> > <baseDirectory>server</baseDirectory> > <buildArgs>/C IF EXIST CCNet-configValidation.log DEL > CCNet-configValidation.log</buildArgs> > </exec> > > <exec> > <executable>CCValidator.exe</executable> > <baseDirectory>server</baseDirectory> > <buildArgs>ccnet.config --nogui > --logfile=CCNet-configValidation.log</buildArgs> > <successExitCodes>0</successExitCodes> > </exec> > </tasks> > > <publishers> > <merge> > <files> > <file>server/CCNet-configValidation.log</file> > </files> > </merge> > <xmllogger /> > </publishers> > > The key bits are: > * to use the 'successExitCodes' attribute to ensure > the executable task can correctly detect the return value of 1 > as a fail code (by default windows treats this as a success). > * to merge the log file produced by ccvalidator into the ccnet > log file so the developer can view the output in > webdashboard if the ccvalidator fails. > * to delete any pre-existing ccvalidator log file to prevent > stale entries being displayed by webdashboard. > > Is it worth adding this to the example in your help > http://confluence.public.thoughtworks.org/display/CCNET/Configure > +CruiseControl.Net+to+Automatically+Update+its+Config+File? This > could be simplifed if you changed CCValidator to return negative value > on failure, and logged to the console if logfile was not specifed. > > If I can help with the changes, I would be happy to. > > Kind regards. > > David > > > > > Date: Fri, 21 Jan 2011 11:52:40 +0100 > > Subject: Re: [ccnet-user] CCValidator -nogui > > From: [email protected] > > To: [email protected] > > > > Quite some time ago i cobbled together a crappy version of an NAnt > > task that calls the validator and can be used to automatically > > validate the config and fail the NAnt build if it doesn't validate. > I > > never really finished it but it was working in my test setup. I can > > see if i can dig that up in my backup disk and look how i realized > it. > > > > Another thing that should still work is to call ccnet.exe > --validate. > > It is not as good as the Validator but it works. We could also patch > > the validator and make it return an error code if the config doesn't > > validate... > > > > Best regards, > > > > Daniel > > > > > > 2011/1/21 David Taylor <[email protected]>: > > > Daniel, > > > > > > Now I undertand. So the output always goes to the log file e.g.: > > > > > > C:\Program Files (x86)\CruiseControl.NET\server>type temp.log > > > 2011-01-21T09:59:36.8548909+00:00 Validating ccnet.config > > > 2011-01-21T09:59:37.7699433+00:00 Loaded project 'DfuzeDBUpgrader' > > > 2011-01-21T09:59:37.9749550+00:00 Internal validation passed > > > 2011-01-21T09:59:38.1489649+00:00 Configuration loaded (5.04s) > > > 2011-01-21T10:05:03.6745839+00:00 Validating ccnet.config > > > 2011-01-21T10:05:04.0996083+00:00 No loaded type is marked up with > a > > > ReflectorType attribute that matches the Xml node (BOLLOCKS). Xml > Source: > > > <BOLLOCKS /> > > > 2011-01-21T10:05:04.5966367+00:00 Loaded project 'DfuzeDBUpgrader' > > > 2011-01-21T10:05:04.7916478+00:00 Internal validation passed > > > 2011-01-21T10:05:04.9446566+00:00 Configuration loaded (4.31s) > > > 2011-01-21T10:05:45.1999591+00:00 The configuration file contains > invalid > > > xml: C:\Program Files (x86)\CruiseControl.NET\server\ccnet.config > > > 2011-01-21T10:07:42.4126632+00:00 The configuration file contains > invalid > > > xml: C:\Program Files (x86)\CruiseControl.NET\server\ccnet.config > > > > > > I was hoping to use CCValidator as a test for the CC.NET project I > use to > > > automatically update its config file as per > > > http://confluence.public.thoughtworks.org/display/CCNET/Configure > +CruiseControl.Net+to+Automatically+Update+its+Config+File. This > > > ensures the project reports failure if the config file contains > errors > > > rather than simply ignoring the new config which confuses my > developers. > > > > > > Is there a better way to fail the build if ccnet.config contains > errors than > > > using CCValidator? If not how do you get CCValidator to fail the > build when > > > it detects errors? > > > > > > Regards > > > > > > David > > > > > >> Date: Thu, 20 Jan 2011 17:11:57 +0100 > > >> Subject: Re: [ccnet-user] CCValidator -nogui > > >> From: [email protected] > > >> To: [email protected] > > >> > > >> IIRC there is a command line switch to make it write to a log > file. > > >> Have you tried -h or -? to get the command line help? > > >> > > >> Best regards, > > >> > > >> Daniel > > >> > > >> > > >> 2011/1/19 DavidATaylor <[email protected]>: > > >> > I have used cruise control for about 6 years. When I try to > run > > >> > ccvalidator from the command line, nothing seems to happen it > just > > >> > exits without even a return value. How do you know if it > succeeded or > > >> > not? This has happened in in the past on various systems but I > am > > >> > currently using: > > >> > > > >> > 64 windows server 2008 r2 > > >
