-
Bug
-
Resolution: Unresolved
-
Blocker
-
None
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
}
triggers
stages {
stage('Test') {
steps
}
}
}
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.