What Operating System are you using (both controller, and any agents involved in the problem)?
linux
Reproduction steps
Create a project Organization Folder where gitlab is linked
In the configuration select "Webhook Listener Conditions" -> [x] Ignore builds for non-code related MR updates
Create a MR
This creates a MR build in Jenkins
Open some threads in the "changes" tab in GitLab
Push an other change on the target branch
Otherwise the Webhook event will be processed, but you will see something like No changes detected: MR-1 (still at ab4cdf3ab68a29fca4cd9bcddeea81488562053a+e9a11a10a95b1b1bba186c5ed9988f9a27d9e210) after the line Met criteria
Resolve those threads
Expected Results
No build should be triggered, since resolving threads is not a code related MR update
Actual Results
A new build is triggered
In the page <Jenkins project>/indexing/events you see in the logs:
Checking merge requests..
Checking merge request !1
‘Jenkinsfile’ found
Met criteria
Changes detected: MR-1 (ab4cdf3ab68a29fca4cd9bcddeea81488562053a+8906c9ccd753c419445792a6c38d479494e325f3 → 5f22b0ba8be91b206175123a6026dc1fb33594be+8906c9ccd753c419445792a6c38d479494e325f3)
Scheduled build for branch: MR-1
1 merge requests were processed (query completed)
[Wed May 24 17:14:49 CEST 2023] Merge request !1 state:opened action:update in project jmini-test-group/jenkins-test changes:{
"authorId" : null,
"createdAt" : null,
"updatedAt" : null,
"updatedById" : null,
"title" : null,
"description" : null,
"state" : null,
"milestoneId" : null,
"labels" : null,
"assignees" : null,
"totalTimeSpent" : null,
"mergeStatus" : null
} UPDATED event from 34.74.90.77 ⇒ <jenkins server>/gitlab-webhook/post with timestamp Wed May 24 17:14:17 CEST 2023 processed in 2.2 sec
And it is sent probably because blocking_discussions_resolved transition from false to true but this is not modeled in the changes.
--> I did not investigate further but to see this transition you might also need All discussions must be resolved according to issue #215589, but the behavior described here can be reproduced without the setting.
According to my analysis the code based on the changes object in the Webhook event is not the best:
Jenkins and plugins versions report
Environment
```text Jenkins: 2.375.1 OS: Linux - 5.13.19-2-MANJARO Java: 17.0.1 - Eclipse Adoptium (OpenJDK 64-Bit Server VM) --- ant:487.vd79d090d4ea_e antisamy-markup-formatter:159.v25b_c67cd35fb_ apache-httpcomponents-client-4-api:4.5.14-150.v7a_b_9d17134a_5 bootstrap5-api:5.2.1-3 bouncycastle-api:2.28 branch-api:2.1092.vda_3c2a_a_f0c11 build-timeout:1.28 caffeine-api:3.1.6-115.vb_8b_b_328e59d8 checks-api:1.8.1 cloudbees-folder:6.815.v0dd5a_cb_40e0e commons-lang3-api:3.12.0-36.vd97de6465d5b_ commons-text-api:1.10.0-36.vc008c8fcda_7b_ credentials:1224.vc23ca_a_9a_2cb_0 credentials-binding:604.vb_64480b_c56ca_ display-url-api:2.3.7 durable-task:507.v050055d0cb_dd echarts-api:5.4.0-1 email-ext:2.97 font-awesome-api:6.2.1-1 git:5.0.2 git-client:4.2.0 github:1.37.1 github-api:1.314-431.v78d72a_3fe4c3 github-branch-source:1703.vd5a_2b_29c6cdc gitlab-api:5.2.0-86.v1ed41a_9cf486 gitlab-branch-source:659.va_685a_51fda_db_ gradle:2.7 handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 instance-identity:142.v04572ca_5b_265 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.15.1-344.v6eb_55303dc3e jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.8-1 jersey2-api:2.39.1-1 jjwt-api:0.11.5-77.v646c772fddb_0 jquery3-api:3.6.1-2 junit:1202.v79a_986785076 ldap:682.v7b_544c9d1512 mailer:448.v5b_97805e3767 matrix-auth:3.1.7 matrix-project:789.v57a_725b_63c79 mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_ mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_ okhttp-api:4.10.0-132.v7a_7b_91cef39c pam-auth:1.10 pipeline-build-step:491.v1fec530da_858 pipeline-github-lib:42.v0739460cda_c4 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:656.va_a_ceeb_6ffb_f7 pipeline-input-step:468.va_5db_051498a_4 pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2131.vb_9788088fdb_5 pipeline-model-definition:2.2131.vb_9788088fdb_5 pipeline-model-extensions:2.2131.vb_9788088fdb_5 pipeline-rest-api:2.32 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2131.vb_9788088fdb_5 pipeline-stage-view:2.32 plain-credentials:143.v1b_df8b_d3b_e48 plugin-util-api:2.20.0 popper2-api:2.11.6-2 resource-disposer:0.22 scm-api:672.v64378a_b_20c60 script-security:1244.ve463715a_f89c snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4 ssh-credentials:305.v8f4381501156 ssh-slaves:2.877.v365f5eb_a_b_eec sshd:3.303.vefc7119b_ec23 structs:324.va_f5d6774f3a_d timestamper:1.25 token-macro:359.vb_cde11682e0c trilead-api:2.84.v72119de229b_7 variant:59.vf075fe829ccb workflow-aggregator:596.v8c21c963d92d workflow-api:1213.v646def1087f9 workflow-basic-steps:1017.vb_45b_302f0cea_ workflow-cps:3668.v1763b_b_6ccffd workflow-durable-task-step:1246.v5524618ea_097 workflow-job:1295.v395eb_7400005 workflow-multibranch:746.v05814d19c001 workflow-scm-step:408.v7d5b_135a_b_d49 workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:839.v35e2736cfd5c ws-cleanup:0.45 ```What Operating System are you using (both controller, and any agents involved in the problem)?
linux
Reproduction steps
Organization Folder
where gitlab is linked[x] Ignore builds for non-code related MR updates
No changes detected: MR-1 (still at ab4cdf3ab68a29fca4cd9bcddeea81488562053a+e9a11a10a95b1b1bba186c5ed9988f9a27d9e210)
after the lineMet criteria
Expected Results
No build should be triggered, since resolving threads is not a code related MR update
Actual Results
A new build is triggered
In the page
<Jenkins project>/indexing/events
you see in the logs:Anything else?
The webhook event contains following values:
And it is sent probably because
blocking_discussions_resolved
transition fromfalse
totrue
but this is not modeled in the changes. --> I did not investigate further but to see this transition you might also needAll discussions must be resolved
according to issue #215589, but the behavior described here can be reproduced without the setting.According to my analysis the code based on the
changes
object in the Webhook event is not the best:https://github.com/jenkinsci/gitlab-branch-source-plugin/blob/d45c0f4c00428cd0d79ba15af87091708b4b58b8/src/main/java/io/jenkins/plugins/gitlabbranchsource/GitLabMergeRequestTrigger.java#L45-L76
I found this in the documentation:
source: https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#merge-request-events
So for me the "Ignore builds for non-code related MR updates" should be based on the presence or absence of
object_attributes.oldrev
.Which requires this change https://github.com/gitlab4j/gitlab4j-api/pull/980