tcWebHooks: Webhooks not showing when project is copied
Expected Behavior
When copying a project, the new project should show the webhooks correctly.
Current Behavior
The webhooks will only show in one of the projects (it’s not deterministic which one)
Steps to Reproduce (for bugs)
- Create a project (
Project1) - Setup a webhook on the project
- Copy the project (to
Project2) - view the webhooks for each project, webhooks will only be visible on one project
Problem
We copy projects on a semi-regular basis, to support our old “LTS” branches.
The new webhook has the same id as the old webhook, meaning that when it ends up in this map, we drop webhook instances.
This is similar to https://github.com/tcplugins/tcWebHooks/issues/10 - we’d need to deal with modifying the IDs during copy, but it still doesn’t look like there’s a nice way of being notified when a copy happens.
I looked to see what would happen if we dropped the uniqueid altogether, and it seems about half of the usages are around logging, but there’s still a lot of spots that require some thinking.
🤔 An option could be to prefix the unique id with the project id when dealing with it in code, so the duplicate id’s in the config dont matter.
🤔 Another option could be to drop the id from the config, and generate a hash of the projectid+the entire webhook config for use as the id?
Workaround
We can modify the id’s manually in the config so they are unique, but it’s not ideal.
Your Environment
- tcWebHooks Version: 1.2.5
- TeamCity Version: 2023.11
- TeamCity server Operating System: Linux
- Are you using a WebHook Template?: no
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 27 (27 by maintainers)
Just reconfirmed it - I listed out the repro steps in https://github.com/tcplugins/tcWebHooks/issues/242 to make it as easy to track down as I could.
I suspect the fix could be related to this one - capturing an event when the build config is deleted and modifying the webhook there.
Pavel tells me that projectRestored will fire when the VCS config is reloaded. I’ve added support for that event too in this PR
Yeah, that’s the last piece to fix.
We do it via the admin UI