Task Sync Plugin for Redmine

    image

    We continue to finish Redmine to our needs.
    At different times, for several large (and not only) clients, individual redmine instances were installed at their request.
    Basically, they are used for the personal needs of the client: managing code repositories, internal tasks.
    But also in these trackers tasks were set for the system administrator, that is, for us.
    Projects grew in volume and quantity, and a critical moment came when it became difficult to follow several trackers at once. At the same time, it’s convenient for the client to use his tracker, and going to ours to set up the administration task is lazy, and it’s just a waste of time.

    In view of this situation, we decided to write with the help of our ruby ​​developer kanfeta plugin for redmine that would collect tasks from all trackers into ours.
    Under the cat installation and operation of the plugin is described.



    Install and configure the plugin


    Typical installation.
    Clone the plugin with github:
    git clone https://github.com/olemskoi/redmine_synchrony.git /opt/redmine/plugins/redmine_synchrony
    


    and start the migration:
    bundle exec rake redmine:plugins:migrate RAILS_ENV="production"
    


    Restarting Redmine.

    Next, we configure: we go through the following menu items - "Administration" - "Modules".
    There we see our plugin in the list:
    image

    Select "Parameters".

    Click image

    Get a list of fields to fill in:
    image

    What is what:

    • The site address for synchronization is the URL of the remote Redmine, from which you need to pull information
    • The API key is the api key of the user under which authorization will take place from our Redmine to the remote one. The user must have at least read permissions to the project.
    • Tracker for synchronization - the name of the tracker on the remote Redmine. Information about tasks will be taken from this terker. To synchronize tasks, they must be set in this tracker on a remote Redmine.
    • A local project for tasks is the name of the project in our Redmine. Tasks from a remote tracker will be created / updated in it.
    • Local tracker for tasks - the name of the local tracker.
    • The language for creating comments is the language of comments.


    After filling in the fields, we save the changes.

    You can add as many trackers as you like.
    There are the following restrictions:
    • Project IDs in the local Redmine must not overlap. That is, only one remote project can be synchronized into one local project.
    • The scheme works for versions of Redmine from 2.2.x and higher.


    To work, we need a task in cron that will initiate the update.
    In our particular case, the task looks like this:

    */05 * * * * redmine cd /opt/redmine && PATH=/usr/local/bin:$PATH /usr/bin/bundle exec rake -f /opt/redmine/Rakefile redmine_synchrony:issues RAILS_ENV="production" >/dev/null 2>&1
    


    In case the plugin settings are incorrect, this task will fall out with an error. Therefore, at the turn-on and debugging stage, it is better to include the command output in the log file.

    Principle of operation


    The plugin works according to the following scheme: cron task starts synchronization.
    Our local Redmine passes through the API to the remote one and watches the task changes in the tracker specified in the “Tracker for synchronization” settings field.
    Changes are tracked over the past day.
    In the case of creating a new task in the remote Redmine, it is created both in the local one with the full text of the task and with reference to the original one.
    When updating a task on a remote Redmine on a local, a comment is created in the corresponding task. The text of the comment indicates the change in the status of the task, the user who updated it, the priority, if it has been changed, and the text of the comment in the original task.

    Statuses, priorities and user are written in text in comments for the simple reason that the values ​​of these parameters on the local and remote redmine do not match.

    That's all for me.
    I will be glad to advice and suggestions.
    Based on them we will do the necessary improvements.
    Thanks for attention!

    Also popular now: