Jon
Jon

Reputation: 8531

Get Build Job URL in TeamCity Build Step

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.

Upvotes: 3

Views: 2109

Answers (1)

Fluffy
Fluffy

Reputation: 922

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

Upvotes: 7

Related Questions