jenkinsci / jenkinsci/run-condition-plugin

[JENKINS-73016] BuildCause doesn't work when actual cause is an instance of a child class

Open
#175 0 comments 0 reactions 0 assignees View on GitHub
component:run-condition-plugin imported-jira-issue priority:trivial resolution:unresolved
Dominant language
Java
Stars
11
Forks
29
Avg merge
9h 15m
Merged PRs (30d)
3

Description

I am using Gerrit Trigger plugin, which has GerritCause class which extends SCMTriggerCause. BUILD_CAUSE variable says "SCMTRIGGER" but the condition is not fulfilled.

I've checked the source code and the change is easy to fix. In CauseCondition class replace String causeClassName to Class causeClass and than change isCausedBy() method to something like this:

boolean isCausedBy(Cause cause) {

return this.causeClass.isInstance(cause);
}

It allows more plugins to be integrated with Run Conditon plugin without code interference.

---
Originally reported by kayjayb33, imported from: BuildCause doesn't work when actual cause is an instance of a child class


  • assignee: bap
  • status: Open
  • priority: Trivial
  • component(s): run-condition-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 20251223-222157

Raw content of original issue

I am using Gerrit Trigger plugin, which has GerritCause class which extends SCMTriggerCause. BUILD_CAUSE variable says "SCMTRIGGER" but the condition is not fulfilled.

I've checked the source code and the change is easy to fix. In CauseCondition class replace String causeClassName to Class<? extends Cause> causeClass and than change isCausedBy() method to something like this:



boolean isCausedBy(Cause cause) {

return this.causeClass.isInstance(cause);
}


It allows more plugins to be integrated with Run Conditon plugin without code interference.

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.