2012-09-20 2 views
6

TeamCity에서 Powershell을 사용하여 빌드 로그에 메시지를 출력하도록하려면 어떻게합니까?TeamCity에서 Powershell 메시지를 인식하도록 하시겠습니까?

TeamCity 7.1을 사용하고 있습니다. enter image description here

스크립트는 다음과 같습니다 :

write-host "##teamcity[message 'Getting production info']" 

if ($LASTEXITCODE -ne 0) { 
    write-host "##teamcity[message 'Production Remote Not Found: Creating Remote']" 

    write-host "##teamcity[message 'Pushing to Remote']" 
    #git push production 

} else { 
    write-host "##teamcity[message 'write-output: Production Remote Found: Pushing to Remote']" 
    #git push production 
} 

내가 빌드 로그에 무엇입니까 유일한은 다음과 같습니다

[17:02:58]Skip checking for changes - changes are already collected 
[17:02:59]Publishing internal artifacts (1s) 
[17:03:00][Publishing internal artifacts] Sending build.start.properties.gz file 
[17:02:59]Clearing temporary directory: C:\BuildAgent2\temp\buildTmp 
[17:02:59]Checkout directory: C:\BuildAgent2\work\7669b6a04f96908d 
[17:02:59]Updating sources: agent side checkout 
[17:02:59][Updating sources] VCS Root: Portal Master 
[17:02:59][VCS Root: Portal Master] revision: c5c6a9a0d491ee2c64ce98e48b0d67c422237698 
[17:02:59][VCS Root: Portal Master] Resetting Portal Master in C:\BuildAgent2\work\7669b6a04f96908d to revision c5c6a9a0d491ee2c64ce98e48b0d67c422237698 
[17:02:59]Starting: C:\Windows\sysnative\cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -File C:\BuildAgent2\temp\buildTmp\powershell1349912883332714566.ps1 
[17:02:59]in directory: C:\BuildAgent2\work\7669b6a04f96908d 
[17:03:00] 
[17:03:00] 
[17:03:00] 
[17:03:00]Process exited with code 0 
[17:03:00]Publishing internal artifacts 
[17:03:00][Publishing internal artifacts] Sending build.finish.properties.gz file 
[17:03:00]Build finished 

답변

14

에서 설명한 바와 같이 여기

내 파워 쉘 빌드 단계입니다 documentation "message"서비스 메시지는 여러 개의 인수를 가질 수 있으므로 적어도 'text'인수를 지정해야합니다. "##teamcity[message text='Getting production info']"

스크립트는 http://confluence.jetbrains.com/display/TCD8/Build합니다 ([문서]에 따라,

write-host "##teamcity[message text='Getting production info']" 

if ($LASTEXITCODE -ne 0) { 
    write-host "##teamcity[message text='Production Remote Not Found: Creating Remote']" 

    write-host "##teamcity[message text='Pushing to Remote']" 
    #git push production 

} else { 
    write-host "##teamcity[message text='write-output: Production Remote Found: Pushing to Remote']" 
    #git push production 
} 
+1

1 @JoeYoung 난 그냥하지만,이 하나 맞았있어이 될 것이다 + Script + Interaction + + TeamCity # BuildScriptInteraction withTeamCity-ServiceMessages) 명시 적으로'text' 속성을 정의 할 필요는 없습니다. 이것은 * 단일 속성 메시지 *로 취급되며 작동해야합니다. 그러나, 그것은하지 않으며 '텍스트'를 사용하여 트릭을 않습니다. – James

관련 문제