How to set bean property value in custom trigger web UI

Hi,

I am building a custom trigger in Team City (v 5.1.3, build 13506).  I have a database holding specific information, and the idea is that if a row exists in this database, I want to force a build.  Parameters are handled dynamically later on.  So the custom trigger is meant to select which product the user wants to "monitor" from the database.

I can get the value (project of Records, IMOS, etc.) out of the basePropertiesBean and I know the value is being handled appropriately from the web ui.  However, the property bean is never set.  Any thoughts?

I have attached the files here.

I have a property on bean id "dashboardTriggerBean" that is not being set.  When this is set properly, I'll see the database queries in the logs working correctly.  However, they remain as the empty string (from the bean context file).

Thanks!



Attachment(s):
teamcityplugin.zip
5 comments

As I have been thinking about this, let me specify what needs to happen.
Seems like every 20 seconds or so, when the polling interval occurs, my custom trigger gets called.  It will reset the value of the "project" property to the default value, rather than the value chosen by the user through the web interface. I was able to see the property get set correctly, but the value is overridden again upon the next polling interval.

So, my real question is how a custom trigger (that is living in the same lib directory as the application jars) can maintain its values over time rather than being reset.  Ideally, maintain those values even across restarting the service or rebooting.

Option B for me is to create a custom trigger for EACh of the 4 different values, and then have it somewhat hardcoded, but that is inefficient.
Any help would be excellent.

Thanks!

0

This has been pretty frustrating for me.  I love this tool but I can't believe not a single reply to this problem that I am having.  If it doesn't make sense, I don't mind clarifying...

As a workaround, I created 4 separate custom triggers and implemented them separately, rather than having just 1.  If anyone has insight to this, that would be great.

Thanks.

0

Brian, please take my apologises for not replying to you for such a long time.

Answering to your question:
- trigger can have two types of data: configuration parameters (edited by the user through the web UI) and trigger state data, usually not visible to user but holding some information which must be preserved when server restarts.

Configuration parameters are stored in the project-config.xml and should not be modified often. In fact they should only be modified by user. But trigger state data can be modified by the trigger at any time. Perhaps this is the kind of data storage you need? If so, take a look at getCustomDataStorage() method in PolledTriggerContext. CustomDataStorage is associated with the same build configuration to which the trigger is attached.

Hope this helps, and sorry for such a long delay.

0

I appreciate your help and will give getCustomDataStorage a look.

Thank you very much Pavel.  Have a good weekend.

0

Hi Pavel,

I finally took a look at this.  It doesn't seem to be working quite right, but that's okay.  I found the goodness of the HTTP post api to queue up builds.  That works much smoother and I don't have to have additional items installed on the build agents and servers.

Thanks again for your help.

0

Please sign in to leave a comment.