Build Forge fail results in 0?
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.
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
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.