-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configured webhooks break when kotlin code syncs #246
Comments
Thanks for the great bug report @jacobs-xero I'll setup a kotlin VCS project and try to reproduce it. Can I just clarify a couple of things:
Thanks in advance. |
Can I please get a bit more info on what you see when it becomes "uneditable"? I'm hoping you might get some errors in the browser console (developer tools). Can you also confirm my assumption here?
|
Hi @jacobs-xero. I have not been able to reproduce this issue. Are you able to answer the questions I had posted above? |
@netwolfuk sorry for the delay in getting back. I'll find the answers for the questions above and get back to you asap. Thanks |
Thanks @jacobs-xero There is a similar conversation happening on issue #248
|
|
Thank you for the quick feedback. I'll add that to the array of facts I have been collecting. I am about to post an update to the other ticket (#248 ) as to what I have been able to reproduce. |
Thanks @netwolfuk , is the advice to use |
HI @jacobs-xero. Having an ID is required. It does not matter which format you choose. The most important thing is that they don't clash across the whole of the teamcity instance. If I understand correctly, your VCS is being written to by TeamCity. This means that when the webhook is loaded it is...
For ticket #248 the same is happening, but because they don't let TeamCity update back into VCS, the issue occurs on every update. So, for them the benefit is that using an id like At this stage, these two tickets look very similar, but I think are actually different bugs. I am hoping to get some time on the weekend to do a deep dive on the issue you are seeing. I suspect in both cases it is exacerbated by the nested projects that inherit from a VCS managed project, but I have yet to prove that. |
Thinking out loud, if...
Then the cache will stay in sync with the config. The IDs will be constantly changing which does have two at least two downsides...
I think I will also look into creating a task that checks that webhooks have IDs in the file. I can put up one of those notification bars along the top of the window to indicate there is an issue and that one should fix the IDs in the config file. Also, I've started investigating whether I can support webhook config inside the settings.kts file. If that's not too hard, then I can apply logic at the time that file is loaded and mandate that they need IDs and that they don't clash. |
I've managed to make some really good progress on this. I have found the following: Updates to webhooks that are driven by the plugin work well Updates driven by VCS changes without IDs cause ghost webhooks Also, I was not comparing the result of the existing webhooks against the updated webhooks. I have added logic to compare the IDs after the cache is refreshed, and remove any webhooks from the current project if they don't match one of the new IDs. A line like the following is printed in the log.
This does have the downside that IDs will churn. This causes two annoyances.
Ideally, webhooks should have unique IDs. This will work around this issue. TeamCity's However, I have found that this event is fired when the VCS configuration is reloaded. TeamCity appears to re-read the VCS settings, delete all builds on that project, and then recreate them with the same internal and external IDs. At which point the When I see that event, I diligently clean up any webhooks that explicitly reference that build, and remove that build (btxxxx) id from their configuration. This presents as webhooks having 0 builds registered. Sometimes webhooks still have builds showing. This is because a project edit (either via VCS or from the UI) fires up to 10 events in quick succession. I have a queue backed delay and de-bounce algorithm to only present one of each type of event. I therefore only see one I have removed the I'll do more testing on various configurations. I hope to have a very early beta release of 2.0.2 available for testing in 24 hours. |
Builds on this branch are available to download on the jetbrains TeamCity instance. You don't need an account to download. Just choose guest mode. Would it be possible to install this on your server and test it? I am pretty confident this will fix the issues you are seeing. Thanks again for all your help thus far. |
Hi @netwolfuk , thanks for the updated plugin to test. It looks like this I did notice this behaviour. When the VCS would load, 1 webhook (always appeared to be the last on the list, but not confirmed if this is a pattern yet) would be missing Trigger on Events. However, when I would click edit, the WebHook Config was as expected. When I would hit refresh on the Webhooks & Templates page, the Build Events would appear correct and as expected. I'll keep having a play around to see if I find any other strange behaviours. Thanks |
Ooh. That's an interesting bug. I don't think I've done anything that would have changed that. Thanks for reporting it and I'll do some testing over the weekend. Thanks again for all your great replies. I very much appreciate it. |
Hi @jacobs-xero On the weekend I have built up two new servers with the intention of running them as a primary/secondary node setup. Do you happen to be running a two server TeamCity setup? This is what we're seeing on #248 and it seems to be interfering. Also, I noticed that editing project that is backed by VCS is unreliable. I tried to fix some build steps and my changes appeared to be saved, but were never persisted, and were never written back to git. Have you seen this behaviour, or do you mainly edit the project from the kotlin files and sync from VCS to TeamCity rather than the other way around? |
Hi @netwolfuk , we only have the single server TeamCity setup. We mainly edit the project via Kotlin files and sync from VCS to TeamCity. That's when we started seeing similar inconsistency with what was in the code vs UI (ghost webhooks and unchecked projects etc) |
Hi @jacobs-xero Did you happen to notice if the webhooks fired on the events that were missing. What I mean is... If the above build ran, did the webhook trigger for Looking at the code, these are resolved just at the page is rendered, and just as the webhook runs, so there is a chance that the webhook will have picked up the correct setting when it fired. You could have a look in the audit log. That would tell you when VCS settings reloaded, and then have a look at the build overview page (not a specific build) on the WebHooks Tab. It should show the events it tried to trigger for (see the bottom of this screenshot). The table at the bottom of the above screenshot is rendered from the last 10,000 webhook events, which are then filtered to show just the ones from that build configuration. So if there have been lots of webhooks fired on other builds, then they might not show up in that table. |
Hi @netwolfuk , I checked in with the team, and they've said that when the Build Events are missing, the webhooks stop firing. |
A quick update.... I have not been able to reproduce this issue where the build does not resolve. I have done the work to convert from using plugin-settings.xml to using ProjectFeatures. I've also written a tool that converts from plugin-settings.xml to ProjectFeatures. This is undergoing testing at the moment. The obvious shortcoming is that we need a way to convert to the new format for those that don't allow writing to VCS Settings. I am still working through how to do this. |
@netwolfuk thanks for the update. Happy to test out any test builds of the plugin. |
Hi @netwolfuk, just wanted to reach out and see if there's been any update here? Thanks |
Hi @jacobs-xero. I am struggling to get any response from the Jetbrains team. Do you have a contact with them that could help get some answers to this ticket? https://youtrack.jetbrains.com/issue/TW-89148/Question-Example-kotlin-dsl-xml-files |
I have heard back from the team at TeamCity. We have a plan to work through the issues in the new year. |
Expected Behavior
Configured webhooks should be configured correctly and editable.
Current Behavior
Configured webhooks produce an error when trying to edit
Configured webhook has lost all it's settings
Under Versioned Settings, Loading project settings from VCS can re-create the webhooks with the correct settings. However leaves these "ghost" webhooks to persist until a service restart.
Extent of the breaking varies
If a webhook is defined in code and that definition is not altered, it stays in place and can be edited, but it loses some configuration and needs to be fixed
If a webhook is not defined in code (eg for subprojects, because we have no way of defining that in code), then the webhook just becomes uneditable
Steps to Reproduce (for bugs)
Your Environment
The text was updated successfully, but these errors were encountered: