It's all about the answers!

Ask a question

Build Forge fail results in 0?


Thomas Sceifers (11112) | asked Nov 20 '12, 1:41 p.m.
edited Nov 20 '12, 1:47 p.m.
Hello, everyone.  I'm trying to minimize my number of steps in my build forge projects and I've come across a problem.  If I have a statement that tries to perform an action, i.e copy B to A , but B doesn't exist I get an error and the step fails like expected.  However, if I have another command after that one and it performs correctly then the step passes.

What I would like to have happen is when there is an error or a failure that would normally produce a result of something other than 0 I want the whole step/project to fail out.

I've looked into setting/checking the %errorlevel% variable but I can't seem to make that work.  Truthfully I don't know if that's not working or the ability to tell build forge to quit if the error level neq 0.

Sample Code:

:DEV
If $TARGET_ENVIRONMENT == Development (
cd d:\bld\$BF_PROJECTNAME\$BF_TAG\$SVN_RELEASENUMBER\$TARGET_IISVIRTUALDIR
del Web.config
copy WebDev.config Web.config
)
:QA
If $TARGET_ENVIRONMENT == QA (
cd d:\bld\$BF_PROJECTNAME\$BF_TAG\$SVN_RELEASENUMBER\$TARGET_IISVIRTUALDIR
del Web.config
copy WebQA.config Web.config
)

So, if the TARGET_ENVIRONMENT = Development and it goes through that process, if webdev.config doesn't exist it produces an error, but then the QA value is checked and it resets the errorlevel back to 0, regardless of the equality.

One answer



permanent link
Thomas Sceifers (11112) | answered Nov 20 '12, 4:56 p.m.
I figured out a way around this.  I'm using Log Filters in Build Forge to parse through the step and check for errors and set fail based on that instead of the exit code.  It's not the cleanest way and involves a lot more work on my part, but it works and actually makes the log a lot easier to read for the users.

Comments
Spencer Murata commented Nov 27 '12, 12:55 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

I'm glad you were able to get a solution that works for you, but in general, it a better practice to make the steps as atomic as possible.  This allows for more modularity and will also benefit you if you need to restart the build.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.