Home > Enterprise >  How to get TeamCity Build Name?
How to get TeamCity Build Name?

Time:10-15

I have numerous builds setup in TeamCity under a project. This is one such build below: TeamCity General Settings

I am trying to use the "Name" under General Settings in PowerShell script which sends a message via a webhook to a MS Teams channel. I have tried looking everywhere to find someplace from which to pull this build name...system variables, etc. It seems as though there is a variable for everything in TeamCity except this name field. There is even an endpoint for the TeamCity API which I am using to pull the build status, but not for this. Does anyone have any ideas how I can get this build name field?

CodePudding user response:

@livetoski78 - Are you facing any issue related to incoming webhook while sending the card?

If yes, please follow below documentation: https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook

We are mainly responsible for Microsoft Teams app development related questions.

Please let us know if you still need any help.

CodePudding user response:

Using @mclayton's suggestion from the comments, I pulled the XML via PowerShell and saw there is a setting in there called:

%system.teamcity.buildConfName%

I was able to successfully use that to grab the build name without parsing the XML.

$buildName = "%system.teamcity.buildConfName%"

It was that simple once I know what it was called!

  • Related