Skip to content

Commit

Permalink
Merge pull request #19 from rauchmat/feature/teamcity_buildProblem
Browse files Browse the repository at this point in the history
Added support for service message "buildProblem"
  • Loading branch information
gep13 committed Apr 5, 2016
2 parents 784184a + 8c07d09 commit b181ff2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions teamcity.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,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
}
Expand Down
12 changes: 12 additions & 0 deletions tests/teamcity.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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" | `
Expand Down

0 comments on commit b181ff2

Please sign in to comment.