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
487 stars 180 forks source link

hotfix-finish is failing on Jenkins #380

Closed EricMorel35 closed 1 year ago

EricMorel35 commented 1 year ago

Hello,

First of all, thank you for this great plugin! Unfortunately, I encounter an issue in my project sample when i want to close a hotfix automatically using Jenkins pipelines. My plugin's configuration is the following:

           <plugin>
               <groupId>com.amashchenko.maven.plugin</groupId>
                <artifactId>gitflow-maven-plugin</artifactId>
                <version>1.19.0</version>
                <configuration>
                    <gitFlowConfig>
                        <productionBranch>main</productionBranch>
                        <developmentBranch>develop</developmentBranch>
                        <featureBranchPrefix>feature/</featureBranchPrefix>
                        <releaseBranchPrefix>release/</releaseBranchPrefix>
                        <hotfixBranchPrefix>hotfix/</hotfixBranchPrefix>
                        <supportBranchPrefix>support/</supportBranchPrefix>
                        <versionTagPrefix>v-</versionTagPrefix>
                        <origin>origin</origin>
                    </gitFlowConfig>
                    <mvnExecutable>./mvnw</mvnExecutable>
                    <fetchRemote>true</fetchRemote>
                    <pushRemote>true</pushRemote>
                    <versionDigitToIncrement>1</versionDigitToIncrement>

                    <commitMessages>
                        <releaseStartMessage>Bump version to @{version}</releaseStartMessage>
                        <releaseFinishMessage>Bump version to @{version}</releaseFinishMessage>
                        <hotfixStartMessage>Bump version to @{version}</hotfixStartMessage>
                        <hotfixFinishMessage>Bump version to @{version}</hotfixFinishMessage>
                        <tagReleaseMessage>Create tag @{version}</tagReleaseMessage>
                    </commitMessages>
                </configuration>
            </plugin>

I can create a hotfix using the same way (by Jenkins so). The plugin creates correctly the branch as expected but for a reason I don't understand the goal hotfix-finish is failing.

My case is the following: when the hotfix is discovered by Jenkins, I executed the stage i wrote to finish the hotfix using this command line:

script { POM_VERSION = readMavenPom().getVersion() } withMaven(maven: MAVEN_VERSION, mavenSettingsConfig: 'artifactory-settings-api') { sh(label: "Finish hotfix", script: "./mvnw -B -DhotfixVersion=${POM_VERSION} gitflow:hotfix-finish") }

The following error is generated by the plugin: [ERROR] Failed to execute goal com.amashchenko.maven.plugin:gitflow-maven-plugin:1.19.0:hotfix-finish (default-cli) on project gitflow: hotfix-finish: Hotfix branch with name 'hotfix/1.26.1' doesn't exist. Cannot finish hotfix. -> [Help 1]

I don't understand why i get this error because the hotfix branch exists: image

Could you help me ?

Thank you in advance!

aleksandr-m commented 1 year ago

@EricMorel35 Can be related to git clone. Take a look at https://github.com/aleksandr-m/gitflow-maven-plugin/issues/341

EricMorel35 commented 1 year ago

Thank you Aleksandar, That was totally the same issue by @jenslauterbach