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

Rebase hotfixes #35

Open
ciltocruz opened this issue Jun 24, 2022 · 2 comments
Open

Rebase hotfixes #35

ciltocruz opened this issue Jun 24, 2022 · 2 comments

Comments

@ciltocruz
Copy link

Hello.

I have a problem and I want to ask if there is any way to solve it. It is not a bug of the plugin. it works quite well, but I have found a casuistry in which it has caused an error. I don't know if I haven't configured it correctly.

I've made a feature (feat 1) and merged it into my develop branch. This feature is in the testing phase. Suddenly a hotfix appears in production (main).

The hotfix is pushed to main directly (hotfix/someName --> main).

When doing "rebase" from main to develop, the problem appears indicating that there are previous commits (feat 1) and that I must pull.

[5:04:31 PM] [semantic-release] [@saithodev/semantic-release-backmerge] › ℹ  Performing back-merge into develop branch "develop".
[5:04:31 PM] [semantic-release] [@saithodev/semantic-release-backmerge] › ℹ  Branch is detached. Checking out release branch "main".
[5:04:31 PM] [semantic-release] [@saithodev/semantic-release-backmerge] › ℹ  Checking out develop branch "develop".
[5:04:31 PM] [semantic-release] [@saithodev/semantic-release-backmerge] › ℹ  Performing backmerge with "rebase" strategy.
[5:04:31 PM] [semantic-release] [@saithodev/semantic-release-backmerge] › ℹ  Loading plugins
[5:04:31 PM] [semantic-release] [@saithodev/semantic-release-backmerge] › ℹ  Executing "done" step of plugins
[5:04:31 PM] [semantic-release] [@saithodev/semantic-release-backmerge] › ℹ  Found 0 staged files for back-merge commit
[5:04:31 PM] [semantic-release] [@saithodev/semantic-release-backmerge] › ℹ  Pushing backmerge to develop branch develop
[5:04:32 PM] [semantic-release] [@saithodev/semantic-release-backmerge] › ✖  Process aborted due to an error while backmerging a branch.
[5:04:32 PM] [semantic-release] [@saithodev/semantic-release-backmerge] › ✖  Error: Command failed with exit code 1: git push [REPO_URL] HEAD:develop 
To [REPO_URL]
 ! [rejected]        HEAD -> develop (non-fast-forward)
error: failed to push some refs to '[REPO_URL]'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.

Can I solve it with this plugin or do I have to rebase the hotfixes manually?

@saitho
Copy link
Owner

saitho commented Jun 29, 2022

Hi @ciltocruz,

this plugin is mainly a hacky way to achieve simple backmerges with semantic-release.
So far, hotfixes have not been part of the scope. There's also a note in the readme about this:

Especially automatic hotfix releases may not be possible as those usually lead to merge conflicts with develop that have to be resolved manually. In such cases the release workflow will fail, causing a red pipeline!

But merge conflicts are not your issue.
You're rebasing develop onto main, so commits in develop but not in master will get a new commit hash.
You'd need to push that develop branch with -f for the push to get through; however this would also wipe other changes on the develop branch that are pushed during pipeline run.

Can you try to use backmergeStrategy: merge instead?

@ciltocruz
Copy link
Author

Hello @saitho
I tried. Unsuccessfully.

What I am doing now is that when this happens, then the pipeline fails but only because of the update of the develop branch on main. So what I do is do it manually.

Thanks!

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

2 participants