Gitflow-like plugin

Added by Mauro Condarelli about 1 year ago

Foreword:
I'm a long time user of Redmine and a rather experienced programmer, but I have no experience in Ruby, Rails and associated topics, so I'm bound to make ugly mistakes. I'm thus here to seek advice.

Background:
I am now in charge of a small group of programmers who have, up to now, coded in a rather unruly way; since the group is growing and it's geographically separated I've been asked to setup a suitable work environment.

Current Status:
I installed a server with Redmine, gitolite-integration plugin, git and a bunch of repositories. People is using Git, but mostly ignores Redmine if not as an archive of bugs: fixed ones remain open for ages (i.e.: until I close them).

Proposed path:
Since I do not believe in coercing people to do things in a certain way against their will I would like to set-up an environment that makes it easier for them to work in a "correct" (?) way.
My idea is to write a Plugin for Redmine to tightly integrate Git in the workflow.
Git workflow should be something resembling GitFlow(http://nvie.com/posts/a-successful-git-branching-model/) (while I think it's over-complex, it is somewhat standard and contains a lot of sensible guidelines).
I would like to have something which is "the reverse" of Mikoto's "Redmine Git Branch Hook"(http://www.redmine.org/plugins/redmine_git_branch_hook): something that will perform Git actions triggered from Issue editing.

Stumbling block:
First, somewhat obvious, problem is Redmine runs on the server (together with Git repositories), while the Working Directories are on client machine, next to the browser. This means the appropriate git commands (git branch/git commit/etc.) should be run on the client, triggered from server (i.e.: the Redmine plugin). This can be done with nodejs (e.g. see: http://unix.stackexchange.com/a/212027/130498) and Python (e.g. see: http://stackoverflow.com/a/30964245/1714490); can the same be done in Redmine environment? If so: how?

Detailed Proposal:
  • Enhance the Issue page adding:
  • A reference to the working directory.
  • A reference to the starting point for the work (master, if blank).
  • Add a hook to Issue update performing the following tasks (roughly):
  • New -> In Progress
  • Check working directory is clean.
  • Checkout starting point.
  • Create a branch named after Issue id.
  • In Progress -> in Progress:
  • Commit (using update message as commit message).
  • Push changes to branch.
  • In Progress -> Resolved:
  • Commit (if Working dir is not clean).
  • Push to branch (if committed).
  • Rebase with current status of starting point (if not a Label).
  • Push changes to "integration" branch.
  • Trigger, if defined, automated rebuild.
  • Trigger testing.
  • Resolved -> Closed:
  • Merge to "master".
  • Delete working branch.
  • Checkout "master".

As said I have no experience with Redmine programming (aside having done some work with REST APIs, sone years ago) so I would like to have an expert advice on actual feasibility of such a schema and, possibly, some tutelage to avoid the worst mistakes.

Any comment will be very appreciated