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.

Home Page:https://aleksandr-m.github.io/gitflow-maven-plugin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with release-start goal creating multiple release branches

jelingi opened this issue · comments

When executing the release-start goal of the Gitflow Maven Plugin in Jenkins, it appears that the remote check is not executed correctly. Even if there is already an existing release branch, running the release-start goal again results in the creation of a new release branch, instead of thowing the error "Release branch already exists. Cannot start release."

GitFlowReleaseStartMojo.java:153-157
final String releaseBranch = gitFindBranches(gitFlowConfig.getReleaseBranchPrefix(), true); if (StringUtils.isNotBlank(releaseBranch)) { throw new MojoFailureException("Release branch already exists. Cannot start release."); }

Plugin Version: 1.20
Jenkins Log:

  • mvn com.amashchenko.maven.plugin:gitflow-maven-plugin:1.20.0:release-start -DpushRemote=true -DcommitDevelopmentVersionAtStart=true -DallowSnapshots=false -DbranchName=19.0.x -DuseSnapshotInRelease=false -DversionDigitToIncrement=0
    Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext.class.path="/opt/webapp.dist.lin/base/jenkins/workspace/workspace/Architektur/maven-gitfllow/release/start_release@tmp/withMavenf4e61d67/pipeline-maven-spy.jar" -Dorg.jenkinsci.plugins.pipeline.maven.reportsFolder="/opt/webapp.dist.lin/base/jenkins/workspace/workspace/Architektur/maven-gitfllow/release/start_release@tmp/withMavenf4e61d67"
    Failed to load native library:jansi-2.4.0-2822e37509ba08b3-libjansi.so. The native library file at /tmp/jansi-2.4.0-2822e37509ba08b3-libjansi.so is not executable, make sure that the directory is mounted on a partition without the noexec flag, or set the jansi.tmpdir system property to point to a proper location. osinfo: Linux/x86_64
    java.lang.UnsatisfiedLinkError: /tmp/jansi-2.4.0-2822e37509ba08b3-libjansi.so: /tmp/jansi-2.4.0-2822e37509ba08b3-libjansi.so: failed to map segment from shared object
    [INFO] [jenkins-event-spy] Generate /opt/webapp.dist.lin/base/jenkins/workspace/workspace/Architektur/maven-gitfllow/release/start_release@tmp/withMavenf4e61d67/maven-spy-20231214-120605-3782459818337976087453.log.tmp ...
    [INFO] Scanning for projects...
    [INFO]
    [INFO] -------------------< de.gw:maven-gitflow-sample >-------------------
    [INFO] Building de.gw:maven-gitflow-sample 19.0.0-SNAPSHOT
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO]
    [INFO] --- gitflow-maven-plugin:1.20.0:release-start (default-cli) @ maven-gitflow-sample ---
    [INFO] Checking for uncommitted changes.
    [INFO] Fetching remote from 'origin'.
    [INFO] Local branch 'develop' doesn't exist. Trying check it out from 'origin'.
    [INFO] Creating a new branch 'develop' from 'origin/develop' and checking it out.
    [INFO] Checking out 'develop' branch.
    [INFO] Checking for SNAPSHOT versions in dependencies.
    [INFO] Version is blank. Using default version.
    [INFO] Updating version(s) to '19.0.0'.
    [INFO] Committing changes.
    [INFO] Creating a new branch 'release/19.0.x' from 'develop'.
    [INFO] Updating version(s) to '20.0.0-SNAPSHOT'.
    [INFO] Committing changes.
    [INFO] Checking out 'release/19.0.x' branch.
    [INFO] Pushing 'develop' branch to 'origin'.
    [INFO] Pushing 'release/19.0.x' branch to 'origin'.
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 7.550 s
    [INFO] Finished at: 2023-12-14T12:06:13+01:00
    [INFO] ------------------------------------------------------------------------

If I execute the command in the Pipeline :
sh "git for-each-ref '--format=%(refname:short)' refs/heads/release/** refs/remotes/origin/release/**"

All the refs are shown correctly:

  • git for-each-ref '--format=%(refname:short)' 'refs/heads/release/' 'refs/remotes/origin/release/'
    origin/release/17.8.x
    origin/release/18.0.x
    origin/release/19.0.x

Do you have any ideas why the check for existing remote branches isnt working correclty in the plugin ?

Kind regards
Jelin