jenkinsci / jenkinsci/gerrit-trigger-plugin
[JENKINS-75896] Gerrit Trigger commentAdded Configuration Fails for Specific verdictCategory in Pipeline Projects
- Dominant language
- Java
- Stars
- 226
- Forks
- 289
- PR merge metrics
- No merged PRs in 30d
Description
Summary
In Jenkins Pipeline projects, the Gerrit Trigger plugin's commentAdded event trigger fails to work when using verdictCategory: 'Code Review', while the same configuration works correctly in Freestyle projects and verdictCategory: 'Verified' works fine in Pipeline projects.
Issue Type
Bug
Environment
- Jenkins Version: 2.510
- Gerrit Trigger Plugin Version: 2.42.0
- Gerrit Server Version: 3.11.2
- Operating System: Linux
Description
Issue Summary
When configuring Gerrit Trigger's commentAdded event in Jenkins Pipeline projects, we observed inconsistent behavior:
- ✅ Freestyle Project + verdictCategory: 'Code Review' → Works correctly
- ❌ Pipeline Project + verdictCategory: 'Code Review' → Does not work
- ✅ Pipeline Project + verdictCategory: 'Verified' → Works correctly
- ✅ Pipeline Project + patchsetCreated → Works correctly
Steps to Reproduce
Step 1: Create Pipeline Project
Configuration:
groovy
pipeline {
agent { node
{ label 'manual' }
}
triggers
{ gerrit( serverName: 'mifit', silentMode: true, gerritProjects: [[ branches: [[compareType: 'ANT', pattern: '**']], compareType: 'ANT', pattern: 'devops/dashboard2' ]], triggerOnEvents: [ commentAdded(verdictCategory: 'Code Review', commentAddedTriggerApprovalValue: '+2') ] ) }
stages {
stage('Test') {
steps
{ echo "Pipeline triggered by Code Review" }
}
}
}
Step 2: Create Comparable Freestyle Project
Using identical Gerrit Trigger configuration:
- Server: mifit
- Project: devops/dashboard2
- Trigger: Comment Added
- Verdict Category: Code Review
- Approval Value: +2
Step 3: Test Triggering
In Gerrit, perform the following actions on the same patch:
- Give Code Review +2
- Give Verified +1
Expected Result
- Both Pipeline and Freestyle projects should be triggered when receiving Code Review +2
- Pipeline project should be triggered when receiving Verified +1
Actual Result
Based on Jenkins log observations:
When giving Verified +1:
2025-07-16 15:04:19.065+0000 [id=599070] INFO c.s.h.p.g.t.h.EventListener#schedule: Project TEST_TRIGGER_BY_PIPELINE Build Scheduled: true By event: 927580/1
2025-07-16 15:04:19.065+0000 [id=599070] INFO c.s.h.p.g.t.h.EventListener#schedule: Project TEST_TRIGGER_BY_CODEREVIEW Build Scheduled: true By event: 927580/1
✅ Both projects were triggered
When giving Code Review +2:
2025-07-16 15:05:22.204+0000 [id=598997] INFO c.s.h.p.g.t.h.EventListener#schedule: Project TEST_TRIGGER_BY_CODEREVIEW Build Scheduled: true By event: 927580/1
❌ Only Freestyle project was triggered, Pipeline project was not triggered
Additional Information
Ruled Out Potential Causes:
- ❌ "New Pipeline needs manual run once" - Project was already manually executed
- ❌ Configuration syntax errors - Same syntax works for verdictCategory: 'Verified'
- ❌ Server connection issues - Freestyle project works fine, Verified triggering also works
- ❌ Permission issues - Same user and project in Freestyle configuration works correctly
Tested Configuration Variants:
- verdictCategory: 'Code Review' ❌
- verdictCategory: 'Huami Code Review' ❌
- commentAddedTriggerApprovalValue: '+2' / '2' / '+1' ❌
- Without specifying verdictCategory (catch all comments) ✅
Confirmed Working Configurations:
// ✅ Works correctly in Pipeline
commentAdded(verdictCategory: 'Verified', commentAddedTriggerApprovalValue: '+1')
// ✅ Works correctly in Freestyle
commentAdded(verdictCategory: 'Code Review', commentAddedTriggerApprovalValue: '+2')
Impact
This issue prevents teams using Pipeline for CI/CD from properly configuring triggers based on Code Review scores, forcing them to either use patchsetCreated (triggers on every commit) or revert to Freestyle projects, impacting adoption of modern Jenkins Pipeline.
Suggested Fix
Recommend investigating the Gerrit Trigger plugin's handling of commentAdded events in Pipeline projects, specifically examining if there are differences in processing logic for different verdictCategory values, particularly Code Review-related categories.
---
Originally reported by junxian, imported from: Gerrit Trigger commentAdded Configuration Fails for Specific verdictCategory in Pipeline Projects
rsandell
Raw content of original issue
Summary
In Jenkins Pipeline projects, the Gerrit Trigger plugin's commentAdded event trigger fails to work when using verdictCategory: 'Code Review', while the same configuration works correctly in Freestyle projects and verdictCategory: 'Verified' works fine in Pipeline projects.
Issue Type
Bug
Environment
- Jenkins Version: 2.510
- Gerrit Trigger Plugin Version: 2.42.0
- Gerrit Server Version: 3.11.2
- Operating System: Linux
Description
Issue Summary
When configuring Gerrit Trigger's commentAdded event in Jenkins Pipeline projects, we observed inconsistent behavior:
- ✅ Freestyle Project + verdictCategory: 'Code Review' → Works correctly
- ❌ Pipeline Project + verdictCategory: 'Code Review' → Does not work
- ✅ Pipeline Project + verdictCategory: 'Verified' → Works correctly
- ✅ Pipeline Project + patchsetCreated → Works correctly
Steps to Reproduce
Step 1: Create Pipeline Project
Configuration:
groovy
pipeline {
agent { node
{ label 'manual' }
}
triggers
{ gerrit( serverName: 'mifit', silentMode: true, gerritProjects: [[ branches: [[compareType: 'ANT', pattern: '**']], compareType: 'ANT', pattern: 'devops/dashboard2' ]], triggerOnEvents: [ commentAdded(verdictCategory: 'Code Review', commentAddedTriggerApprovalValue: '+2') ] ) }
stages {
stage('Test') {
steps
{ echo "Pipeline triggered by Code Review" }
}
}
}
Step 2: Create Comparable Freestyle Project
Using identical Gerrit Trigger configuration:
- Server: mifit
- Project: devops/dashboard2
- Trigger: Comment Added
- Verdict Category: Code Review
- Approval Value: +2
Step 3: Test Triggering
In Gerrit, perform the following actions on the same patch:
- Give Code Review +2
- Give Verified +1
Expected Result
- Both Pipeline and Freestyle projects should be triggered when receiving Code Review +2
- Pipeline project should be triggered when receiving Verified +1
Actual Result
Based on Jenkins log observations:
When giving Verified +1:
2025-07-16 15:04:19.065+0000 [id=599070] INFO c.s.h.p.g.t.h.EventListener#schedule: Project TEST_TRIGGER_BY_PIPELINE Build Scheduled: true By event: 927580/1
2025-07-16 15:04:19.065+0000 [id=599070] INFO c.s.h.p.g.t.h.EventListener#schedule: Project TEST_TRIGGER_BY_CODEREVIEW Build Scheduled: true By event: 927580/1
✅ Both projects were triggered
When giving Code Review +2:
2025-07-16 15:05:22.204+0000 [id=598997] INFO c.s.h.p.g.t.h.EventListener#schedule: Project TEST_TRIGGER_BY_CODEREVIEW Build Scheduled: true By event: 927580/1
❌ Only Freestyle project was triggered, Pipeline project was not triggered
Additional Information
Ruled Out Potential Causes:
- ❌ "New Pipeline needs manual run once" - Project was already manually executed
- ❌ Configuration syntax errors - Same syntax works for verdictCategory: 'Verified'
- ❌ Server connection issues - Freestyle project works fine, Verified triggering also works
- ❌ Permission issues - Same user and project in Freestyle configuration works correctly
Tested Configuration Variants:
- verdictCategory: 'Code Review' ❌
- verdictCategory: 'Huami Code Review' ❌
- commentAddedTriggerApprovalValue: '+2' / '2' / '+1' ❌
- Without specifying verdictCategory (catch all comments) ✅
Confirmed Working Configurations:
// ✅ Works correctly in Pipeline
commentAdded(verdictCategory: 'Verified', commentAddedTriggerApprovalValue: '+1')
// ✅ Works correctly in Freestyle
commentAdded(verdictCategory: 'Code Review', commentAddedTriggerApprovalValue: '+2')
Impact
This issue prevents teams using Pipeline for CI/CD from properly configuring triggers based on Code Review scores, forcing them to either use patchsetCreated (triggers on every commit) or revert to Freestyle projects, impacting adoption of modern Jenkins Pipeline.
Suggested Fix
Recommend investigating the Gerrit Trigger plugin's handling of commentAdded events in Pipeline projects, specifically examining if there are differences in processing logic for different verdictCategory values, particularly Code Review-related categories.
Contributor guide
Research direction
Reproduce the Pipeline and Freestyle configurations using commentAdded with Code Review and Verified verdict categories, then compare the plugin's handling of those events. Start at EventListener#schedule and the Pipeline trigger configuration described in the issue. Done means Code Review approvals trigger the Pipeline project consistently while the existing working cases remain functional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- ci-cd, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100