Teamcity property for current logged in user

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.


We also need the Teamcity property for current logged in user.

We have configured TeamCity so that CI runs unattended (of course) but that deployment only can be initiated by a person who has logged into Team City.  Not only do we need to prevent just anyone from deploying but we also need to track who is responsible for completing deployments.  We want to pass the currently logged in TeamCity user down to Ant to be included in logging.

Please help me find a way to make this happen.  Otherwise we are going to ask people to enter a "UserID" parameter when deploying.

Thank you.


Hi Jeremy

TeamCity is an client/server application. As on any website, there may be multiple users logged in simultaneously.

But you can find who triggered the build - install Groovy plugin and use its build.triggeredBy property.

Also, it's possible to restrict rights to run the deployment tasks by limited group of people - you'll need to move these build configurations into separate project, cleate new user group, and update permissions.



Thank you for your help Michael.

I followed the steps recommended at the link.
My server is Linux, so I downloaded to Windows, unzipped into a shared dir known to ftp.  Then, from Linux, I used ftp to connect, and 'get' the files (binary).  I put them where it was recommended.  I was not sure about having a .zip file in Lunix so I copied both the .zip file abd the .jar file that is inside the .zip file.  I then restared my server.

When I go into TeamCity Admin and edit a build step I cannot find the new fields implemented by the groovy plugin.  They do not appear in the drop down list for the Ant: Additional Ant command line parameters:.  So I got brave and just tried the following:  %build.triggeredBy% and %build.triggeredBy.username%.  Both give me an error: Unmet requirements: build.triggeredBy               exists or Unmet requirements: build.triggeredBy.username               exists.

Please tell me the details of how to make use of the groovy plugin.



Hi Joe

to install an external plugin to your TeamCity instance do the following:

  1. Copy zip-archive to <TeamCity Data>/plugins directory (do not unpack the archive)
  2. Restart TeamCity web server
  3. Go to Administration > Server Configuration > Plugins page
  4. Check the plugin has been added to the list.



Thank you for helping Michael.
What is <Team City Data> ?  I am not aware of such a directory.
My only plugins directory is under TeamCity/buildAgent/plugins.


Data Directory is a configuration store on TeamCity server, not on agents.
All the plugins should be deployed to this central location, and then they are distributed over the build agents automatically.



Please sign in to leave a comment.