-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.xml
361 lines (272 loc) · 17.7 KB
/
atom.xml
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[Alex Suslin]]></title>
<link href="http://alexsuslin.com/atom.xml" rel="self"/>
<link href="http://alexsuslin.com/"/>
<updated>2012-03-24T01:10:33+03:00</updated>
<id>http://alexsuslin.com/</id>
<author>
<name><![CDATA[Alex Suslin]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[Help Desk with Jira via emails]]></title>
<link href="http://alexsuslin.com/blog/2012/03/23/help-desk-with-jira-via-emails/"/>
<updated>2012-03-23T13:38:00+03:00</updated>
<id>http://alexsuslin.com/blog/2012/03/23/help-desk-with-jira-via-emails</id>
<content type="html"><![CDATA[<p>In our company we have two offices in USA and Europe. And we want to have a help desk platform and ability to create tickets via email. It is a common task and easily achievable with the help of JIRA, but we have some points, that are not so transparent how to reach.</p>
<h1>The Goals</h1>
<ol>
<li>Single email address to send inquires to.</li>
<li>Single project to manage all the help desk tickets for two locations.</li>
<li>Issues should be assigned to the proper person, depends on the location of the reporter.</li>
<li>No commercial plugins should be involved (in worst case create custom mail handler)</li>
</ol>
<h1>Investigation</h1>
<p>I’ve made some investigation, what we have and what is already written and how we can use it.</p>
<p>Jira already contains the basic mail handler that can be bound to the project. Unfortunately that handler is not supported several asignees (e.g. create component per location and assign task to the component lead). There is a commercial plugin <a href="https://studio.plugins.atlassian.com/wiki/display/JEMH/JEMH+Home" title="IRA Enterprise Mail Handler">JEMH</a> that supports assignment issues to component lead, however it is needed to write the component name in email somewhere (subject, body) or have different email addresses. And in our case we want to have single email address for all the tickets.</p>
<p>I spent some time on it cause there is a possibility to use it for free when all the preferences are made manually through the config file (in commercial version there is a GUI for that). The other issue is that JEMH can’t be installed to grab mails from the IMAP folder like the out-of-the-box JIRA mail handler.</p>
<p>The idea was to create some rules on the mail server (we’re using google apps) and filter USA and Europe employee’s mails, assign the proper label and assign tickets to the proper components regarding the IMAP folder they are in. Ideally the combination of Jira mail handler and JMEH will work for us.</p>
<p>And we’re nearly agreed on the following solution:</p>
<ul>
<li>Create separate projects in JIRA for USA and Europe offices</li>
<li>Each project will have its own Project lead</li>
<li>Setup to JIRA mail handlers and grab emails from the proper IMAP folder</li>
<li>Create some filters in gmail to apply the proper labels on mails.</li>
</ul>
<p>I’ve asked my question on <a href="https://answers.atlassian.com/questions/43383/email-to-project-assignee-by-component" title="Jira Answers">JIRA Answers</a>. Nobody answer with the working solution, however there were an idea about JIRA post functions. Digging in post functions the following solution was born:</p>
<hr />
<h1>Solution</h1>
<h2>JIRA Project</h2>
<ol>
<li>As a JIRA administrator create a project HELPDESK</li>
<li>Create 2 components “USA” and “EUROPE”</li>
<li>Assign to each of the component component lead</li>
</ol>
<h2>Add POP / IMAP Mail Server</h2>
<ol>
<li>Log in as a JIRA administrator</li>
<li>Go to Administration / System / Mail / Incoming Mail</li>
<li>Click the button “Add POP / IMAP mail server”</li>
</ol>
<table border=1>
<tr><th>Field</th><th>Value</th>
<tr><td>Name</td><td>Google App IMAP (or whatever you want)</td></tr>
<tr><td>Description</td><td>Email Handler is used to create issues by email</td></tr>
<tr><td>Service Provider</td><td>Google Apps Mail / Gmail (IMAP)</td></tr>
<tr><td>Timeout</td><td>10000</td></tr>
<tr><td>Username</td><td><your account name></td></tr>
<tr><td>Password</td><td><your account password></td></tr></table>
<pre><code>4. Test the connection and press "Add" button
</code></pre>
<h2>Mail Handlers</h2>
<ol>
<li>Press the button “Add incoming mail handler”</li>
<li>First Screen:</li>
</ol>
<table border=1>
<tr><th>Field</th><th>Value</th>
<tr><td>Name</td><td>Help Desk</td></tr>
<tr><td>Server</td><td>Google App IMAP</td></tr>
<tr><td>Delay</td><td>1</td></tr>
<tr><td>Handler</td><td>Create a new issue or add a coment</td></tr>
<tr><td>Folder Name</td><td><leave blank></td></tr></table>
<ol>
<li>Second Screen:</li>
</ol>
<table border=1>
<tr><th>Field</th><th>Value</th></tr>
<tr><td>Project</td><td>HELPDESK (or whatever project you are going to use)</td></tr>
<tr><td>Issue Type</td><td>Task</td></tr>
<tr><td>Bulk</td><td>Ignore the email and do nothing</td></tr>
<tr><td>Forward Email</td><td>helpdesk@company.com</td></tr>
<tr><td>Create User</td><td>False</td></tr>
<tr><td>Default Reporter</td><td>username (put someone in charge)</td></tr>
<tr><td>Notify User</td><td>unchecked</td></tr>
<tr><td>CC Assignee</td><td>unchecked</td></tr>
<tr><td>CC Watchers</td><td>checked</td></tr></table>
<ol>
<li>Test and save</li>
</ol>
<h2>Groups</h2>
<ol>
<li>Create two groups of users: “usa-employee” and “europe-employee”</li>
<li>Assign all the employee to these two groups</li>
</ol>
<h2>Script Runner Plugin</h2>
<p>As a JIRA administrator install the following plugin <a href="https://plugins.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner">Jira Script Runner</a></p>
<h2>Workflow</h2>
<ol>
<li>As a JIRA administrator go to Administration / Issues / Workflow</li>
<li>Copy your current workflow and change the name to “help-deksk-workflow”</li>
<li>Go to Design view of that workflow and the gear icon, selecting “View Post Functions” from the menu</li>
</ol>
<p><img src="http://alexsuslin.com/images/blog/workflow.png" alt="JIRA Workflow Design" /></p>
<ol>
<li>Click “Add Post Function” and select from the list “Script Post-Function”</li>
<li>In the Script file path field insert the path to your groovy script (server path), please see below for the script source of my script <strong>helpdesk.groovy</strong>:</li>
</ol>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>import com.atlassian.jira.ComponentManager
</span><span class='line'>import com.atlassian.crowd.embedded.api.User
</span><span class='line'>import com.atlassian.jira.issue.MutableIssue
</span><span class='line'>import com.atlassian.jira.project.Project
</span><span class='line'>import com.atlassian.jira.bc.project.component.ProjectComponent
</span><span class='line'>import com.atlassian.jira.util.collect.MapBuilder
</span><span class='line'>import webwork.dispatcher.ActionResult
</span><span class='line'>import com.atlassian.core.ofbiz.CoreFactory
</span><span class='line'>import com.atlassian.jira.action.ActionNames
</span><span class='line'>import com.atlassian.jira.security.groups.GroupManager
</span><span class='line'>ComponentManager componentManager = ComponentManager.getInstance()
</span><span class='line'>User remoteUser = componentManager.getJiraAuthenticationContext().getLoggedInUser()
</span><span class='line'>MutableIssue issue = issue
</span><span class='line'>User currentAsignee = issue.getReporter()
</span><span class='line'>GroupManager groupManager = ComponentManager.getComponentInstanceOfType(GroupManager.class)
</span><span class='line'>Project project = issue.getProjectObject()
</span><span class='line'>ProjectComponent component = null
</span><span class='line'>if (groupManager.isUserInGroup(currentAsignee.getName(), "EUROPE"))
</span><span class='line'> component = componentManager.getProjectComponentManager().findByComponentName(project.getId(), "EUROPE")
</span><span class='line'>else if (groupManager.isUserInGroup(currentAsignee.getName(), "USA"))
</span><span class='line'> component = componentManager.getProjectComponentManager().findByComponentName(project.getId(), "USA")
</span><span class='line'>if(component != null)
</span><span class='line'>{
</span><span class='line'> issue.setAssigneeId(component.getLead())
</span><span class='line'> issue.setComponents([component.getGenericValue()])
</span><span class='line'>
</span><span class='line'> Map<String, Object> actionParams = MapBuilder.build("issue", issue.getGenericValue(), "issueObject", issue, "remoteUser", remoteUser, "dispatchEvent", Boolean.FALSE);
</span><span class='line'> ActionResult aResult = CoreFactory.getActionDispatcher().execute(ActionNames.ISSUE_UPDATE, actionParams);
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>
<p>Code is obvious. It’s a groovy script (to be honest, never dealt with it before and java itself). It’s just trying to resolve the reporter group and if the reporter in USA group, the task is updated with proper component and component lead. The same for the EUROPE group.</p>
<ol>
<li>Save the post function and the workflow.</li>
<li>Go to Workflow schemes and create the new one “help-desk-scheme” and assign the “help-desk-workflow” workflow for lets say just tasks.</li>
</ol>
<h2>The Final One</h2>
<ol>
<li>Now go to project “HELPDESK” / Administer Project</li>
<li>Open “Workflows” tab. Action / Select a scheme and choose our “help-desk-shcema” as a primary schema for the project.</li>
<li>Here we’re!</li>
</ol>
<h2>Testing</h2>
<p>Now, lets try to send email to our helpdesk mail addess. You should see something like:
<img src="http://alexsuslin.com/images/blog/help-desk-assignment.png" alt="Hooray! It's working!" /></p>
<hr />
<p>Hope that helps someone else!</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Daily backup Atlassian JIRA & Confluence on Windows]]></title>
<link href="http://alexsuslin.com/blog/2012/02/06/daily-backup-atlassian-jira-and-confluence-on-windows/"/>
<updated>2012-02-06T17:52:00+03:00</updated>
<id>http://alexsuslin.com/blog/2012/02/06/daily-backup-atlassian-jira-and-confluence-on-windows</id>
<content type="html"><![CDATA[<h1>Requirements:</h1>
<ul>
<li>daily jira & confluence mysql database backup;</li>
<li>daily backup of jira & confluence attachments directory;</li>
<li>backups archiving;</li>
<li>deleting the old backups (more than 14 days);</li>
</ul>
<p>Please note that I had a requirements for windows machine, and I understand that linux provides more scalabale and elegant way to do that. That is a basic script that can be used as a working solution, any system administrator can do that without my help :)</p>
<p>At first, let’s define the variables:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>::Path to the directory with attachments (JIRA or Confluence)
</span><span class='line'>set attachments="C:\Program Files\Atlassian\Application Data\JIRA\data"
</span><span class='line'>
</span><span class='line'>:: Path to the directory for daily backups
</span><span class='line'>set backup_folder=D:\Backups\Atlassian\JIRA\daily_backups
</span><span class='line'>
</span><span class='line'>:: Path to mysqldump.exe
</span><span class='line'>set mysqldump_path="C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe"
</span><span class='line'>
</span><span class='line'>:: Username of MySQL database
</span><span class='line'>set dbuser=root
</span><span class='line'>
</span><span class='line'>:: Password to MySQL database
</span><span class='line'>set dbpass=<change password>
</span><span class='line'>
</span><span class='line'>:: Database that we're going to backup (JIRA or Confluence)
</span><span class='line'>set dbname=jiradb</span></code></pre></td></tr></table></div></figure>
<p>Every backup should have a unique name. So I’m proposing to use year, month, day and time interval in that name.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set dt=%%c-%%a-%%b)
</span><span class='line'>For /f "tokens=1-4 delims=:." %%a in ('echo %time%') do (set tm=%%a%%b%%c%%d)
</span><span class='line'>set backupdate=%1%dt%_%tm%
</span><span class='line'>set date_folder=%1%dt%</span></code></pre></td></tr></table></div></figure>
<p>Please feel free to name it as you wish. In my case the name pattern is : [db name].YYYY-MM-DD_tt</p>
<p>date_folder variable is for a directory. I’d like to have a folder with the name like YYYY-MM-DD that will be created on a daily basis and put the proper backups in it.</p>
<p>Thus, let’s create the directory if it is not created yet:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>if exist %backup_folder%\%date_folder% GOTO NODIR
</span><span class='line'> mkdir %backup_folder%\%date_folder%
</span><span class='line'>:NODIR</span></code></pre></td></tr></table></div></figure>
<p>After that, the regular backup process with the help of mysqldump and archiving with 7zip. After that we can clean the archived file (as we have archive).</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>%mysqldump_path% --user=%dbuser% --password=%dbpass% --databases %dbname% > "%backup_folder%\%date_folder%\%dbname%.%backupdate%.sql"
</span><span class='line'>"zip\7za.exe" a -tzip "%backup_folder%\%date_folder%\%dbname%.%backupdate%.zip" "%backup_folder%\%date_folder%\*.sql"
</span><span class='line'>del "%backup_folder%\%date_folder%\*.sql"</span></code></pre></td></tr></table></div></figure>
<p>Do not forget to archive our attachments:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>"zip\7za.exe" a -tzip %backup_folder%\%date_folder%\attachments.%backupdate%.zip %attachments%</span></code></pre></td></tr></table></div></figure>
<p>And what we still have to do is to delete the old backups:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>forfiles -p %backup_folder% -s -d -14 -c "cmd /c if @isdir == TRUE rd /s /q @path"</span></code></pre></td></tr></table></div></figure>
<p>That’s it! Now we can use that batch script in Windows Task Scheduler and scheduled it on a daily basis.</p>
<p>P.S. If the task is not working, please check:
- Task should be launched even when the user is logged off
- The user that is launching that task has the permissions to do that (r/w permissions)
- Task should be launched from the directory where the script is located (optional parameter, but it is required to set the proper path)</p>
<p>P.P.S. If you would like to download script, please find it here: <a href="http://dl.dropbox.com/u/135608/jira_confluence_backup_win.zip" title="Batch script to backup JIRA and Confluence.">download</a></p>
]]></content>
</entry>
</feed>