summaryrefslogtreecommitdiffstats
path: root/src/main/distrib/data/groovy/youtrack-readme.md
blob: 81a2c4eac2dfb28834b987971bad6377bb9656f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# GitBlit YouTrack Receive Hook

GitBlit receive hook for updating referenced YouTrack issues.

This script has only been tested with the cloud hosted YouTrack instance.

## Usage

Due to limited authentication options when using the YouTrack REST API, you have to store a username and password for an account with appropriate permissions for adding comments to any issue. Hopefully in the future YouTrack will support API keys or similar.

1. Update your `gitblit.properties` file with the following entries:
    *   `groovy.customFields = "youtrackProjectID=YouTrack Project ID" ` *(or append to existing setting)*
    *   `youtrack.host = example.myjetbrains.com`
    *   `youtrack.user = ytUser`
    *   `youtrack.pass = insecurep@sswordsRus`

    (But using your own host and credential info).

2. Copy the `youtrack.groovy` script to the `<gitblit-data-dir>/groovy` scripts directory.
3. In GitBlit, go to a repository, click the *edit* button, then click the *receive* link. In the *post0receive scripts* section you should see `youtrack` as an option. Move it over to the *Selected* column.
4. At the bottom of this same screen should should be a *custom fields* section with a **YouTrack Project ID** field. Enter the YouTrack Project ID associated with the repository.
5. When you commit changes, reference YouTrack issues with `#{projectID}-{issueID}` where `{projectID}` is the YouTrack Project ID, and `{issueID}` is the issue number. For example, to references issue `34` in project `fizz`:

        git commit -m'Changed bazinator to fix issue #fizz-34.'

    Multiple issues may be referenced in the same commit message.

## Attribution

Much of this script was cobbled together from the example receive hooks in the official [GitBlit](https://github.com/gitblit-org/gitblit) distribution.