Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,302
Community Members
 
Community Events
184
Community Groups

fail the build from a script inline

I have a C++ CMake project that after running unit tests using CMake I also would like to run couple of automated integration [smoke] tests. This is where the "Script Task" comes in handy. For example, we know that the correct default run of one of our algorithms should produce a specific MSE. Therefore I write an integration test using "Script Task" with the following:

./debug/my_ml_algorithm 2> out && grep "\[info\] mse\=1\.99624e-05" out

And this works fine, however, if the line is not matched and therefore grep produces a non-zero exit value the build will fail but it will not indicate that this Script Task named "Integration Test #1: my_ml_algorithm default run" has failed, instead Bamboo shows that the build failed with error "No failed tests found, a possible compilation error occurred." How can I make the Script Task "inform" Bamboo that this integration test is responsible for the failed build?

1 answer

3 votes
Gretchen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 16, 2013

I would probably parse the output and stick an evaluation in there which sets the exit value to "0" if it is an acceptable result. I do this with robocopy results that are not 0 but are not failures.

I don't know what you're scripting in but something like this should work:

:error rem eval results in a fail
exit 1;
:end rem eval results in a success
exit 0;

To forcely fail a bamboo build, use this one-liner script command (in a bamboo script task with PowerShell interpreter).

throw "your test custom message."

just try this, run your build and it will fail with this message in the logs :) 

 

in my case, i use:

 

$myPath = "C:\just1\just2"

if(Test-Path $myPath)
{
Write-Host "Sent fail trigger to bamboo" throw "your test custom message." }

 

 

HOPE THIS IS YOUR ANSWER :)

 

 

Like Bharath likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events