Assets 4

Release candidate 2 and hopefully the last before final 1.1 release.

This release fixes the XML preview display, and adds logging of server response headers and body.

  • Fix for webhook preview when format is XML. Fixes #114
  • Adds logging of the headers and body as returned by the webhook endpoint. This means the responses returned by the server at the webhook URL. Enable DEBUG logging in TeamCity to see these being logged. See #115 for more information.

All stories are now completed for v1.1. Unless any blocker bugs are reported, this release will be re-released as 1.1 final.

@netwolfuk netwolfuk released this Sep 13, 2018 · 6 commits to master since this release

Assets 4

tcWebHooksPlugin 1.1 Release Candidate 1

This release focuses on previewing and executing webhooks whilst editing a WebHook. It also includes the workaround for the REST API on TeamCity 2018.1.2 (issue #112 )

Preview and Test WebHook changes
This release adds the ability to preview a webhook as it is being edited. No need to save the webhook, and run a build to test a change. Just click the "Preview & Test" tab in the webhook dialog and select a build from the history and your edits will be previewed.

Then to execute that webhook, click "Send Test Webhook for Build Event".

This release has a lot of refactoring of the frontend UI code (JS and jQuery) in the WebHook edit dialog. If there are any bugs, they will be in the WebHook edit screen. Please raise an issue if you encounter any weirdness. :-)

