echocat / teamcity-buildTagsViaBuildLog-plugin

Teamcity plugin to programatically add build tags via the build log.
18 stars 2 forks source link

"BuildServerAdapter.messageReceived" is now deprecated #2

Open pgrefviau opened 6 years ago

pgrefviau commented 6 years ago

I haven't used the buildTagsViaBuildLog plugin yet, but while going through the source code I noticed that it made use of the BuildServerAdapter.messageReceived() method. From previous talks with JetBrains relating to plugin development, I know that this method is now deprecated. From what I understand, the reason behind this deprecation has something to do with supporting plugins on the running builds node.

I just wanted to give you a heads-up to make sure the plugin is up-to-date and compatible with more recent versions of TeamCity/OpenApi.

ogerovich commented 4 years ago

The plugin stopped working in TeamCity 2019.2.2. :-( It was working beautifully in 2019.2.1. I suspect that https://youtrack.jetbrains.com/issue/TW-64352 may have something to do with this. If there is any way you could release a working plugin quickly, I would appreciate it.

From https://plugins.jetbrains.com/docs/teamcity/open-api-changes.html:

- BuildServerListener.messageReceived event will not work in two-node configuration, and will be removed in the future.

Consider using some other approach. For instance, a plugin can obtain an Iterator from build log (BuildLog.getMessagesIterator) and tail it periodically in background.
ogerovich commented 4 years ago

I found a way to make it work by creating a server-side plugin that implements BuildMessagesTranslator.translateMessages(...) method.

matthiasbaldi commented 3 years ago

@ogerovich Could you explain your solution a bit better? How could I implement it?

@echocat would you may update the plugin, so it will work with current Teamcity versions?

Roganik commented 3 years ago

We've upgraded the TeamCity recently to version 2021.1 and this plugin has stopped working.

As a workaround, we've replaced this plugin with https://github.com/ocroquette/teamcity-autopin plugin. It has compatible syntax, so we've just replaced the plugin, restarted TeamCity, and now tags work again.

matthiasbaldi commented 3 years ago

@Roganik Worked also for me -> thank you.

Some additional information for other readers: I builded it in a Docker container: docker run --name tcpin --rm -it maven:3-openjdk-17-slim bash

apt update
apt install git vim

mkdir /var/build
cd /var/build
git clone  https://github.com/ocroquette/teamcity-autopin
cd teamcity-autopin
vim pom.xml # see below
mvn package

Then I had to change the target and source version to 1.8, afterwards the mvn package cmd worked and I copied the zip out of the container with docker cp tcpin:/var/build/teamcity-autopin/target/autopin.zip .