Enabling hooks via REST API doesn't *actually* enable them

XMLWordPrintable

    • Type: Bug
    • Resolution: Handled by Support
    • Priority: High
    • None
    • Affects Version/s: 3.1.1
    • None
    • Environment:

      I have a script to managed the configuration of the 100+ projects, and 300+ repos we hold in Stash, and their hooks.

      It has become apparent, that certainly since our most recent upgrade to 3.1.1, the Stash API for enabling hooks appears broken.

      We have a number of pre-receive plugins configured, including:
      com.atlassian.stash.plugin.stash-protect-unmerged-branch-hook:protect-unmerged-branch-hook
      com.teslamotors.stash.hook.jira-issue-enforcer:commit-message-issue-enforcer
      and a couple of our own.

      Configured and enabled manually by hand, these plugins all work fine, but if I send the following curl request to the API...

      curl -u USER:PASSWORD -X PUT -H "Accept: application/json" -H "Content-Type: application/json" "https://stash.DOMAIN.com/rest/api/1.0/projects/ageas/repos/scripts/settings/hooks/com.teslamotors.stash.hook.jira-issue-enforcer%3Acommit-message-issue-enforcer/enabled" -d '

      {"checkJiraExistenceEnabled":true,"jiraApplicationLinkEnabled":true,"jiraBaseUrl":"https:\/\/jira.*DOMAIN*.com","jiraUsername":"","jiraPassword":"","exemptMergeCommits":true,"allowExemptionKeyword":true,"jiraExemptionRegex":"\\[NO_ISSUE\\]","checkForIssueMoveEnabled":true,"watershedCommitLogMessageEnforcement":"","branchNamespaces":" "}

      '

      I get the following response:

      array (
      'details' =>
      array (
      'key' => 'com.teslamotors.stash.hook.jira-issue-enforcer:commit-message-issue-enforcer',
      'name' => 'Commit Log Message JIRA® Issue Reference Enforcer',
      'type' => 'PRE_RECEIVE',
      'description' => 'Enforces that all commits contain a (valid) Jira issue reference or explicit exemption (via the string "#noissue").',
      'version' => '1.1',
      'configFormKey' => 'com.teslamotors.stash.hook.jira-issue-enforcer:commit-message-issue-enforcer-config-form',
      ),
      'enabled' => true,
      'configured' => true,
      )

      This is the same for all plugins - both 'enabled' and 'configured' are true.

      However, the plugins then do not get applied - at all - when configured using the API (even disabling and re-enabling does nothing).

      If I go into the Hooks settings for a repo, the plugin displays as ENABLED (as expected). Going into the settings and saving the configuration manually, does make this work (but isn't suitable for 300+ repos...)

      Thanks.

            Assignee:
            Unassigned
            Reporter:
            Joe Bowman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: