Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Administrators

Installing the plugin

Project Creator for JIRA is available through the Atlassian Marketplace. Install it through the Universal Plugin Manager in JIRA.

Configuration of addon

In the administration area of Stash, click on Javascript Hooks to get to the global configuration area for Javascript Hooks for Stash. From this screen the administrator can configure the available hook actions to the script writers.

 

Configuration itemDescriptionDefault value
Script timeoutHow long a script can run for before being stopped 3000ms
Enable HTTPCan the javascript make http calls to remote serversEnabled
HTTP Connection timeout  3000ms
Http HTTP Socket timeout  3000ms
Enable external commandsCan the javascript shell out and execute a command on the command line as the stash userDisabled
External command timeoutHow long to wait for a command to run before attempting to kill it

3000ms

Enable EmailCan the javascript trigger emails to be sent?Enabled
Email subject prefixA prefix for the subject line for any emails sentNone

 Image Added

User's guide

 

Enabling JS Hooks for a repository

 

Writing a Javascript hook

 

The first time that a repository administrator opens the JS Hooks page for the repository they'll be prompted to enable JS Hooks for the repository. This will enable the repository hook automatically. If for some reason the Repository Hooks are disabled through the Hooks screen, the administrator will be repromted.

Image AddedImage Added

Writing a Javascript hook

Writing a Javascript hook is quite simple. Simply click on "Add Hook" on the repository JS Hook page and you'll be presented with a screen for your editing. Each Hook will require a name and the script itself.

As part of the editing experience, you can select a changes (or a pull request in the case of a merge check) to run against. This will run your actual Javascript code against the particular item as if it was "live". At the end of the run you can see if there was an error with your code and which of the external api calls were called (and what the arguments passed to them were).

Once saved - the hook becomes active. At any point though, you can disable the hook from the repository view page.

Image Added

Troubleshooting