aleksandr-m / gitflow-maven-plugin

The Git-Flow Maven Plugin supports various Git workflows, including GitFlow and GitHub Flow. This plugin runs Git and Maven commands from the command line.
https://aleksandr-m.github.io/gitflow-maven-plugin/
Apache License 2.0
490 stars 182 forks source link

hotfix-start from support branch adds support branch name to hotfix branch #257

Closed vivekmalhotragithub closed 3 years ago

vivekmalhotragithub commented 3 years ago

https://github.com/aleksandr-m/gitflow-maven-plugin/blob/717be9068bf681cdd09a92ef3464f3c4dedd779d/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowHotfixStartMojo.java#L204-L207

Why we have this logic?

If I want to create a hotfix branch from an old tag eg 1.X.0 (not prod branch), then I create support branch support/1.X.0. I would still like to have a hotfix branch hotfix/1.X.1 but this logic creates hotfix/support/1.X.0/1.X.1

I am hotfixing via CI server and need control over the name of the hotfix branch.

vivekmalhotragithub commented 3 years ago

@aleksandr-m let me know if my PR is ok. Thanks!

aleksandr-m commented 3 years ago

@vivekmalhotragithub It is so because the hotfix-finish goal needs to know where it should merge hotfix branch.

vivekmalhotragithub commented 3 years ago

@aleksandr-m what is the correct usage of hotfixing from a tag? I tried these commands but it fails

mvn gitflow:support-start --batch-mode  -DpushRemote=true -DtagName=1.3.0
mvn gitflow:hotfix-start --batch-mode  -DpushRemote=true -DfromBranch=support/1.3.0
mvn gitflow:hotfix-finish --batch-mode  -DhotfixVersion=1.3.1

The documentation is not explicit about this scenario.

vivekmalhotragithub commented 3 years ago

Also I felt that hotfix-start should allow creating a hotfix branch from a tag directly rather than creating a support branch first. What do you think about that ?

vivekmalhotragithub commented 3 years ago

I would also like to know your thoughts on allowing hotfix-start from a tag instead of a branch. This way we don't need support branches.

aleksandr-m commented 3 years ago

@vivekmalhotragithub What error do you get?

Where are you going to merge it after, if it is started from the tag?

vivekmalhotragithub commented 3 years ago

@aleksandr-m so I am running hotfix-start and hotfix-finish in separate CI Jenkins jobs. Consider I am hotfixing from a support branch support/1.11.0

mvn gitflow:hotfix-start --batch-mode -DpushRemote=true -DfromBranch=support/1.11.0

and later in a separate CI job

mvn gitflow:hotfix-finish --batch-mode  -DhotfixVersion=support/1.11.0/1.11.1

Second command fails with error

[ERROR] Failed to execute goal com.amashchenko.maven.plugin:gitflow-maven-plugin:1.14.0:hotfix-finish (default-cli) on project ****: hotfix-finish: Hotfix branch with name 'hotfix/support/1.11.0/1.11.1' doesn't exist. Cannot finish hotfix. -> [Help 1]

The reason i found was hotfix-finish expects that support and hotfix branches are checked out locally which is weird considering i am running on CI server.

Also probably you are right we cannot start a hotfix directly from a tag.

aleksandr-m commented 3 years ago

Duplicate of #219.