[SOLVED] Build Tags Created with Service Messages
Using the Service Message "addBuildTag" I am adding a tag during a build. This works just fine as long as the build is running, but once the build is complete it is being removed from the build. In the log I do see the message "Tag MyTag added to the build via a service message". And it is there, until the build completes, at which point it disappears. This is actually the same behavior as manually tagging. Why don't the tags survive the completion of the build? Is there a way to prevent this?
In contrast, if I tag a build after it is complete, the tag does not go away.
Please sign in to leave a comment.
teamcity-activities.logto see which user removed the tag. Look for lines like this:[2023-08-21 17:40:54,307] INFO - s.buildServer.ACTIVITIES.AUDIT - build_promotion_tag_change: Build BUILD_PROMOTION{id=66346}'s tags were changed by "user with id=1" with comment "Removed: test-tag"Thanks for the help Anatoly!
Unfortunately, I can't see anything in the log file removing the tags. This is what I do see:
[2023-08-21 15:56:26,345] INFO - tbrains.buildServer.ACTIVITIES - Build started; Utility Builds / Agent Builds / Test {id=UtilityBuilds_AgentBuilds_Test/bt839} #5 {id=316960, agent="elastic_mclaren/172.27.190.38" {id=46859}, triggered by "user with id=4" (##userId='4' type='user'). Started 2023-08-21 15:56:26.335, running}[2023-08-21 15:56:39,518] INFO - tbrains.buildServer.ACTIVITIES - Tag TagTest2 added to the build #5 {build id=316960, buildTypeId=UtilityBuilds_AgentBuilds_Test} via a service message
[2023-08-21 15:56:39,523] INFO - tbrains.buildServer.ACTIVITIES - Tag TagTest1 added to the build #5 {build id=316960, buildTypeId=UtilityBuilds_AgentBuilds_Test} via a service message
[2023-08-21 15:56:52,452] INFO - s.buildServer.ACTIVITIES.AUDIT - build_promotion_tag_change: Build BUILD_PROMOTION{id=316960}'s tags were changed by "user with id=4" with comment "Removed: TagTest1, TagTest2"
[2023-08-21 15:56:52,456] INFO - s.buildServer.ACTIVITIES.AUDIT - build_promotion_tag_change: Build BUILD_PROMOTION{id=316960}'s tags were changed by "user with id=4" with comment "Added: CustomTagTest, TagTest1, TagTest2"
I am running TeamCity Professional 2023.05.1 (build 129321). I am creating the tags using the service message (from PowerShell here):
One factor that may impact this is that the builds are running in a Docker cloud agent running Windows. I have also attempted to use the REST api to create tags with the same result, unfortunately.
Hi! I didn't test it with Docker cloud agent, but it works fine for me with a K8s cloud agent. Could you run a dummy build with this step:
Write-Host "##teamcity[addBuildTag 'TagTest-%teamcity.build.id%']"
Then confirm the tag disappeared after the build finished and upload these logs:
<TeamCity home directory>/logs/teamcity-server.log*files.<TeamCity home directory>/logs/teamcity-activites.log*files.Feel free to upload the files through https://uploads.jetbrains.com/ (don't forget to specify the upload ID).
I've followed your steps with a brand new build configuration. This configuration only has a single PowerShell step with the single command you provided copied in. This is what the build page looks like after the build is complete:
And this is what it looks like if I refresh the page. The tag is gone:

However, if I add one manually and refresh, it is persistent:

I've uploaded your requested log files with this ID: 2023_09_07_FiqHQCEFUJmL7piPcN45yr
I have indeed tried that, and no, manually created tags that are created before the build completes do not survive completing either.
Wow! That solved it. I had reviewed the external plugins, but concluded that there was nothing that *should* be interacting with tags. I disabled all of these (not a very good diagnostic technique, I know):
My best guess is the CVS support or perhaps TestingBot, since they may have features to tag builds. I managed to get in this morning before builds started, but now there are builds running so I'd rather not test further. If you need I can do so over the next couple days though.
Thank you very much for your help on this. I have several builds that really benefit from tags.