jenkinsci / jenkinsci/gerrit-trigger-plugin
[JENKINS-60072] trigger on "ref-updated" generates many noisy/wrong events
- Dominant language
- Java
- Stars
- 226
- Forks
- 289
- PR merge metrics
- No merged PRs in 30d
Description
Gerrit-Version: 2.15.8
After enabling the Trigger on "Ref Updated" i got many gerrit events for "non source code" based updates.
I need the "Ref-Updated" trigger to allow "non-reviewing projects" to be executed thru a jenkins pipeline (after pushing some changes -> build/deploy stuff). These projects are working fine, now only the "review-projects" are stumbling like described below.
For example if a user create a new patchset i got two events
- unexpected event GERRIT_EVENT_TYPE=ref-updated with the following variables
GERRIT_REFSPEC=refs/heads/master
GERRIT_REFNAME=refs/changes/37/7337/1
GERRIT_OLDREV=0000000000000000000000000000000000000000
GERRIT_NEWREV=f1afefdb742808546864b89db42655a6cc1f1296
don't know what this event wants to tell me - expected event GERRIT_EVENT_TYPE=patchset-created
GERRIT_REFSPEC=refs/changes/37/7337/1
....
the normal event (like before enabling Ref Updated)
If a user submit a review it becomes more strange, now i got three events:
- unexpected event GERRIT_EVENT_TYPE=ref-updated with the following variables
GERRIT_REFSPEC=refs/heads/master
GERRIT_OLDREV=fbdab6370a390f03a565fe3f065c76434bf7277a
GERRIT_NEWREV=f1afefdb742808546864b89db42655a6cc1f1296
- expected event GERRIT_EVENT_TYPE=change-merged with the following variables
GERRIT_REFSPEC=refs/changes/37/7337/1
GERRIT_NEWREV=f1afefdb742808546864b89db42655a6cc1f1296
- unexpected event GERRIT_EVENT_TYPE=ref-updated with the following variables
GERRIT_REFSPEC=refs/heads/master
GERRIT_REFNAME=refs/notes/review
GERRIT_OLDREV=7f5b17092e3f724defd8074f815dab8e034a8b92
GERRIT_NEWREV=c7c264f68f44a1865eaad29c748a9a49aec644c2
these one is strange, looks like it comes from submitting internal structures of gerrit (i know that in gerrit there are some changes ongoing to replace the sql database and safe these values into git/note-db?)
I'm not sure if the order of these events is predictable and if there are more events like for example if the user adds some notes to the review.
But at least the third event should never be passed thru the gerrit-trigger-plugin to jenkins. It's an gerrit internal use of the git repository to store some things (like refs/meta/config) and has nothing to do with the project itself.
Additional it would be nice to get rid of the first event for a "submit" action.
---
Originally reported by nias, imported from: trigger on "ref-updated" generates many noisy/wrong events
rsandell
Raw content of original issue
Gerrit-Version: 2.15.8
After enabling the Trigger on "Ref Updated" i got many gerrit events for "non source code" based updates.
I need the "Ref-Updated" trigger to allow "non-reviewing projects" to be executed thru a jenkins pipeline (after pushing some changes -> build/deploy stuff). These projects are working fine, now only the "review-projects" are stumbling like described below.
For example if a user create a new patchset i got two events
- unexpected event GERRIT_EVENT_TYPE=ref-updated with the following variables
GERRIT_REFSPEC=refs/heads/master
GERRIT_REFNAME=refs/changes/37/7337/1
GERRIT_OLDREV=0000000000000000000000000000000000000000
GERRIT_NEWREV=f1afefdb742808546864b89db42655a6cc1f1296
don't know what this event wants to tell me
- expected event GERRIT_EVENT_TYPE=patchset-created
GERRIT_REFSPEC=refs/changes/37/7337/1
....
the normal event (like before enabling Ref Updated)If a user submit a review it becomes more strange, now i got three events:
- unexpected event GERRIT_EVENT_TYPE=ref-updated with the following variables
GERRIT_REFSPEC=refs/heads/master
GERRIT_OLDREV=fbdab6370a390f03a565fe3f065c76434bf7277a
GERRIT_NEWREV=f1afefdb742808546864b89db42655a6cc1f1296
- expected event GERRIT_EVENT_TYPE=change-merged with the following variables
GERRIT_REFSPEC=refs/changes/37/7337/1
GERRIT_NEWREV=f1afefdb742808546864b89db42655a6cc1f1296
- unexpected event GERRIT_EVENT_TYPE=ref-updated with the following variables
GERRIT_REFSPEC=refs/heads/master
GERRIT_REFNAME=refs/notes/review
GERRIT_OLDREV=7f5b17092e3f724defd8074f815dab8e034a8b92
GERRIT_NEWREV=c7c264f68f44a1865eaad29c748a9a49aec644c2
these one is strange, looks like it comes from submitting internal structures of gerrit (i know that in gerrit there are some changes ongoing to replace the sql database and safe these values into git/note-db?)
I'm not sure if the order of these events is predictable and if there are more events like for example if the user adds some notes to the review.
But at least the third event should never be passed thru the gerrit-trigger-plugin to jenkins. It's an gerrit internal use of the git repository to store some things (like refs/meta/config) and has nothing to do with the project itself.
Additional it would be nice to get rid of the first event for a "submit" action.
Contributor guide
Research direction
Start by reproducing the ref-updated events with Gerrit 2.15.8, focusing on the plugin's handling of patchset-created, change-merged, and refs/notes/review updates. Done means internal ref updates and unwanted submit-related duplicates are no longer passed through to Jenkins while valid ref-updated events still trigger pipelines.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- ci-cd
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100