diff --git a/nuget/psake-contrib.nuspec b/nuget/psake-contrib.nuspec index 758dec2..4eb3ad7 100644 --- a/nuget/psake-contrib.nuspec +++ b/nuget/psake-contrib.nuspec @@ -2,8 +2,8 @@ psake-contrib - 1.1.0 - James Kovacs,James Crowley,Rafal Klys,Artur Dorochowicz,Scott Banwart,Ales Roubicek,C-J Berg,Pepa Stefan + 1.2.0 + James Kovacs,James Crowley,Rafal Klys,Artur Dorochowicz,Scott Banwart,Ales Roubicek,C-J Berg,Pepa Stefan,Gary Ewan Park https://github.com/psake/psake-contrib false psake-contrib is a repository for scripts, modules and functions that are useful for running a build with psake. diff --git a/teamcity.psm1 b/teamcity.psm1 index 1182b1d..9804031 100644 --- a/teamcity.psm1 +++ b/teamcity.psm1 @@ -146,6 +146,16 @@ function TeamCity-ReportBuildStatus([string]$status=$null, [string]$text='') { TeamCity-WriteServiceMessage 'buildStatus' $messageAttributes } +function TeamCity-ReportBuildProblem([string]$description, [string]$identity=$null) { + $messageAttributes = @{ description=$description } + + if (![string]::IsNullOrEmpty($identity)) { + $messageAttributes.identity=$identity + } + + TeamCity-WriteServiceMessage 'buildProblem' $messageAttributes +} + function TeamCity-SetBuildNumber([string]$buildNumber) { TeamCity-WriteServiceMessage 'buildNumber' $buildNumber } diff --git a/tests/teamcity.tests.ps1 b/tests/teamcity.tests.ps1 index 5c69fbf..ac83c8f 100644 --- a/tests/teamcity.tests.ps1 +++ b/tests/teamcity.tests.ps1 @@ -218,6 +218,18 @@ Describe "TeamCity-ReportBuildStatus" { } } +Describe "TeamCity-ReportBuildProblem" { + It "Writes ##teamcity[buildProblem description='A problem occured.' identity='SOME_IDENTITY']" { + TeamCity-ReportBuildProblem "A problem occured." "SOME_IDENTITY" | ` + Should BeExactly "##teamcity[buildProblem description='A problem occured.' identity='SOME_IDENTITY']" + } + + It "Writes ##teamcity[buildStatus text='A problem occured.'] without optional identity attribute." { + TeamCity-ReportBuildStatus -text "A problem occured." | ` + Should BeExactly "##teamcity[buildStatus text='A problem occured.']" + } +} + Describe "TeamCity-SetBuildNumber" { It "Writes ##teamcity[buildNumber '1.2.3_{build.number}-ent']" { TeamCity-SetBuildNumber "1.2.3_{build.number}-ent" | `