gitflow-maven-plugin icon indicating copy to clipboard operation
gitflow-maven-plugin copied to clipboard

[Question] Is it possible to resume a hotfix-finish goal after a manual merge?

Open margingrotle opened this issue 6 years ago • 3 comments

Hi and thanks for the plugin,

My company just started using this plugin and we recently bumped into a issue when running the gitflow:hotfix-finish goal. The goal failed due to a merge conflict that had to be resolved manually when trying to merge from the hotfix branch to the develop branch. After resolving the conflict manually we wanted the hotfix-finish goal to continue where it left off. However, we couldn't figure out how to do this. Our workaround was to do the remaining steps of the hotfix-finish goal manually, i.e updating back to snapshot version. deleting the hotfix branch and pushing changes to remote.

I'm sure this isn't a new issue, and we've tried searching the web for a solution, but no satisfying answers caught our attention. Therefore:

  1. Is it possible to resume a gitflow:hotfix-finish goal after doing a manual merge?
  2. If not, are there any plans to support this?

For the reference. Here's a excerpt of the log:

[INFO] --- gitflow-maven-plugin:1.9.0:hotfix-finish (default-cli) @ project1 --- [INFO] Checking for uncommitted changes. [INFO] Fetching remote branch 'origin hotfix/5.2.2'. [INFO] Comparing local branch 'hotfix/5.2.2' with remote 'origin/hotfix/5.2.2'. [INFO] Fetching remote branch 'origin develop'. [INFO] Comparing local branch 'develop' with remote 'origin/develop'. [INFO] Fetching remote branch 'origin master'. [INFO] Comparing local branch 'master' with remote 'origin/master'. [INFO] Checking out 'master' branch. [INFO] Merging (--no-ff) 'hotfix/5.2.2' branch. [INFO] Creating '5.2.2' tag. [INFO] Running Maven goals: deploy -DskipTests [INFO] Checking out 'develop' branch. [INFO] Updating version(s) to '5.2.2'. [INFO] Committing changes. [INFO] Merging (--no-ff) 'hotfix/5.2.2' branch. ......................................................................... [ERROR] Failed to execute goal com.amashchenko.maven.plugin:gitflow-maven-plugin:1.9.0:hotfix-finish (default-cli) on project project1: hotfix-finish: Auto-merging file1 [ERROR] CONFLICT (content): Merge conflict in file1 [ERROR] Auto-merging file2 [ERROR] Auto-merging file3 [ERROR] Auto-merging file4 [ERROR] Automatic merge failed; fix conflicts and then commit the result. [ERROR] -> [Help 1]

margingrotle avatar May 18 '18 09:05 margingrotle

  1. Currently - No.
  2. Yes. I was thinking about adding it, but my solution requires total rewrite of goals execution logic. PR-s, ideas are welcome.

aleksandr-m avatar May 21 '18 20:05 aleksandr-m

Idea: If the automatic merge fails, or if one knows it will fail in advance, having an option to supply a patch might be a less expensive alternative, compared to a rewrite to achieve the resume functionality. Something like:

$ mvn gitflow:hotfix-finish -DpreDevMergePatch=path/to/my.patch

So after merging into the production/support branch (which shouldn't yield any conflicts?) but before merging into the development branch here, the plugin would apply that patch and continue by using the merge strategy "ours". I believe this would also work for many CI systems that support text-based build parameters.

Does this make sense for everybody?

beatngu13 avatar Sep 18 '20 09:09 beatngu13

Current workaround: our CI pipeline has an option to skip the merge into develop, i.e., it optionally appends skipMergeDevBranch to the arg line. So if hotfix-finish fails due to merge conflicts, the user enables that option to finish the hotfix and execute the merge into master. Afterwards, the user creates a feature branch from develop, merges master into that feature branch and manually resolves the merge conflicts, and then opens a PR.

This way, the CI pipeline can succeed and merge conflicts can be resolved after the hotfix release.

beatngu13 avatar Apr 21 '22 20:04 beatngu13