Enabling or disabling a Listener on different build configurations or projects.
I currently have a listener that is running Globally on my TeamCity server. I want to try to add a setting that would allow me to toggle this on and off for Projects or build configs. Is there a way to do this?
Please sign in to leave a comment.
Are internal properties a good option for you? (https://www.jetbrains.com/help/teamcity/2019.1/configuring-teamcity-server-startup-properties.html)
You can obtain any internal property using the jetbrains.buildServer.serverSide.TeamCityProperties class
thanks for the response,
I would rather the solve be code based if possible. /not changing any internal properties.
Could you please explain what do you mean?
I am trying to have a check button on my projects that if you check it the listener looks at that specific project.
to be honest I dont know if you can direct listeners to certain projects but I think I have seen it being done before.
There is no such support out of the box, but you can implement it yourself.
For this, you need to store this setting using Project Features and then check the value of the setting in the listener.
do you know of any examples where SProjectFeatureDescriptor is being used? Also by changing the plugin settings to Project level settings does this mean that the plugin runs on a specific project? I am assuming so but the document never specifically states it.
Hi, for example it's used in the Invitations plugin https://github.com/JetBrains/teamcity-invitations-plugin/blob/master/teamcity-invitations-plugin-server/src/main/java/org/jetbrains/teamcity/invitations/InvitationsStorage.java
Plugins run on the server, for all the projects. But in the listener you can check settings of the project and execute your code only when Project Feature is configured.
thanks!