Figuring out if a build has failed programatically

108 views
Skip to first unread message

Jeffrey Becker

unread,
Sep 18, 2012, 11:03:06 AM9/18/12
to psake...@googlegroups.com
I'm working on a workflow activity & team foundation server build process template for executing a psake script as the build.  Right now the powershell invocation seems to be returning what is effectively a list of strings.  Does anyone have suggestions on how I can detect a failed build and more importantly figure out which task has failed and extract any failure information?

Ian Davis

unread,
Sep 20, 2012, 4:21:02 PM9/20/12
to psake...@googlegroups.com
You should be able to check the $LastExitCode to see if the build failed. I don't think there is any built-in way to see what happened unless you want to return custom exit codes.

-Ian

On Tue, Sep 18, 2012 at 8:03 AM, Jeffrey Becker <jeffrey....@gmail.com> wrote:
I'm working on a workflow activity & team foundation server build process template for executing a psake script as the build.  Right now the powershell invocation seems to be returning what is effectively a list of strings.  Does anyone have suggestions on how I can detect a failed build and more importantly figure out which task has failed and extract any failure information?

--
You received this message because you are subscribed to the Google Groups "psake-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/psake-users/-/OFQd2p1KuosJ.
To post to this group, send email to psake...@googlegroups.com.
To unsubscribe from this group, send email to psake-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/psake-users?hl=en.

James Dawson

unread,
Sep 21, 2012, 4:57:25 AM9/21/12
to psake...@googlegroups.com
Hi Jeffrey,

A colleague just finished writing one for the project we're working on, he has an initial blog post about his experiences here:


Maybe have a read of it and post a comment for anything specific you're interested in that he doesn't cover? 

We would like to open source this, but I'm not sure of the time-frame, so that might not be too helpful for you

Cheers,
James. (@James_Dawson)

Peter Seale

unread,
Sep 27, 2012, 7:40:52 PM9/27/12
to psake...@googlegroups.com
When faced with this problem, I did a C- solution and called psake and inspected the exit code in TF build. There are good instructions for this at


From what I skimmed of James' linked blog post, it looks like a much better solution.

I would not recommend adding anything to psake. 

--
You received this message because you are subscribed to the Google Groups "psake-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/psake-users/-/MbSFwVLdj8YJ.

Rory Street

unread,
Sep 28, 2012, 5:26:02 AM9/28/12
to psake...@googlegroups.com, pe...@pseale.com
Hi,

Just discovered this group from my colleague James.

As I discovered the WorkflowCentralLogger appears to be key in getting rich build information back. One thing you can also do and I'm not sure how much people would frown on this. I call PSAKE using a custom activity created in C# using a RunspaceFactory I append some powershell script at the end to raise a custom error in powershell with the $LastExitCode . You can catch this custom error in C# and extract the exit code or you can let it bubble up into the workflow and catch it there. 

Rory
Reply all
Reply to author
Forward
0 new messages