-
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
WebHooks against specific builds are not shown in the project webhooks list #111
Comments
I think the best way to solve this is to get rid of the "WebHooks configured for projectName > buildName" and instead just list the Enabled Builds like it does on the WebHooks tab of the Project Settings, and the WebHook edit page. eg, The other feature on the roadmap (but quite a way down the list) is tags, and it could be possible to list the builds a webhook is associated with via a tag. I'm not sure that scales very well to the All builds & Sub-Projects one though. |
As per issue #111 this shows builds for builds on the builds tab, but includes all webhooks on the projects tab. Also took the chance to tidy up the code quite a bit to use a standard table layout, and use the new WebHookSettingsManager to finding and listing webhooks.
I'll post here when the next alpha 1.2.0 is released. |
Hi, maybe this is related. If I specify a webhook and/or webhook parameters on a build level then they are not associated to the build but to the parent project. The same happens if I define them on a sub-project (they are associated with the parent project). Project A
Project A1 <-- Webhooks or parameters defined here are shown at Project A
Build B1 <-- Webhooks or parameters defined here are shown at Project A1
Project A2
Project B
Build B2 <-- Webhooks or parameters defined here are shown at Project B
Build B3 |
Which tcWebhooks version are you running? |
BTW. internally all the webhook configurations are stored against a project.. It's not possible to store this sort of config against a build. That is why they appear at the project level. I'll look into what you say about the project details being stored against the parent project though. |
I am using It would be cool though if the custom webhook parameters could be stored on the build config level. Or is this not possible? |
If I understand the use case, you want the same variable to resolve to different values for different build configs and want to reference them in the template? If so, I think it's possible to create a TeamCity parameter in the build configuration and use that. |
If you're using the velocity template engine, it's also possible to define a JSON map as the text of a parameter, and then use jsontool to convert it to a Java Map in the template. If you used the buildTypeId as the key in the map you could reference the value in your template. I've done this before to map git usernames to slack handles. |
Thanks for the info.
As mentioned the problem is also with parameters. They as well get attached to the parent. :-( Also I noticed that deleted webhooks are still shown in the overview list even when I cannot click on them. The global settings page for webhooks show the correct count though, so maybe that is some caching issue? To be more concrete the still shown ones are the hooks I defined which were then wrongly attached to the parent project. Hooks I define on a "top level" project are fine. |
Thanks for all the feedback. I'll setup that version on a machine somewhere and test. I've broken my current dev environment as I'm in the middle of a huge refactor to reduce a lot of duplication in the JavaScript UI code |
Oh, I missed that one, thanks. But how can I reference them in the webhook? I need some of them to construct the proper URL. After creating a build parameter |
if I understand correctly, you want to:
I think this might work (untested).
When the force resolve code runs, it takes an instance of the build (SRunningBuild), and asks it to resolve the parameter. It will find the build config paramater Edit: Sorry about the above screenshot. The presence of the |
This works but not for nested projects and also not if we have multiple build configurations under one project which whould need different variables. Because the variables are also assigned to the parent project we can only define a variable once. We could circumvent the build issue problem by wrapping the build configs into sub projects but for that the issue of everything being attached to the parent project instead of the current one remains a problem. Last but not least: Many thanks for your work and response. |
I must be missing something. I'm sorry I'm not understanding correctly. If you define bar once for all projects, eg on the root project, and define foo as a parameter on every build you need it on. This should work because bar is resolved at runtime against the instance of the build that is running. |
Yep. Thanks. If I understand correctly, the If so, create it as a TeamCity configuration parameter, and remove it from the Webhook parameters. tcWebhooks will still find it with the name |
Hi @jan0sch. I just wanted to say thank you for taking the time to submit your comments. For me it seems obvious how this works because I wrote all internals, but I'll try to explain a bit more. The WebHooks and WebHook Parameters are stored against the project in which they live. This is simply because that's the easiest place to store them (and the only place they could be stored when I first started the project over a decade ago). Creating a webhook against a specific build configuration is really just a webhook in a project, but with just the specific build configuration explicitly selected. The confusion comes from the way they are displayed in the UI. I present them as if they are webhooks for a specific build, and at the time this bug was first raised, they were hidden when you viewed the project webhooks. This now been fixed in the version you are using and you can see webhooks in the project, even if they only execute for a specific set of build configurations. However, when viewing webhooks for a specific build, this shows webhooks that are specifically configured for this build config. There could in fact be many webhooks that this build also "inherits" from the project it is in, and any parent projects that have "sub-projects" enabled but they are not currently shown. For this reason, I have been working on the search page ( I feel like this gives a more visible indication of what webhooks will actually be executed for a specific build. It is this indexed list of webhooks that also allows viewing the webhooks for parent projects when you view the webhooks tab on the Project Configuration (named WebHooks and Templates). The search page tries to be clever and not show you the full URL of webhooks that live in a project for which you don't have edit access. For example, if there was a parent project with a webhook for Also, webhooks in projects that you don't have view access to will not appear in the search. This is more relevant when you search by template or tag because the results could be in any project across the whole teamcity instance. Currently, the edit webhook code (jQuery and javascript), is very specific to the edit page only. The large refactor I am currently working through, is to extract all the relevant components and enable re-use so that the UI code (eg, that dialog and all the fetching and saving, etc) can be used in other pages. This will allow editing of webhooks and parameters directly from the project configuration page, and also the search results page. |
BTW, here are some example searches.
|
Defining the parameters as regular ones on the build configuration works. 🎉 🎆 Again thank you very much for your work and time! ❤️ |
You're welcome. I'm glad you got it all working. |
Expected Behavior
Shown properly
Current Behavior
If we select as below, webhooks are only assigned to certain buids within a project (eg, not all builds).
Then, the webhooks not shown in Project view as below.

If we select All projects and Sub-projects,
Then, the webhooks are shown properly as below.
Steps to Reproduce (for bugs)
Your Environment
Example Configuration (xml)
The text was updated successfully, but these errors were encountered: