Releases: tcplugins/tcWebHooks
tcWebHooksPlugin 1.1-rc1.243.373
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)
tcWebHooksPlugin 1.1-alpha18.241.356
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.
tcWebHooksPlugin 1.1-alpha17.235.354
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.
tcWebHooksPlugin 1.1-alpha16.223.329
tcWebHooks Alpha16 adds some more features to tcWebHooks and makes some changes to the REST API.
Features
- New project on GitHub called tcWebHooksTemplates. A place to find and share WebHook Templates
- Added Bearer Token Authentication (issue #95)
- Added support for Custom Headers (issue #95)
- Added
buildIsPersonal
field to content payload. - Show error in REST API and WebUI if a template edit fails due to the REST API jar conflict.
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 thewebUrl
andeditable
fields. To include those on the response, passfields=$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.
tcWebHooksPlugin 1.1-alpha15.216.313
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.
tcWebHooksPlugin 1.1-alpha14.214.303
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.
- REST API plugin fixes for those running TeamCity on Windows.
- Major HttpClient upgrade to resolve compatibility issues with Discord.
- 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.
tcWebHooksPlugin 1.1-alpha13.203.278
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:
Slack Compact WebHook Template example
The following is an example message sent by the updated Slack Compact template:
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)}
turns3b0a11eda029aaeb349993cb070a1c2e5987906c
into3b0a11e
. 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 tosubstr
which is less than 32 chars will not be changed.${capitalise(string)}
turnswe are all lowercase
intoWe Are All Lowercase
by capitalising the first letter of each word.${capitalize(string)}
is the same as above, but in American rather than English ;-)
tcWebHooksPlugin 1.1-alpha12.192.263
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.
tcWebHooksPlugin 1.1-alpha11.180.231
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.
- WebHook Templates can now only support one
format
- The WebHook
name
attribute is renamed toid
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.
- tcWebHooksPlugin
- tcWebHooksPlugin-REST-API
The second file is only required for editing and saving thewebhook-templates.xml
file. Creating webhooks from bundled templates or editing thewebhook-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.
tcWebHooksPlugin 1.1-alpha10.157.147
- Bug fix for HTTP time-outs defaulting to infinity. Now set to 120 seconds
Timeouts can be changed by editing main-config.xml and adding a section similar to the following:
<webhooks>
<http-timeout connect="10" response="10" />
</webhooks>