jenkinsci / jenkinsci/git-plugin

[JENKINS-26317] CommitHookCause should extend SCMTriggerCause

Open
#2,585 0 comments 0 reactions 0 assignees View on GitHub
component:git-plugin enhancement imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

When a commit hook triggers a Jenkins build using the git-plugin's REST API, the cause of this is a CommitHookCause. However, this Cause doesn't extend SCMTriggerCause.

This means that plugins which have an option to do things like ignore SCM-triggered changes (eg the sonar plugin) don't treat these triggers correctly.

I'm happy to submit a pull request, but I'm not sure if there are any subtle/unwanted side effects from this. I saw a similar request (JENKINS-15823) for the gerrit jenkins plugin.

(Note that some plugins will still not detect this - the sonar plugin uses "SCMTrigger.SCMTriggerCause.class.isInstance(cause)" and so is fine with subclasses, but eg the run condition plugin does a string comparison on the class name, so will still not see this properly)

---
Originally reported by bbaetz, imported from: CommitHookCause should extend SCMTriggerCause


  • status: Open
  • priority: Minor
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-02

Raw content of original issue

When a commit hook triggers a Jenkins build using the git-plugin's REST API, the cause of this is a CommitHookCause. However, this Cause doesn't extend SCMTriggerCause.

This means that plugins which have an option to do things like ignore SCM-triggered changes (eg the sonar plugin) don't treat these triggers correctly.

I'm happy to submit a pull request, but I'm not sure if there are any subtle/unwanted side effects from this. I saw a similar request (JENKINS-15823) for the gerrit jenkins plugin.

(Note that some plugins will still not detect this - the sonar plugin uses "SCMTrigger.SCMTriggerCause.class.isInstance(cause)" and so is fine with subclasses, but eg the run condition plugin does a string comparison on the class name, so will still not see this properly)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.