merge before build in jenkins fails but should not

I have setup jenkins to build all feature branches in a project and before the build merge them to ‘develop’ since I’m more interested if the result of the merge builds rather than the feature branch itself.

This seem to work if the feature branch is based of develop HEAD but if the branch off point is before develop HEAD then jenkins says: ERROR: Branch not suitable for integration as it does not merge cleanly

  • Continuous integration with Git
  • Headless continuous integration with Jenkins
  • stderr: fatal: Couldn't find remote ref $GERRIT_REFSPEC
  • Automatize manual tasks after deployment of Salesforce project
  • How should I approach Continuous Integration and .NET Framework Versions
  • Have buildbot poll a git repository for new commits?
  • And this would be alright if there was a conflict. But there is no conflict. I have tested the merge manually in the console and the merge is automatically done.

    Also if comparing the feature branch and develop in atlassian stash it also shows a clean diff without any conflicts.

    I’m lost. Why can’t jenkins merge it?

  • PHPUnit code coverage generation causing memory exhaustion
  • Specify the git branch code to be deployed in Elastic Beanstalk environment
  • Securely deploy public repo to remote VM from Travis CI?
  • Git push error ' master -> master (branch is currently checked out)'
  • How do I let tell Git to warn me about possibly deleted remote branches
  • Is there a way to have ignored files show up in git status?
  • 4 Solutions collect form web for “merge before build in jenkins fails but should not”

    I found it myself. It was because git on the jenkins server wasn’t configured with author name/email.

    After configuring this (under additional behaviours) solved the problem.

    I had the same error where it was stuck trying to build a previous branch SHA-1. I removed the branch, it still tried to build the branch SHA-1 and failed the same way. I configured git with author name/email as suggested, but it still failed. I then removed the Jenkins workspace root directory and the error changed to “Could not checkout …”. I then recreated the branch directly from master, uploaded a minor change and created a pull request. Jenkins rebuilt the new branch correctly and began working again. This discusses the “Could not checkout” issue:

    I also found that this error occurred if Jenkins/git was configured to do a shallow clone. If you are shallow cloning you’ll need to disable it:

    1. uncheck “Shallow clone” in “Additional Behaviors -> Advanced clone behaviors” in the job config
    2. blank out the shallow clone depth (or it was still shallow cloning if there was any value here)
    3. delete any workspaces for this job, as it won’t “unshallow” the clone, it’ll need to re-clone.

    I have multiple projects in Gitlab that using jenkins, but sometimes a project will raise this problem. So I don’t think it’s because git name or email.

    Always, I git pull from the upstream, make sure the local is consistent with the remote, then git commit --amend(you can just quit, don’t need to edit it) –> git pull -0> git push –> start jenkins.

    Git Baby is a git and github fan, let's start git clone.