KostyaSha / github-integration-plugin

Jenkins GitHub Integration Plugin
https://wiki.jenkins-ci.org/display/JENKINS/GitHub+Integration+Plugin
MIT License
98 stars 84 forks source link

PR not building for comment at times #333

Open prawen opened 4 years ago

prawen commented 4 years ago

Hello,

I'm new to this plugin and really appreciate your help here.

I have configured the plugin as per the instructions provided. Client cache is set to 20. My trigger event is "Comment matched to Pattern" My webhook settings on gitlab.com sends below events a. Issue Comments b. Pull requests

Expected flow:

  1. User raises and submits PR
  2. User makes a comment as per the pattern and the build should be triggered

Actual result: When a comment matches my pattern, build is getting triggered and the build status is being reported before and after the build. This is working as per my expectation.

Actual issue I'm facing: The comment based trigger of build is not happening at times. Below is the flow

  1. User raises and submits PR
  2. Let us consider this PR number is 5
  3. Github PR polling log says "no comment matched for PR 5"
  4. User comments as per the pattern
  5. Github PR polling log says "PR [#5 User story] not changed" and it continues to say same message
  6. For debug purpose, I added a label and removed
  7. Github PR polling log says "No matching comments found for 5"
  8. For debug purpose, I changed assignee and approvers
  9. Github PR polling log says "No matching comments found for 5"
  10. User comments again with same pattern
  11. Github PR polling log says "Comment matched to pattern: state has changed (new comment found - 'TEST-MERGE') Comment matched to pattern: matching comment TEST-MERGE"

I'm not exactly able to explain the sequence when this issue occurs. But this has been observed frequently. I waited for atleast 10-15 minutes before retrying with the same comment.

maxvasylets commented 4 years ago

I have the same issue. In my case, Jenkins just needs some delay between comments to detect the next one.

KostyaSha commented 4 years ago

Just disable cache. okhttp3's cache looks broken

ryuwd commented 4 years ago

I have the same issue. In my case, Jenkins just needs some delay between comments to detect the next one.

Having the same issue here, leaving some delay between trigger events (i.e. comments) works.

Just disable cache. okhttp3's cache looks broken

What do you mean by cache? Is this in the plugin options?

Edit: found it!

ryuwd commented 4 years ago

I found what was causing comments to be ignored on my end. I naively used the regex .*? to trigger builds, since I wanted the build to trigger for all comments. That regex does not match newlines, so comments that had newlines at the end were ignored. I'm now using [\S\s]* instead.

KostyaSha commented 4 years ago

Yes, mattern matching is plain. You need add multiline setting in pattern according to java regexp docs.