Skip to content
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

Teamcity notifies on personal builds #97

Closed
hagaygo opened this issue Feb 22, 2018 · 37 comments
Closed

Teamcity notifies on personal builds #97

hagaygo opened this issue Feb 22, 2018 · 37 comments

Comments

@hagaygo
Copy link

hagaygo commented Feb 22, 2018

Hi Everyone,

Just installed latest version (tcWebHooksPlugin-1.1-alpha15.216.313.zip & tcWebHooksPlugin-REST-API-1.1-alpha15.216.313.zip) on our teamcity server (windows , 2017.2.2 (build 50909)).

The setup works just fine (hooking to mattermost 4.7.1).

I Noticed that we are getting notifications for personal builds on team city , i am not sure if this is by design or i am missing some setting to disable this , but this behavior is not desired normally (personal builds is hmm, personal).

Please let me know how and if i can disable the webhooks notifications for personal builds.

@hagaygo hagaygo changed the title Teamcity notfies on personal builds Teamcity notifies on personal builds Feb 22, 2018
@netwolfuk
Copy link
Member

netwolfuk commented Feb 22, 2018

Thanks @hagaygo. You are right. tcWebHooks listens for all build events from TeamCity and does not differentiate between personal builds and non-personal builds. It's interesting, but I don't think anyone has ever asked for this feature before. It seems obvious now that you have and I will mark this issue as an enhancement request.

By the way: The only time when personal builds are considered differently is when the historical state change is calculated. Personal builds are ignored when finding the most recent build result to determine if the current build has changed (eg, to determine pseudo events like buildBroken and buildFixed).

If you're up for some XML hacking, you may be able to filter out personal builds by adding a Trigger Filter.

Have a look at the history of your personal builds, and see of there is a build parameter set by TeamCity. something like teamcity.build.isPersonal which you could use as the filter value and create an appropriate regex to check for it.

Sorry, I won't get a chance to test this myself today. But let me know if you want further help.

@hagaygo
Copy link
Author

hagaygo commented Feb 22, 2018

Thanks for the thorough answer.

I'll give your idea a try.

Hope to see this implemented in next version as "simple checkbox" :)

@netwolfuk
Copy link
Member

Yeah, that would be my thinking too. It would default to "on" so as not to surprise users, but can be easily unchecked.

@netwolfuk
Copy link
Member

netwolfuk commented Feb 23, 2018

I had a look and could not figure out how to extract the personal build status from any of the standard TeamCity build properties, so I have added it the webhooks payload object as buildIsPersonal. It's now possible to use a filter to filter out personal builds.

If you want to give this build a try (or a newer one), you will be able to configure a filter like this (tested by me):

          <trigger-filters>
                <filter value="${buildIsPersonal}" regex="^false$" enabled="true"/>
          </trigger-filters>

So for now we have a working solution (albiet a bit cumbersome), until the nice UI and toggle is implemented.

@hagaygo
Copy link
Author

hagaygo commented Feb 25, 2018

After further usage , i noticed that "remote run" builds are not getting notified which is what we mainly use.

I guess after all there an internal difference in teamcity between personal build (which ran trough teamcity web GUI) to remote run builds (which ran via visual studio)

@netwolfuk
Copy link
Member

I think I understand your comment. To paraphrase:

"We tend to use 'remote run' builds, and these do not trigger a webhook. This our the desired behaviour."

So to me, this reads like it's already performing the correct behaviour. Is that what you're saying?

@hagaygo
Copy link
Author

hagaygo commented Feb 27, 2018

For our main usage (remote runs via visual studio) the current behavior is fine.

I still think there should be an option to disable/enable webhooks for personal build (or it should be always disabled if such option is too complicated)

@Eric-Pang
Copy link

Is this same issue as shown on the Webhooks tab on TeamCity Server under "Recent WebHook Errors"?

999 :: Unexpected exception. Please log a bug on GitHub tcplugins/tcWebHooks. Exception was: Method getVcsRoot() cannot be called for personal build

@netwolfuk
Copy link
Member

netwolfuk commented Nov 23, 2018

Hi @Eric-Pang. This feels like a different issue, but could I please get some more information?

Which build event was this for ? Eg, Started, Changes Loaded, Finished, etc.

I've not really looked into this issue in detail. It could be related.

@netwolfuk
Copy link
Member

Hi @Eric-Pang Issue #132 has been raised to address your issue. The PR #133 has been merged against master and the plan to patch 1.1.x.x and release a bugfix over Easter.

@hagaygo There is a chance that this fix will change the behaviour you're seeing, and make personal builds work as I intended (which is not what you actually want). I'll try to find some time to test your use case too.

@hagaygo
Copy link
Author

hagaygo commented Aug 27, 2020

Just upgraded to latest version (1.1.374.403) and now i do get notifications for "Remote run" , any way to to disable notifications on "remote run" or "pesronal" builds ?

@netwolfuk
Copy link
Member

Oooh. I can't remember if I did that or not. I'll need to take a look and see. Hopefully over the weekend. It's been so long since I looked at this, I have forgotten all the context.

@netwolfuk
Copy link
Member

netwolfuk commented Aug 27, 2020

Hmm. Looks like I didn't do anything to address the concern @hagaygo

I can't promise I'll get a fix in this weekend, and my next few weekends are hectic. Your best work around for now is the filter above. Does that work for you, or am I misinterpreting your request?

@hagaygo
Copy link
Author

hagaygo commented Aug 27, 2020

Where do i need to put that filter snippet ?
can you direct me to the correct place ?

@netwolfuk
Copy link
Member

@netwolfuk
Copy link
Member

Also a detailed step by step to solve a different problem with filters is in #117

@hagaygo
Copy link
Author

hagaygo commented Aug 27, 2020

Thanks for the quick help, after adding it to the xml file , remote run did not notify on the webhook.

Hoping to see this in the GUI soon.

@netwolfuk
Copy link
Member

Yeah. Is quite a bit of work unfortunately. I need to add to the config file and all the logic around reading and writing to that. I need to add it to the UI and all the logic around editing and saving and testing webhooks.
Also need to add to the executor logic, so that the setting is considered during webhook execution.

That's probably why it sat for a while.

@netwolfuk
Copy link
Member

netwolfuk commented Aug 27, 2020

Editing of filters in the UI is in the roadmap for 1.2 though, so in reality that might happen first.

@netwolfuk
Copy link
Member

Also, FYI. Editing the webhook does preserve filters correctly even though you can't see them in the UI. So if you edit the webhook in the UI and be confident that your manual XML edits will still be there.

@Edstub207
Copy link

@netwolfuk Any update on this?

@netwolfuk
Copy link
Member

Hi @Edstub207. Thanks for the reminder. I am really close to having filters (and headers and parameters) editable in the UI.

At which point adding some quick filters would be relatively easy. I'm thinking the most useful ones would be "is default branch" and "is non-personal build".

@Edstub207
Copy link

@netwolfuk Thanks, sounds good :)

Do you know how long that might be?

@netwolfuk
Copy link
Member

@Edstub207 I'm really hoping to have 1.2 alpha 9 out within a month. That will be the last alpha and then a release candidate or two to address any bugs. Are you interested in running a (well tested) pre-release version?

@Edstub207
Copy link

@netwolfuk Yeah I'm up for testing a pre-release version :)

@netwolfuk
Copy link
Member

Cool. Thanks @Edstub207. I'll post here whenever there is a new build on that branch.

@netwolfuk
Copy link
Member

Hoping to have a build for you to test by the end of the weekend @Edstub207

@netwolfuk
Copy link
Member

image

@netwolfuk
Copy link
Member

@Edstub207 New builds available for the issue_3-add_filters_to_ui branch

I'm keeping track of issues related to these builds at #206

@netwolfuk
Copy link
Member

New changes pushed. Build will be available on the above link shortly.

@netwolfuk
Copy link
Member

New changes pushed. Builds available for the issue_3-add_filters_to_ui branch.

@netwolfuk
Copy link
Member

netwolfuk commented Oct 10, 2022

More new changes pushed. issue 3

@netwolfuk
Copy link
Member

I'm planning to merge this and release as 1.2.0-alpha.10 on the weekend. I'm hoping it's the last alpha before release candidate.

@Edstub207
Copy link

Hey, @netwolfuk Sorry about not doing any testing of this - I've had to look at other areas recently. So not sure when/if I can do testing right now.

@netwolfuk
Copy link
Member

No problem @Edstub207. I've been there. Found a bug last night, but still hoping to get a release out this weekend.

@netwolfuk
Copy link
Member

Alpha 10 released https://github.com/tcplugins/tcWebHooks/releases

@netwolfuk
Copy link
Member

Release Candidate 1 released https://github.com/tcplugins/tcWebHooks/releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants