wyBuild in a CI environment

Today, I just started integrating wyBuild into my continuous integration environment and am running into something peculiar.

First, heres a brief description of the CI setup: I'm using TeamCity to monitor a SVN repository for changes. It then kicks off a few NAnt scripts to do the build, unit tests, compile a setup program (NSIS) and deploy to AWS/S3.

I inserted a new step in the CI process to invoke wyBuild.exe with my .wyp project, /bu and /bwu as command-line arguments. You'll notice I don't have an -add yet, I'll be working on that next.

Here is the specific NAnt call if you're interested:<exec program="wybuild.exe" commandline="tzchanger.wyp /bu /bwu" workingdir="Update" basedir="${environment::get-variable('WYHome')}" />

When this tasks kicks off, everything seems to be running as expected and the following is output to stdout:[22:07:27]: [exec] wyUpdate built successfully.[22:07:28]: [exec] Updates built successfully.

However, wyBuild doesn't terminate. Task manager shows the wybuild process using 98 - 100% CPU. I've let the app sit for about 10 minutes with out it terminating.

A thread dump of wyBuild in this state shows:Thread id=1972 priority=8 state=Wait reason=UserRequest at [Internal thisFrame, 'M-->U', System.Windows.Forms.UnsafeNativeMethods::PeekMessage] at System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(System.Int32 dwComponentID, System.Int32 reason, System.Int32 pvLoopData) at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(System.Int32 reason, System.Windows.Forms.ApplicationContext context) at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(System.Int32 reason, System.Windows.Forms.ApplicationContext context) at System.Windows.Forms.SendKeys.Flush() at System.Windows.Forms.SendKeys.Send(System.String keys, System.Windows.Forms.Control control, System.Boolean wait) at System.Windows.Forms.SendKeys.SendWait(System.String keys) at wyBuild.Program.Main(System.String args)

Now, I will say that I can invoke the nant script on the build machine interactively and wyBuild does it's thing and terminates gracefully in under a second. So, I think the issue is when wyBuild is running in an environment without a shell or windowing service; such as a NT service.

On a side note, when I installed wyBuild on the build machine today, the installer asked for my key. When I ran wyBuild, it didn't recognize that I had already entered the key and wanted me to enter it again.

Hey Pat,

You're right, this is a bug. It should exit immediately after printing "Updates built successfully."

I'm having trouble reproducing this problem. How is your server configured to execute the files without an interface. That is, could you give a simple way to reproduce the problem on a VM instance? Or can this only be reproduced with TeamCity?

On a side note, when I installed wyBuild on the build machine today, the installer asked for my key. When I ran wyBuild, it didn't recognize that I had already entered the key and wanted me to enter it again.

That's a bug. Thanks for spotting it - we'll have that fixed.

I'm having trouble reproducing this problem. How is your server configured to execute the files without an interface. That is, could you give a simple way to reproduce the problem on a VM instance? Or can this only be reproduced with TeamCity?

I've tried a couple different ways to reproduce this; launching from a scheduled task and even writing a small windows service, everything seems to work flawlessly. So, I feel your pain with not being able to reproduce this problem.

Later today, I'm going to try wrapping wyBuild in a NAnt script (inside of the above-mentioned service) and see if NAnt is our culprit. If that doesn't reproduce the problem, then we may have to chalk this up to something that's specific to the way team city does process invocation.

Fortunately, most of the CI software I'm using is opensource or freeware (SVN, TeamCity, NAnt, NSIS). If you'd like, I could build out a VM image for you that mimics my environment (what VM software are you using?)

That's a bug. Thanks for spotting it - we'll have that fixed.

Thanks for looking into it 🙂

If you'd like, I could build out a VM image for you that mimics my environment (what VM software are you using?)

We use VMWare primarily, but Virtual PC and Virtual Box are fine as well.

Although it might be easiest if you could come up with a simple step-by-step to reproduce the environment.

I spent a good part of this weekend trying to come up with the steps to duplicate the problem. After significant hair loss, I've decided to chalk this up to something specific to my environment.

I've rebuilt the environment in a VM and it all seems to work. If you're interested, I posted the steps at the bottom. For now, I'm going to try monkeying around with my environment to see if I can determine what the problem is. Last resort is to rebuild it.

Thanks for your attention to this, but for the moment it appears to only be reproducible in my environment.

To create a test environment: 1) Install Windows Server 2003 R2 x64 2) Install Tortoise SVN 3) Install NAnt 0.9 4) Install TeamCity 5.1.2 5) Install wyBuild 6) Create a local SVN repository (C:\svnrepo) 7) Create a working copy folder (C:\test) and checkout a copy of the repository to is 8) Create a text file in the working copy (name and content don't matter) 9) Login to TeamCity and create a project 10) Create a build configuration a) Enter a name and click "VCS Settings" b) Click "Create and attach new VSC root" c) Enter a name for the svn repository (ex: local) d) Type of VCS: Subversion e) URL: file:///c:/svnrepo/ f) Click "Save" g) Click "Choose Build Runner" h) Build runner: NAnt i) Path to a buld file: default.build j) NAnt home: replace with path to the NAnt bin folder (ex: C:\NAnt\nant-0.90-beta1\bin) k) Click Save l) on the right-hand side click #4 Build Triggering m) Click "Add new trigger" n) Trigger type: VCS Trigger o) click save 11) Create the NAnt script. In the working folder (C:\test) create a blank file called default.build and insert the contents of the below NAnt build script. 12) Create a wyBuild project file (test.wyp) and place in the working folder (C:\test) 13) Commit and watch TeamCity run

----- Begin Default.build ------<?xml version="1.0"?><project default="all"> <target name="all"> <exec program="wybuild.exe" commandline="test.wyp /bu /bwu" basedir="C:\Program Files (x86)\wyBuild" /> </target></project>

Thanks Pat. I'll work on reproducing the problem later today.

I haven't re-created this environment yet. But can you test wyBuild 2.5.25 and see if the problem is fixed?

I haven't re-created this environment yet. But can you test wyBuild 2.5.25 and see if the problem is fixed?

Looks like it works, awesome! 🙂