UNPKG

8.38 kBMarkdownView Raw
1# Hubot Jira Bot
2Lets you search for JIRA tickets, open
3them, transition them thru different states, comment on them, rank
4them up or down, start or stop watching them or change who is
5assigned to a ticket. Also, notifications for assignments, mentions and watched tickets.
6
7###Dependencies:
8- moment
9- octokat
10- node-fetch
11- underscore
12- fuse.js
13
14###Configuration:
15- `HUBOT_GITHUB_ORG` - Github Organization or Github User
16- `HUBOT_GITHUB_TOKEN` - Github Application Token
17- `HUBOT_JIRA_GITHUB_DISABLED` - Set to true if you wish to disable github integration
18- `HUBOT_JIRA_PASSWORD`
19- `HUBOT_JIRA_PRIORITIES_MAP` `[{"name":"Blocker","id":"1"},{"name":"Critical","id":"2"},{"name":"Major","id":"3"},{"name":"Minor","id":"4"},{"name":"Trivial","id":"5"}]`
20- `HUBOT_JIRA_PROJECTS_MAP` `{"web":"WEB","android":"AN","ios":"IOS","platform":"PLAT"}`
21- `HUBOT_JIRA_TRANSITIONS_MAP` `[{"name":"triage","jira":"Triage"},{"name":"icebox","jira":"Icebox"},{"name":"backlog","jira":"Backlog"},{"name":"devready","jira":"Selected for Development"},{"name":"inprogress","jira":"In Progress"},{"name":"design","jira":"Design Triage"}]`
22- `HUBOT_JIRA_TYPES_MAP` `{"story":"Story / Feature","bug":"Bug","task":"Task"}`
23- `HUBOT_JIRA_URL` `https://jira-domain.com:9090`
24- `HUBOT_JIRA_USERNAME`
25- `HUBOT_JIRA_FIELDS` `customize the jira fields returned by api, defaults to: ["issuetype", "status", "assignee", "reporter", "summary", "description", "labels", "project"]`
26- `HUBOT_SLACK_BUTTONS` `{"watch":{"name":"watch","text":"Watch","type":"button","value":"watch","style":"primary"},"assign":{"name":"assign","text":"Assign to me","type":"button","value":"assign"},"devready":{"name":"devready","text":"Dev Ready","type":"button","value":"selected"},"inprogress":{"name":"inprogress","text":"In Progress","type":"button","value":"progress"},"rank":{"name":"rank","text":"Rank Top","type":"button","value":"top"},"running":{"name":"running","text":"Running","type":"button","value":"running"},"review":{"name":"review","text":"Review","type":"button","value":"review"},"resolved":{"name":"resolved","text":"Resolved","type":"button","style":"primary","value":"resolved"},"done":{"name":"done","text":"Done","type":"button","style":"primary","value":"done"}}`
27- `HUBOT_SLACK_PROJECT_BUTTON_STATE_MAP` `{"PLAT":{"inprogress":["review","running","resolved"],"review":["running","resolved"],"running":["resolved"],"resolved":["devready","inprogress"],"mention":["watch","assign","devready","inprogress","rank"]},"HAL":{"inprogress":["review","running","resolved"],"review":["running","resolved"],"running":["resolved"],"resolved":["devready","inprogress"],"mention":["watch","assign","devready","inprogress","rank"]},"default":{"inprogress":["review","done"],"review":["done"],"done":["devready, inprogress"],"mention":["watch","assign","devready","inprogress","rank"]}}`
28- `HUBOT_SLACK_VERIFICATION_TOKEN` - The slack verification token for your application
29
30Note that `HUBOT_JIRA_USERNAME` should be the JIRA username, this is
31not necessarily the username used if you log in via the web. To
32determine a user's username, log in as that user via the web, and check
33the user profile. Frequently, users may log in using an email address such
34as 'bob@somewhere.com' or a stem, such as 'bob'; these may or may not match
35the username in JIRA.
36
37####A note about chat:jira user lookup
38In order for direct messages (notifications) and a few other
39username based commands to work JiraBot attempts to match JIRA users with chat
40users by email address. This has been tested primarily on the [Hubot
41Slack adapter](https://github.com/slackhq/hubot-slack) and may not work without modification on others.
42The take away is that you must have the same e-mail address on both
43services for this to work as expected.
44
45####Notifications via Webhooks
46In order to receive JIRA notifications you will need to setup a webhook.
47You can find instructions to do so on [Atlassian's
48website](https://developer.atlassian.com/jiradev/jira-apis/webhooks).
49You will need your hubot to be reachable from the outside world for this
50to work. JiraBot is listening on `/hubot/jira-events`. Currently
51the following notifications are available:
52
53* You are mentioned in a ticket in either the description or in a
54 comment
55* You are assigned to a ticket
56* The following notifications apply if you are assigned to the ticket:
57 * A new comment is left on the ticket
58* The following notifications apply if you are watching the ticket in
59 question:
60 * Work begins on the ticket (enters the In Progress state or similar)
61 * The ticket is closed
62 * A new comment is left on the ticket
63
64###The Definitive hubot JIRA Manual
65@hubot can help you *search* for JIRA tickets, *open*
66them, *transition* them thru different states, *comment* on them, *rank*
67them _up_ or _down_, start or stop *watching* them or change who is
68*assigned* to a ticket
69
70
71####Opening Tickets
72> hubot [`<project>`] `<type>` `<title>` [`<description>`]
73
74You can omit `<project>` when using the command in the desired projects channel
75Otherwise you can specify one of the following for `<project>`: `#web`, `#android`, `#ios`, `#platform`
76`<type>` is one of the following: `story`, `bug`, `task`
77`<description>` is optional and is surrounded with single or triple backticks
78and can be used to provide a more detailed description for the ticket.
79`<title>` is a short summary of the ticket
80
81#####Optional `<title>` Attributes
82
83_Labels_: include one or many hashtags that will become labels on the jira ticket
84 `#quick #techdebt`
85
86_Assignment_: include a handle that will be used to assign the ticket after creation
87 `@username`
88
89_Transitions_: include a transition to make after the ticket is created
90 `>triage`, `>icebox`, `>backlog`, `>devready`, `>inprogress`, `>design`
91
92_Priority_: include the ticket priority to be assigned upon ticket creation
93 `!blocker`, `!critical`, `!major`, `!minor`, `!trivial`
94
95
96####Creating Sub-tasks
97> hubot subtask `<ticket>` `<summary>`
98
99Where `<ticket>` is the parent JIRA ticket number
100and `<summary>` is a short summary of the task
101
102
103####Cloning Tickets
104>`<ticket>` clone to `<channel>`
105> `<ticket>` > `<channel>`
106
107Where `<ticket>` is the JIRA ticket number
108and `<channel>` is one of the following: `#web`, `#android`, `#ios`, `#platform`
109
110
111####Ranking Tickets
112>`<ticket>` rank top
113> `<ticket>` rank bottom
114
115Where `<ticket>` is the JIRA ticket number. Note this will rank it the top
116of column for the current state
117
118
119####Commenting on a Ticket
120>`<ticket>` < `<comment>`
121
122Where `<ticket>` is the JIRA ticket number
123and `<comment>` is the comment you wish to leave on the ticket
124
125
126####Adding labels to a Ticket
127>`<ticket>` < `#label1 #label2 #label3`
128
129Where `<ticket>` is the JIRA ticket number
130
131
132####Assigning Tickets
133>`<ticket>` assign `@username`
134
135Where `<ticket>` is the JIRA ticket number
136and `@username` is a user handle
137
138
139####Transitioning Tickets
140>`<ticket>` to `<state>`
141> `<ticket>` >`<state>`
142
143Where `<ticket>` is the JIRA ticket number
144and `<state>` is one of the following: `triage`, `icebox`, `backlog`, `devready`, `inprogress`, `design`
145
146
147####Watching Tickets
148>`<ticket>` watch [`@username]`]
149
150Where `<ticket>` is the JIRA ticket number
151`@username` is optional, if specified the corresponding JIRA user will become
152the watcher on the ticket, if omitted the message author will become the watcher
153
154
155####Ticket Notifications
156
157Whenever you begin watching a JIRA ticket you will be notified (via a direct
158message from @hubot) whenever any of the following events occur:
159 - a comment is left on the ticket
160 - the ticket is in progress
161 - the ticket is resolved
162
163You will also be notified if:
164 - you are mentioned on the ticket
165 - you are assigned to the ticket
166
167If you are assigned to a ticket, you will be notified when:
168 - a comment is left on the ticket
169
170To enable or disable this feature you can send the following directly to hubot:
171
172> jira disable notifications
173
174or if you wish to re-enable
175
176> jira enable notifications
177
178
179####Searching Tickets
180> hubot jira search `<term>`
181
182#####Optional `<term>` Attributes
183 _Labels_: include one or many hashtags that will become labels included in the search
184 `#quick #techdebt`
185
186Where `<term>` is some text contained in the ticket you are looking for##Documentation with Configuration examples from above