PDA

View Full Version : How do you choose a failure step?


ambalboa
07-05-2007, 09:18 AM
I would like to create a failure step for a checkout step, but I am not sure how to do that. I have mulitiple checkouts happening in my project, not one after the other. Do I need to create a seperate undo checkout failure step, and set it up as if it were a checkout step? Meaning, declare the branch, repository and files that were checked out but instead of selecting the checkout command, I choose uncheckout? If that's the case, then I do need one for each checkout performed, right? Is there a way to make one failure step for all checkouts? Can two or more but not all failure steps be build when one action step fails.

Also, if an action step fails and that action step is grouped with other steps with the 'Group' action step, would I only need to declare the failure step on the 'Group' step to have each step in the group build that failure step? Every failure step is checked to be build, but if a certain step calls for just one failure step to be build, then only that one step is build while the others are ignored, right? Could there be a conflict when an action step and failure step have a condition build rule, as in, which has the higher priority? Do both of them need one to ensure that the specified failure step is build? Certain steps like '"Group' steps never fail, I assume, so do I need to declare a failure step for every single step, so that not every failure step is build?

Is there a way in which a failure step can be build by evaluating if a certain step has been build? I'm guessing it can be done with a build rule written in vbscript, but how? Thank you for your time and help.

kinook
07-05-2007, 12:00 PM
Originally posted by ambalboa
I would like to create a failure step for a checkout step, but I am not sure how to do that. I have mulitiple checkouts happening in my project, not one after the other. Do I need to create a seperate undo checkout failure step, and set it up as if it were a checkout step? Meaning, declare the branch, repository and files that were checked out but instead of selecting the checkout command, I choose uncheckout? If that's the case, then I do need one for each checkout performed, right? Is there a way to make one failure step for all checkouts? Can two or more but not all failure steps be build when one action step fails.
Include an undo checkout step in your failure steps which conditionally builds only if the failed step was a checkout step, and have it use the properties of that failed step to undo what was checked out.

Also, if an action step fails and that action step is grouped with other steps with the 'Group' action step, would I only need to declare the failure step on the 'Group' step to have each step in the group build that failure step? Every failure step is checked to be build, but if a certain step calls for just one failure step to be build, then only that one step is build while the others are ignored, right? Could there be a conflict when an action step and failure step have a condition build rule, as in, which has the higher priority? Do both of them need one to ensure that the specified failure step is build? Certain steps like '"Group' steps never fail, I assume, so do I need to declare a failure step for every single step, so that not every failure step is build?
The failure step(s) that are built when a step fails are based on the failed step's failure properties.
http://www.visualbuild.com/Manual/stepproperties.htm

Is there a way in which a failure step can be build by evaluating if a certain step has been build? I'm guessing it can be done with a build rule written in vbscript, but how? Thank you for your time and help.
Yes, using a conditional build rule.
http://www.visualbuild.com/Manual/buildrules.htm
http://www.visualbuild.com/Manual/scriptexpressions.htm
http://www.visualbuild.com/Manual/objectmodel.htm

ambalboa
07-09-2007, 12:46 PM
Thanks.

I was able to write some vbscript and it doesn't give me an error. However, I would like for it to skip undo checkouts failure steps in which the checkout and checkin from a repository were done successfully. This is the build rule that I created:

[FECheckout = 1 And FECheckin = 0 Or FECheckout = 0] is true

FECheckout is a function that I defined on the Global tab pane in the Script Editor, shown below:

Function FECheckout
If Step.BuildStatus = vbldStepStatSucceeded Then
FECheckout = 1
Else
FECheckout = 0
End If
End Function

Function FECheckin
If Step.BuildStatus = vbldStepStatSucceeded Then
FECheckin = 1
Else
FECheckin = 0
End If
End Function

I wrote this for each checkout and checkin done. When the checkout and checkin action steps are build, they call the FECheckout and FECheckin functions, respectively. I just write on the Step tab pane in the Script Editor 'FECheckout' for the checkout action step, etc. However, it builds all the undo checkout failure steps instead of skipping the ones that checked out and in successfully or that were not build because they didn't have the chance. Is that the way it should work? The failure steps are build, but nothing is unchecked for those that should be skipped. I would like for it to undo checkouts when a checkout fails or when a checkout is done but a step fails before it is checked back in. I'm think the vbld_StepDone() function is needed, but I'm not sure how it works. Thanks again.