For confluence I'm happy with the JobModule and TriggerModule types. What is the right way to implement periodic task in jira? I would like to extends the list of jobs and triggers in jira.
Thanks in advance,
Lars
There are 2 options in JIRA. Run as a service as Radu suggested.
http://www.j-tricks.com/1/post/2010/11/jira-service.html
Or run a scheduled task. Service run at regular intervals but not at specified times. This is where scheduled tasks are important.
http://www.j-tricks.com/1/post/2011/05/scheduled-tasks-in-jira.html
implement com.atlassian.jira.service.JiraService
or
extend com.atlassian.jira.service.AbstractService
and declare it as a component in atlassian-plugin.xml
I have done something a little bit similar, that is, setup a JIRA project to help humans manage periodic tasks such as software license renewals or SSL certificate renewals.
We have been using this for about two years, but, today I am reproducing it in another JIRA instance, so I thought I would document this for the community. Comments/improvements are welcome!
I create a project "Periodic Tasks".
I create a status "Inactive" which allows periodic tasks to be disabled but stay in the system. The status "Closed" would probably work just as well, but, we liked Inactive better. I also created a simple workflow that allows these issues to be inactivated and activated. I am not documenting the workflow here because I think it adds little value, I think "Closed" and "Reopened" would work just as well.
Add "Periodic Task Issue Type Scheme" with Issue Types "Task" and "Sub-task".
Associate "Periodic Task Issue Type Scheme" with project "Periodic Tasks".
Add components "Hardware maintenance/support renewal", "Software License or Support Renewal", "SSL Certificate Renewal", "Periodic Manual Review", "Business-related Annual Tasks", etc., etc.
Added a "Select List" custom field "Frequency" with drop-down values "Daily", "Weekly", "Biweekly", "Monthly", "Quarterly", "Annually".
Added a "Select List" custom field "Lead Time Requirement" with values "None", "1 day", "2 days", "3 days", "7 days", "14 days", "30 days", "60 days", "90 days". Add a description to "Lead Time Requirement" that states "Required lead time to ensure successful task completion. When the task due date is within this range the assignee will get reminders via email."
In our case these two custom fields, "Frequency" and "Lead Time Requirement", happen to have contexts set so that they only appear in project "Periodic Tasks", and I left them on the "Default Screen".
I don't currently have customized Screens or Screen Schemes for this project.
The meat of my implementation is in a filters and subscription.
Here is the relevant filters:
"Alert: Periodic Task due within Lead Time Requirement and no recent update":
Description:
A periodic task is due within the specified lead time requirement and there has been no recent (within 7 days) update to the issue. If you make any update to the issue this alert will be suppressed for 7 days.
JQL Query: project = PT and resolution = Unresolved and status != Inactive and updated <= "-1w" and assignee = currentUser() and (due < now() or ("Lead Time Requirement" = "90 days" and due < "90d") or ("Lead Time Requirement" = "60 days" and due < "60d") or ("Lead Time Requirement" = "30 days" and due < "30d") or ("Lead Time Requirement" = "14 days" and due < "14d") or ("Lead Time Requirement" = "7 days" and due < "7d") or ("Lead Time Requirement" = "3 days" and due < "3d") or ("Lead Time Requirement" = "2 days" and due < "2d") or ("Lead Time Requirement" = "1 day" and due < "1d"))
Sorted by: Key descending
I subscribe group "jira-users" to this filter.
This doesn't provide any automatic recurring issues, but, it does help humans manage periodic tasks.
I've tried a setup for a scheduled job as described in the j-tricks link. Unfortunately it does not work in jira 5. First I had to add key attributes to the job and trigger elements to get it compiling. After playing around with the configuration I finally ended up with a configuration which is taken from a confluence 3.5 plugin
<job key="sapPluginJob" name="SAP Plugin Job" class="net.bigpoint.jira.sapplugin.implementation.jobs.SapPluginJob"> </job> <trigger key="sapPluginJobTrigger" name="SAP Plugin Job Trigger" class="net.bigpoint.jira.sapplugin.implementation.jobs.SapPluginJobTrigger"> <job key="sapPluginJob"/> <managed editable="true" keepingHistory="true" canRunAdhoc="true" canDisable="true"/> <schedule cron-expression="0 30 5 * * ?"/> </trigger>
For some reason jira still refuses to enable the plugin modules without any error logs. It just remains disabled:
DEBUG admin 702x2614x1 - 127.0.0.1 /rest/plugins/1.0/ [atlassian.plugin.manager.DefaultPluginManager] Enabling pluginSettingsFactory DEBUG admin 702x2614x1 - 127.0.0.1 /rest/plugins/1.0/ [atlassian.plugin.manager.DefaultPluginManager] Enabling pluginConfiguration DEBUG admin 702x2614x1 - 127.0.0.1 /rest/plugins/1.0/ [atlassian.plugin.manager.DefaultPluginManager] Plugin module 'SAP Plugin Job' is explicitly disabled (or so by default), so not re-enabling. DEBUG admin 702x2614x1 - 127.0.0.1 /rest/plugins/1.0/ [atlassian.plugin.manager.DefaultPluginManager] Plugin module 'SAP Plugin Job Trigger' is explicitly disabled (or so by default), so not re-enabling. DEBUG admin 702x2614x1 - 127.0.0.1 /rest/plugins/1.0/ [atlassian.plugin.manager.DefaultPluginManager] Enabling configurationScript DEBUG admin 702x2614x1 - 127.0.0.1 /rest/plugins/1.0/ [atlassian.plugin.manager.DefaultPluginManager] Enabling restApi
I've tried to add the configuration to atlassian-plugin.xml instead of scheduler-config.xml. But unfortunately that would not solve my problem. The plugin should run out of the box without any complicated configuration stuff.
After digging in the developers documentation I've found another interesting approach https://developer.atlassian.com/display/DOCS/Plugin%20Tutorial%20-%20Scheduling%20Events%20via%20SAL maybe that will do the job ...
Actually, it worked for me in JIRA5. Scheduling events via SAL should work as well.
Nice. That's a creative solution, Larry.
What is the purpose of the frequency customfield? is would be nice if we could transition from inactive to active when the frequency field becomes relevant?
Could you also dive a brief overview of the workflow you use for this?
Thanks in advance
Warren
Warren,
I found something similar for a different purpose ..
here a Jelly script to change the ticket status automatically for all filter results .. you would need to
adjust the logic for your need..
https://confluence.atlassian.com/display/JIRACOM/Automating+issue+timeouts
-Goran..
Frequency was meant to accomodate tasks that might be monthly or even daily, but, in practice, we only use this project for annual tasks.
We use a very simple workflow with 3 status values, "Not Due", "Inactive", "Due". We don't really get much value from this workflow, we just use it to make an issue "Inactive" if the issues is going to be dormant for a while, but we don't actually want to delete it. We don't actually change the "Due" and "Not Due" in practice. I had intended to use Jelly scripts to change those based on due date and lead time, but, with the capability we have with filters and subscriptions, it never seemed like the workflow added enough value to be worth the work.
So the filters and subscriptions do all the useful work in our implementation.
Thank you guys, but have a look at the script runner's escalation service. I have used it to transition my tasks from inactive to active when they become relevant.
Regards,
For our internal use at ServiceRocket we implemented an add-on that uses issues as templates for the periodic task issues. The same issues also contain the frequency configuration. It's not available as a commercial product but please let us know if you'd be interested in that.
There is also https://marketplace.atlassian.com/plugins/pl.com.tt.jira.plugin.theschedulerprobut per https://bitbucket.org/apdc/the-scheduler/issue/28/can-i-make-thescheduler-re-open-anit won't reopen an existing issue.
See this:
https://marketplace.atlassian.com/plugins/com.codedoers.jira.repeating-issues
On JIRA Cloud there is a plugin available https://marketplace.atlassian.com/plugins/com.gebsun.atlassian.rtasks
Cheers, Gebsun
I have created some schedulers using following Link.https://developer.atlassian.com/server/framework/atlassian-sdk/scheduling-events-via-sal-tutorial/
Now I need to run it one of it every Midnight, one every Monday and one to every Month end . i tried to use following url mentioned approach but it didnt work .
Could somebody please suggest some ideas to set the scheduler interval to 1 week, or one month. I want my scheduler to run every Monday or every month end .
Thanks !!
It looks like you're new here. Sign in or register to get started.