1. Sebastian Sdorra
  2. scm-manager
Issue #164 resolved

Plugin to call remote webserver after push

gery7n
created an issue

Mayby in general - to call some server (via url config) after new commit is pushed.

....or it can be done via some other way?

Comments (9)

  1. Sebastian Sdorra repo owner

    I would like a general "webhook" plugin. But i'm not realy sure what's the best way to implement this. Here are some ideas:

    • Configureable url with placeholders (${author.name}, ${commit.message}, ...), the hook is executed for every commit
    • Configureable url, commits are send as xml in the http body, the hook is only executed once per push

    Perhaps you have a better idea.

  2. gery7n reporter

    i don't know jira plugin, but redmine have ability to link commit messages to issues - but it must be somehow trigered (for example via REST api), i have few other system's that can be notified in this way - for most of them i have sheduled simple culr query in loop (email notifications and jankins, have great dedicated plugins in scm manager ;-) in summary - from my point of view parameterized url executed for every push would be good enought for most of systems, but it would be nice, that plugin can be enabled few times per repository or can do few querys (for triggering more than one system)

  3. Sebastian Sdorra repo owner

    First snapshot version is ready for testing. Could you please test this version?

    Test scm-webhook-plugin:

    • Login in as administrator
    • Open Config->General
    • Change "Plugin Repository" parameter snapshot from false to true
    • Open Plugins
    • Install version 1.0-SNAPSHOT of scm-webhook-plugin
    • Restart your applicationserver

    After the restart you should see a "Webhooks" tab for each repository. You could use placeholder in the url e.g:

    • ${repository.id} - the id of the current repository
    • ${repository.name} - the name of the current repository
    • ${first.id} - the if of the first changeset in the push
    • ${last.author.name} - the name of the author of the last changeset in the commit

    If you enable the "Execute on every commit" checkbox the last and first patterns are not available, but you could use the commit pattern e.g:

    • ${commit.id} - The id of the current changeset
    • ${commit.author.name} - The name of the author of the current changeset

    If you need more informations about the available patterns have a look at the javadoc. Ever method which starts with a get could be used in a pattern (Repository.getName() would be ${repository.name}):

    Please let me know if there a bugs or if you have any suggestions.

  4. gery7n reporter

    excelent work - i just run plugin, it works well in std mode, the "Execute on every commit" checkbox seems to have problem with storing his state, when i set him and click ok button, config tabs are gone and after refresh it is unchecked again (client: Chrome,IE)

  5. Log in to comment