Mykhaylo Adamovych
Mykhaylo Adamovych

Reputation: 20956

Teamcity to fail build with sane message

How could I fail build with sane message/status while running Command line build step?

Or course I can exit 1 in my script but I'll get ugly 'Exit code 1' as a build result.

Upvotes: 0

Views: 450

Answers (1)

Mykhaylo Adamovych
Mykhaylo Adamovych

Reputation: 20956

function fail_build {
    echo "##teamcity[buildProblem description='$1']" 1>&2
    exit 0
}

could be used in script like

cd ./logs
if grep -Pqr 'error text regex' *; 
then fail_build "There are errors in logs"; fi

More on TC documentation page.

Upvotes: 1

Related Questions