Missing information about compilation error when aborting MSBuild in build step

I would like to abort my build in the build step as soon as the first error occurred. Unfortunately, I did not find a direct solution in MSBuild. Therefore, I wrote my own script which stops the MSBuild on the first error. In such a case, some information about the compilation error are not present in the email notification. For example the name of the project file (.vcxproj) in the header and the list of compilation errors at the end. I assume, these are the variables "var.buildShortStatusDescription" and "var.compilationBean" from the (default) email template build_failed.ftl.
So, how and when are the values for these variables set? And does the MSBuild have to run until the end in order to get this information?

Thank you for your help

0
2 comments

Hi Julia,

 

the parameters are filled by the build processes, and it usually requires the build step at the very least to finish, sometimes the full build itself. For some of the fields you should be able to send messages through the service messages api: https://www.jetbrains.com/help/teamcity/build-script-interaction-with-teamcity.html, but without knowing how your script works it's hard to know whether this will help.

 

The usual recommendation if you want to finish builds earlier than usual, is that you use some of the build failure conditions, such as finding a specific text in the build log. That combined with making the build steps and configurations as small as possible and setting them to only run if the previous steps are successful helps in reducing the amount of agent time spent on builds that will fail.

 

Hope this helps.

0
Avatar
Permanently deleted user

Hi Denis,

Thank you very much for your answer! And sorry for the late response from my side.

I solved my issue by just waiting until the build status is set to "FAILURE" and then stop the build step. Like this, I also get the missing informations from above.

0

Please sign in to leave a comment.