jenkinsci / jenkinsci/git-plugin

[JENKINS-40381] PreBuildMerge --ff-only fails to send notification mails for non-ff branches

Open
#3,010 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component:git-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

Consider a job is configured with

  • Branches to build: Branch specifier: for-master/**
  • Additional Behaviours
    • Merge before build
      • Branch to merge to: master
      • Fast-forward mode: --ff-only
    • Calculate changelog against a specific branch
      • Name of branch: master

It is clearly possible, with this configuration, to calculate the changelog and thus identify who should receive failure notifications, even if the branch to build is not a fast-forward.

This isn't done, though, so if someone pushes a branch for-master/foo that is not a fast-forward of master, then the job will fail with a message like this:

ERROR: Branch not suitable for integration as it does not merge cleanly: Command "git merge --ff-only c33c4e240696ae203c257991ef4bfde9a939a4fa" returned status code 128:
stdout: 
stderr: fatal: Not possible to fast-forward, aborting.
...
...
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: FAILURE

The changelog should be computed before the branch merging so a notification can be sent out.


Originally reported by tsondergaard, imported from: PreBuildMerge --ff-only fails to send notification mails for non-ff branches
  • status: Open
  • priority: Minor
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-02
Raw content of original issue

Consider a job is configured with

  • Branches to build: Branch specifier: for-master/**
  • Additional Behaviours
    • Merge before build
      • Branch to merge to: master
      • Fast-forward mode: --ff-only
    • Calculate changelog against a specific branch
      • Name of branch: master

It is clearly possible, with this configuration, to calculate the changelog and thus identify who should receive failure notifications, even if the branch to build is not a fast-forward.

This isn't done, though, so if someone pushes a branch for-master/foo that is not a fast-forward of master, then the job will fail with a message like this:

ERROR: Branch not suitable for integration as it does not merge cleanly: Command "git merge --ff-only c33c4e240696ae203c257991ef4bfde9a939a4fa" returned status code 128:
stdout: 
stderr: fatal: Not possible to fast-forward, aborting.
...
...
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: FAILURE

The changelog should be computed before the branch merging so a notification can be sent out.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Jenkins job configuration with Merge before build, --ff-only, and changelog calculation against master, then trace the merge, changelog, and failure-notification flow in the git-plugin. Done means a non-fast-forward failure still computes the changelog and sends notifications to the identified recipients.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, java
Domain
ci-cd, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.