I want to pass the teamcity username of the current logged in user to a build script called from teamcity, is there a property that has this? I didn't see one when I looked. It can't be a user specified property because I want it to be tied to their actual login so there is some sort of authentication of who they are.
2 Answers
I used properties %teamcity.build.triggeredBy% and %teamcity.build.triggeredBy.username%. These properties returns "John Doe" and "john.doe@user.mail". Using this values I can allow to run a build or not.
I've read that groovy plugin should be installed first to use these properties. But I can't check if I have it installed. I just do not have access to TeamCity administration settings.
The answer depends on what do you mean under the "current logged in user". Logged in where and why? In general TeamCity does not require to be logged on it in order to start a build. You can configure TeamCity to start a build on every commit to the specified VCS root, for example. In this case you can pass only name of the user, whose account is used for accessing the VCS root (%vcsroot.user%).
Another case, if you need a name of the windows user, under which account TeamCity build agent is running? If so, you can`t get it using TeamCity. You need to retrieve it inside of your build script.

- 2,641
- 2
- 26
- 24
-
1I mean the team city login and these builds aren't auto kicked off ever they are all manually run by a user as they do a deploy in this case. – jtruelove Nov 11 '10 at 21:55
-
1Clear. I see this value in my Windows Notifier on every manual build run. The name of TeamCity user, who triggered a build. I`ve found a property named ${build.triggeredBy.user.descriptiveName} in the notifier template file. But unfotunately, when I tried to use this property in my build configuration like %build.triggeredBy.user.descriptiveName%, it made my build configuration invalid and TeamCity was not able even to start a build. – s.ermakovich Nov 12 '10 at 15:56
-
It seems that this parameter is not supported by the build runner and it only exists in notification subsystem of TeamCity. My TeamCity version is 5.1.3 (build 13506). Anyway, I would recommend you to ask this question on the TeamCity forum. Believe, you will get a more qualified answer there. – s.ermakovich Nov 12 '10 at 15:57
-
1Yeah I asked the question on their forums, I'm just awaiting the reply. If they do I'll post the info here. In a few of the property dialogs they show you all the current properties defined but I've never seen anything that represents the logged in user. – jtruelove Nov 13 '10 at 00:34