Get build failure error message using teamcity in build step
Hi ,
we have functionality to get the build failure error message through the build notification which is logged by build ruuner by default. but I want to get the error message in build step which can be command line or Powershell.
By default notification we can get the build log using { build.buildLog.messages[1..] as message }. but I have created a custom configuration that I want to use to write-host that error message when the build failed due to any reason.
Any suggestions on things I should check? Thanks!
Thanks in advance.
Please sign in to leave a comment.
Hi Sunil,
If you want to report messages for a build log, you can use service messages. For example, to fail Command Line build step use the folloing message:
echo "
status='ERROR']"Please note that "Fail build if an error message is logged by build runner" box should be checked on the Build Failure Conditions page of a build configuration.
Thanks Alina for your suggestions.
I have point that at provided link the block contains the following details.
Reporting Messages For Build Log
You can report messages for a build log in the following way:
where:
This message fails the build in case its status is
and "Fail build if an error message is logged by build runner" box is checked on the Build Failure Conditions page of a build configuration. For example:But As I know this is only use to write their own custom errors in build logs. Build logs will contain the message whatever you mentioned in the
But with respect to your valuable time I want to get the error log which is originally occured when my source code compilation failed.
Thanks in advance !!
Could you please describe your use case in more details? What type of runner do you use? Please provide the current build log and what you expect to have in the build log.
Thanks again for your response..
I have a Project Build configuration which compile a Utilities project made in C# Dot Net. See the attached screen shot. This configuration have one more step which have only label that will print that Compilation has done .
After this configuration is over then it will start the new configuration build by dependency and here I want to check that previous configuration label have what value ( Set from the first configuration ). If I found a false value then it is sure that compilation of previous project is false. So I need to get that compilation error here which occurred at the time of previous configuration build run.
Attachment(s):
DB.png
From within the build script you can use REST API to get the build status and statusText based on the build id which you can reference via %dep.XXX.teamcity.build.id% reference in a parameter. Please vote for the related request in our tracker: https://youtrack.jetbrains.com/issue/TW-20776.
Thanks Alina for your support so far.
Let pointing to the exact thing what I needed. I have used these type of status text , users in two build changes, no of files between checkins although using the REST API in my dependency build configuration.
It will be good if there is any way to get the errors message of parent configuration in child configuration. That's it from my side.
Thanks if you can provide any further info.
Alina,
Did you get change to look on this further ?