Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Build Job URL in TeamCity Build Step

Tags:

teamcity

I have a Microsoft Teams webhook which will alert me when a TeamCity build has failed. I am wondering how I would be able to get the URL of the current TeamCity build so I can pass this information to my webhook.

like image 769
Jon Avatar asked Nov 26 '25 10:11

Jon


1 Answers

Only using parameters at hand, you could build the uri back to the build log: %teamcity.serverUrl%/viewLog.html?buildId=%teamcity.build.id%

If you're using a MessageCard, this would make the potentialAction field of the payload to something like:

"potentialAction": [
    {
        "@type": "OpenUri",
        "name": "View in TeamCity",
        "targets": [
            {
                "os": "default",
                "uri": "%teamcity.serverUrl%/viewLog.html?buildId=%teamcity.build.id%"
            }
        ]
    }
]

Anything fancier would require a call to the TeamCity REST API

like image 168
Fluffy Avatar answered Nov 29 '25 01:11

Fluffy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!