Features

  • Add ability to preview WebHook edits (issue #79)
  • Add ability to execute a WebHook whilst editing a WebHook (issue #79)
  • Add link to tcWebHooksTemplates project on Template page (issue #110)
  • Include Microsoft Teams templates (issue #108)

Bug fixes

  • Workaround REST API incompatibility with TeamCity 2018.1.2 (issue #112)
  • Remove useless buildFinishTime variable from Template Edit screen (issue #109)
  • Remove missing variable from JSP which was causing stack trace (issue #109)
  • Remove buggy template renderer code which was causing stack trace (issue #109)
Assets 4

Bugfix release to address changes in TeamCity 2018.1.2.

A change in the TeamCity REST API (removal of a class) caused the tcWebHooks REST API plugin to interfere with the TeamCity REST API plugin.

In recent versions of TeamCity, Jetbrains have started to use the REST API for many of the reqests made to build the UI. Therefore, degradation of the TeamCity REST API actually causes the whole UI to run slowly, and throw errors in the log.

This release contains a fix which re-instates the missing class locally within the plugin. It is a workaround until I can find a better fix for the issue.

If you have updated to TeamCity 2018.1.2, and are using the tcWebHook REST API plugin, I would strongly recommend updating to this release.

More details on TeamCity bug tracker issue TW-56626 and issue #112 raised against tcWebHooks.

@netwolfuk netwolfuk released this Jul 21, 2018 · 25 commits to master since this release

Assets 4

This release focuses on previewing and executing webhooks whilst editing a WebHook Template

Preview and Test Template changes
This release adds the ability to preview a template as it is being edited. No need to save the template, and run a build to test a template change. Just click "Preview Template" and select a build from the history and your edits will be previewed.
Then to execute that webhook, choose an existing webhook config, or enter a URL and click "Send Test Webhook for Build Event"

Features

  • Add ability to preview WebHook Template edits (issue #79)
  • Add ability to execute a webhook whilst editing a WebHook Template (issue #79)
  • Added WebHook listing to REST API (required for above)
  • Added ${branch} as a WebHook Template variable. This returns a JSON object containing branch information

Bug fixes

  • ${changes} and ${branch} objects are serialised to JSON correctly in a webhook template (issue #98)
  • Required field "Rank" is now indicated as required on WebHook Template edit dialog (issue #99)
  • Fixed nested scrolling div issue on Endpoint page.
  • Re-ordered template variables on Template edit page, as they were illogical.

I am hoping this will be the last alpha. There are two stories left on milestone 1.1, and I expect the next release to be release candidate 1.

@netwolfuk netwolfuk released this Apr 17, 2018 · 50 commits to master since this release

Assets 4

tcWebHooks Alpha16 adds some more features to tcWebHooks and makes some changes to the REST API.

Features

Changes

  • REST API : Breaking change when using PUT to update Template at /app/rest/webhooks/templates/id:templateId. PUT now replaces the whole template. Previously it would just patch the meta data (which is not how PUT is supposed to work).
    To update the meta-data for a template, now POST to /app/rest/webhooks/templates/id:templateId/patch
  • REST API : When requesting a template with GET /app/rest/webhooks/templates/id:templateId?fields=$long the response no longer includes the webUrl and editable fields. To include those on the response, pass fields=$long,webUrl,editable

The two changes above simplify the export of a WebHook Template. For more information about importing and exporting Templates, see the new tcWebHooksTemplates project.

@netwolfuk netwolfuk released this Jan 14, 2018 · 66 commits to master since this release

Assets 4

Bug fix release alpha15

Issues Resolved

  • Bug: Set content-type correctly to UTF-8 - issue #92
  • Performance: Webhooks edit page is slow to load on project with many builds - issue #81
  • UX: Show history items on WebHooks tab for project and buildType - issue #80
  • UX: Provide links to /webhooks/templates.html from relevant places - issue #87
  • UX: Inform user if template is not found when editing - issue #90
  • UX: Fix scrolling on webhook edit dialog box when many builds are shown.

Other items

Added more links to documentation, and added some template info on the admin tab.

@netwolfuk netwolfuk released this Jan 8, 2018 · 76 commits to master since this release

Assets 4

This release is another alpha and is primarily a bugfix release fixing two issues and a regression.
It also includes a more enhanced History view to monitor webhook activity.

  1. REST API plugin fixes for those running TeamCity on Windows.
  2. Major HttpClient upgrade to resolve compatibility issues with Discord.
  3. Reapply PR #25 (regression)

Bug Fixes

REST API on Windows

In alpha13, The REST API plugin would not start on windows and the Jar Cleaner tool is not successful on Windows hosts due to file locking issues.
This release (alpha 14) fixes the REST plugin startup issue (thanks @Hakon) and provides better feedback for when the jaxb jars cannot be removed due to file locking on windows (thanks @padawahn)

HttpClient upgrade

HttpClient is the library on which WebHooks is based. It is responsible for actually making the WebHook POST request and handling message content, authentication, proxying, etc.
This release migrates from HttpClient 3.x to 4.5.4. This resolves an issue with webhook requests to Discord being denied.
Please raise an issue if you see connectivity problems or unexpected behaviour with tcWebHooks POSTing to endpoints which previously worked using the old 3.x library.

Reapply PR #25 (regression)

Somehow this was lost in the move from 0.9 to 1.1

New Features

WebHook reporting is now available in the TeamCity admin section on the WebHooks tab and more at /webhooks/history.html?view=errors. It's also possible to view all, ok and skipped webhooks in the history. Just click the relevant number in the boxes at the top.
Up to the last 10,000 webhook executions are stored in memory in TeamCity. These are discarded on TeamCity restart.

The history page is available for any user to view. However, if a user is not granted the Project Edit role on the project that triggered the webhook, then the URL is partially hidden so as not to reveal API keys etc. See screenshot below.

image

@netwolfuk netwolfuk released this Dec 6, 2017 · 101 commits to master since this release

Assets 4

This release will be the last 1.1 Alpha. The next will be 1.1 RC1 with a view to releasing 1.1 soon!

New Features

  • Add support for ${capitalise()}, ${capitalize()} and ${substr()} to webhook and template "macros".

Issues Resolved

  • #77 Templates can now be edited in TeamCity 9 (tested on 9.1.7)
  • #13 New and improved Slack templates.

The updated WebHook Templates for Slack take advantage of the ${capitalise()} and ${substr()} macros.

Slack WebHook Template example

The following is an example message sent by the updated Slack template:

image

Slack Compact WebHook Template example

The following is an example message sent by the updated Slack Compact template:

image

Changes and other clean-up

  • Updated icon locations for flowdock template.
  • Remove old and unused templates. All bundled templates should now be XML based.
  • Support only one template in an XML template config.

Previously XML based bundled templates had the <webhook-template> xml element wrapped inside an outer <webhook-templates> element. This is superfluous. Bundled templates will only ever include a single template. This is an internal change and will not affect any users.
However, this change means that the output from /app/rest/webhooks/templates/id:abc/rawConfig is suitable for insertion straight into a new template rather than having to wrap it in a superfluous tag.

Examples of using the capitalise, capitalize and substr macros

  • ${substr(build.vcs.number,0,7,32)} turns 3b0a11eda029aaeb349993cb070a1c2e5987906c into 3b0a11e. This takes chars from 0 to 7 but only because the string is 32 chars in length or greater. In this exmaple, any string passed to substr which is less than 32 chars will not be changed.
  • ${capitalise(string)} turns we are all lowercase into We Are All Lowercase by capitalising the first letter of each word.
  • ${capitalize(string)} is the same as above, but in American rather than English ;-)
Assets 4

This release greatly improves error handling for failed webhooks and adds a new Admin Tab for WebHooks.

Error Handling improvements

I found in testing that there is a method that loops over the configured webhooks and executes them in sequence. However, if one of those webhook executions failed it could - in certain circumstances - prevent any further webhooks from executing for that build event. The error handling has been improved and errors are now logged to the new WebHooks administration tab. The 10,000 most recent log events are stored in memory and are discarded when TeamCity is restarted.

Added new admin tab for WebHooks

There is a new WebHook tab in the Administration section of TeamCity. For this release it shows the most recent 20 failed webhook executions.

Future releases will allow further analysis of failures and other events (skipped, successful) as well as a list of all configured webhooks.

@netwolfuk netwolfuk released this Nov 11, 2017 · 148 commits to master since this release

Assets 4

This is a long awaited release which supports editing of WebHook Templates in the UI.

Note: XML Schema changes. Please backup your BuildServer/config/webhook-templates.xml (if it exists).

New Features

  • REST API for Template management
  • Editing of WebHook Templates within the UI (which makes use of the REST API)
  • WebHooks REST API section added to the TeamCity Administration pages
  • Tool for working around issue #43 (removes offending jars from teamCity REST API plugin).

Changes

There are two schema changes in the webhook-template.xml file. If you have defined your own templates, they should automatically be upgraded to the new format. It would pay to backup your BuildServer/config/webhook-templates.xml if you have defined your own WebHook Templates.

  1. WebHook Templates can now only support one format
  2. The WebHook name attribute is renamed to id to better reflect its purpose.

The following should be automatically migrated...
From

<webhook-template name="mytemplate" rank="30" enabled="true">
	<formats>
		<format name="jsontemplate" enabled="true" />
	</formats>
       ...
</webhook-template>

To:

<webhook-template id="mytemplate" format="jsontemplate" rank="30" enabled="true">
       ...
</webhook-template>

If multiple formats were listed in the formats element, the first is chosen and migrated into the format attribute.

Please note: WebHook Templates are not the same as Custom Templates. Any defined custom templates are unaffected by this change.

Branch change

This release is based off the long running custom-templates-with-rest-api branch, which has been in development for a couple of years.
It was impossible to merge this branch with the custom-templates branch (the one previous 1.1.x.x versions were released from) due to some major refactoring and my lack of experience with GIT.
I have spent many hours pouring over diffs of the two branches, and believe I have applied all the fixes from recent versions. If you find any regressions, please raise an issue.
I have also renamed the custom-templates-with-rest-api to master and it will be the default branch going forward.

Two plugin files

I have bundled the plugin as two separate files.

  1. tcWebHooksPlugin
  2. tcWebHooksPlugin-REST-API
    The second file is only required for editing and saving the webhook-templates.xml file. Creating webhooks from bundled templates or editing the webhook-template.xml file by hand does not require the REST API.

tcWebHooks REST API

This provides an API for reading and writing WebHook Templates. I plan to extend it to support reading and writing webhook configurations in future releases.