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
- Gerrit Trigger Plugin Version: 2.42.0
- Gerrit Server Version: 3.11.2
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:
- Project: devops/dashboard2
- Verdict Category: Code Review
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
- assignee:
rsandell
- status: Open
- priority: Blocker
- component(s): gerrit-trigger-plugin
- resolution: Unresolved
- votes: 0
- watchers: 1
- imported: 2025-12-07
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
- Gerrit Trigger Plugin Version: 2.42.0
- Gerrit Server Version: 3.11.2
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:
- Project: devops/dashboard2
- Verdict Category: Code Review
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.
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
Description
Issue Summary
When configuring Gerrit Trigger's commentAdded event in Jenkins Pipeline projects, we observed inconsistent behavior:
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:
Step 3: Test Triggering
In Gerrit, perform the following actions on the same patch:
Expected Result
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:
Tested Configuration Variants:
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
Raw content of original issue
Description
Issue Summary
When configuring Gerrit Trigger's commentAdded event in Jenkins Pipeline projects, we observed inconsistent behavior:
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:
Step 3: Test Triggering
In Gerrit, perform the following actions on the same patch:
Expected Result
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:
Tested Configuration Variants:
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.