Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict handling #366

Closed
AdrienHorgnies opened this issue Nov 8, 2022 · 6 comments
Closed

Conflict handling #366

AdrienHorgnies opened this issue Nov 8, 2022 · 6 comments

Comments

@AdrienHorgnies
Copy link

AdrienHorgnies commented Nov 8, 2022

Hi,

Using any finish flow that involves merging, the plugin can crash due to git conflicts.
It's mainly a problem for release-finish, which I will focus on in this issue.

As far as I understand, it's currently not possible to skip merging the commit done on the release branch. Depending on the configuration, one of the three following reference is merged:

  • release branch
  • tag
  • master

So if there's a git conflict between the release branch and develop, it's not possible to use release-finish before manually solving the conflict, and it's blocking the release-finish from finishing.

Most of the time, I don't have the option to delay the release, and I basically reproduce the effect of the release-finish goal minus the merge into develop.

Is there something I'm missing ?

I'd like to suggest and implement (myself) one of the following :

  • Give an option to skip merging into develop
  • Give an option to not crash on merge conflict, and simply give up merging.
  • Give an option to not crash on merge conflict, and create a branch that the developer must manually merge.

Any of these three options would allow the developer to try the goal once, fail, then retry without the conflicting merge.

@AdrienHorgnies
Copy link
Author

Related to #352 .

@aleksandr-m
Copy link
Owner

Give an option to skip merging into develop

Something like that should be implemented to support protected branches and opening PR-s - see #363.

Give an option to not crash on merge conflict, and simply give up merging.

We still need to report merge conflicts to user and somehow handle pushing, tagging, branch deletion, etc.

Give an option to not crash on merge conflict, and create a branch that the developer must manually merge.

Can you explain it further?

@AdrienHorgnies
Copy link
Author

AdrienHorgnies commented Nov 13, 2022

Give an option to skip merging into develop

See PR #368 for the option (only skipping merge, not the part about creating a PR).

We still need to report merge conflicts to user

True. How would we do that ? It should be something that a CI can easily pick up to assign the build / stage a corresponding status. So... An exit status ? A text file ? A local git branch ? A remote git branch ? I think I prefer the remote git branch, see next point.

Give an option to not crash on merge conflict, and create a branch that the developer must manually merge.

  1. The plugin tries to merge the reference X (release, tag or master depending on the options) into develop.
  2. It fails
  3. It aborts the merge
  4. It creates a branch Y that reference the current HEAD of X
  5. It pushes branch Y along whatever reference it must push
  6. It somehow reports that the developer should merge branch Y into develop. The branch can be considered enough, given a special name, any decent CI will pick it up and be able to notify the developer (either by manually checking the existence of the branch during the build that ran the plugin, or as a job picks up the new branch and triggers a build on it). Or it could create a PR (and it joins the idea of Protected master branch: create PR #363 but for develop).

An alternative could be :

  1. The plugin tries to merge the reference X (release, tag or master depending on the options) into develop.
  2. It fails
  3. It aborts the merge
  4. It creates a branch Y that reference the current HEAD of X
  5. It tries to merge develop into Y
  6. It fails (theses are the same two commits as during step 2, just different branches)
  7. It commits the conflicts as is
  8. It pushes branch Y along whatever reference it must push
  9. It somehow reports that the developer should merge branch Y into develop. Though, the newly created git branch is something that any decent CI should pick up, so it could be considered enough ? Or it could create the PR.

We could try to make these solutions generic to any merge conflict, implement several of them of offer them as conflict handling strategies the plugin user could use from. Though in some cases, the plugin makes two merges sequentially, so if the first merge fail, the plugin should fail no matter what. Anyway, most of the time, it's the merge into develop that will fail. A merge into master should never fail (but it can, so the plugin should crash and not try to handle the conflict).

@sriram0721
Copy link

Hello,

Can we use <skipMergeDevBranch> to our pom.xml for not merging to develop directly now. Is the PR merged ? Super excited to use this feature

@sriram0721
Copy link

can we have a post-release branch (an intermediate branch) to handle merge conflict. After finish goal, once main is merged, it will create an intermediate branch and creates a MR to develop. The developers can merge the commit to develop upon resolving conflicts ? @aleksandr-m @AdrienHorgnies

@aleksandr-m
Copy link
Owner

The skipReleaseMergeDevBranch parameter added in 401c692

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants