Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "Never" option for "Rebuild open Merge Requests" does not prevent a build #705

Closed
tpbradt opened this issue Jan 17, 2018 · 29 comments · Fixed by #1319 · May be fixed by #869
Closed

The "Never" option for "Rebuild open Merge Requests" does not prevent a build #705

tpbradt opened this issue Jan 17, 2018 · 29 comments · Fixed by #1319 · May be fixed by #869
Labels
bug For changelog: Minor bug. Will be listed after features

Comments

@tpbradt
Copy link

tpbradt commented Jan 17, 2018

Issue

When setting up the Build Triggers for our Jenkins jobs, we use:
Build when a change is pushed to GitLab = checked
Opened Merge Request Events = checked
Rebuild open Merge Requests = Never

The behavior with gitlab-plugin v1.1.32 was that when an open and previously failed merge request had a subsequent push, the build did NOT get triggered. When we upgraded to 1.4.5 this was no longer the case. A rebuild occurred even with the option set to Never. We recently upgraded to v1.5.1 and it is still triggering the rebuild. The documentation on the home page does not describe expected behavior for this configuration, but intuitively this seems broken to me.

Context

  • Gitlab plugin version: 1.5.1
  • Gitlab version: 10.2.4-ee
  • Jenkins version: 2.59
  • Job type: Maven project

Logs & Traces

Following is the Discussion in Gitlab:
Dev Builder @devbld commented 24 minutes ago
Developer

❎ Jenkins Build FAILURE

Results available at: Jenkins [diqfe-parent #77]

Dev Builder @devbld commented 24 minutes ago
Developer

👎

Bradt Timothy P @bradttp added 1 commit 22 minutes ago
1b79cca6 - DOS-1016: Test if the new gitlab-plugin fixes the problem with "Never" rebuild…
Compare with previous version

Dev Builder @devbld commented 21 minutes ago
Developer

✅ Jenkins Build SUCCESS

Results available at: Jenkins [diqfe-parent #78]

Dev Builder @devbld commented 21 minutes ago
Developer

👍

Dev Builder @devbld merged 21 minutes ago

These are the 2 Jenkins log entries showing the merge request triggered both builds:
14:52:37 Triggered by GitLab Merge Request #44: fe/dev_test_gitlab_plugin => master

14:54:52 Triggered by GitLab Merge Request #44: fe/dev_test_gitlab_plugin => master

Problem description

With the above configuration...

  1. Push a change that intentionally breaks a build.
  2. Create a merge request and verify the build fails and merge request remains open.
  3. Revert the change and push (i.e. fix broken build).
  4. Expect it to never rebuild, but a new build is triggered immediately/automatically.
@omehegan
Copy link
Member

@tpbradt I was about to write a different reply, but I realized I'm not positive I understand what config you have set up for the plugin. Can you please attach a screenshot of the Jenkins job config where the plugin is configured?

@tpbradt
Copy link
Author

tpbradt commented Jan 18, 2018 via email

@omehegan
Copy link
Member

@tpbradt you will need to add the screenshot via the GitHub issue web page, not replying to the email.

@tpbradt
Copy link
Author

tpbradt commented Jan 19, 2018

Done. Edited original comment above.

@omehegan
Copy link
Member

@tpbradt and what URL are you using for the webhook on the GitLab side, to trigger this build?

@tpbradt
Copy link
Author

tpbradt commented Jan 22, 2018

http://devbld:(key)@jenkins.ops.cld/project/fe/mr/app-pld

...with the key masked out. Just to make it clear, we have our own gitlab locally.

@omehegan
Copy link
Member

@tpbradt if you're still having this issue, can you follow the instructions in the User Support part of the README and attach logs from the plugin when you see a rebuild that should not happen?

@tpbradt
Copy link
Author

tpbradt commented Mar 26, 2018

Here is a log from me reproducing just now. We have done some updates recently to our tools:
Gitlab plugin version: 1.5.3
Gitlab version: 10.5.4-ee
Jenkins version: 2.110

rebuild.log

@omehegan
Copy link
Member

omehegan commented Apr 5, 2018

(Job config screenshot visible)

screenshot

@omehegan
Copy link
Member

omehegan commented Apr 5, 2018

@tpbradt I can reproduce this. I'll see if I can figure out what the problem is. But I'm surprised no one else has seen it.

@omehegan omehegan added bug For changelog: Minor bug. Will be listed after features and removed awaiting feedback labels Apr 5, 2018
@omehegan
Copy link
Member

omehegan commented Apr 6, 2018

@tpbradt what events have you set up in the webhook configuration in GitLab? Pushes and/or Merge Requests?

@mmehra
Copy link

mmehra commented Jun 4, 2018

Is there a workaround for this? Both "Never" and "Push to Source Branch" options for "Rebuild Open Merge Requests" do not work.

@omehegan
Copy link
Member

@mmehra can you show me your webhook configuration from GitLab? Have you set up hooks for both pushes and MRs, or just MRs? Please follow the instructions in the User Support section of the README to increase debug logging for the plugin, and then attach those logs after you reproduce this issue.

@jkugler
Copy link

jkugler commented Sep 26, 2018

I realize this is somewhat of a thread hijack, but I am hitting the same issue as @mmehra: rebuilds are not happening at all: I have tried
Rebuild open Merge Requests: On push to source branch
and
Rebuild open Merge Requests: On push to source or target branch

I have not tried pushing to the target branch to see if that triggers, but but pushes to the source branch do not trigger builds.

This is version 1.5.9 of the gitlab plugin, and version 2.141 of Jenkins.

@jkugler
Copy link

jkugler commented Sep 26, 2018

@omehegan Just figured out the issue (in my case).

These triggered builds:

  • Build trigger on merge request creation
  • Build trigger on merge request comment
    This did not:
  • Build trigger on new push to existing open merge request.

I looked at my config again, and realized I had it set to ignore WIP merge requests (which I was using since it was a test MR). So, now the bug is: why is it triggering builds on create and note when "ignore" is checked. :)

@omehegan
Copy link
Member

@jkugler how were you marking the MRs as being WIP?

@jkugler
Copy link

jkugler commented Sep 27, 2018

@omehegan The subject started with WIP: per the GitLab convention. i.e. https://docs.gitlab.com/ee/user/project/merge_requests/work_in_progress_merge_requests.html

@GoWithTheFlo95
Copy link

GoWithTheFlo95 commented Oct 22, 2018

Hello,

i read through this issue and issue #636. However I don't seem to find a solution for my problem.

Versions:

  • GitLab Plugin Version 1.5.9 (aso tested Version 1.5.10)

  • GitLab Community Edition 11.03

  • Jenkins Version 2.121.2

Jenkins Trigger Config:

  • Push Event (for commiting on source branch without having created an MR; not necessary!!!)

  • Opened Merge Request Events (for creating an MR)

  • Rebuild open Merge Requests: On push to source or target branch (for pushing on an open MR/ merging MR)
    (I actually activated all triggers, but would logically just need those.)

GitLab Webhooks

  • Push Events

  • Merge Requests Events

What I want to do:
I'm working with a Jenkins pipeline and would like it to be triggered when creating an MR, pushing on an open MR, merging the MR (and ideally when commiting on source branch without having created an MR before; not required tho).

What happens:
The Push Event (triggerAcionType: PUSH) triggers whenever Im commiting on the source branch (with and without open MR) and when I merge my source branch into master (with and without open MR).
Creating a merge request (triggerAcionType: MERGE) on GitLab triggers the pipeline as well. Commiting on an open MR (triggerAcionType: MERGE) triggers the pipeline too, using the described trigger configuation. However as I'm using Push Events too, I have two Pipelines getting triggered. That blocks Jenkins unnecessarily. Merging the MR doesnt trigger the pipeline with following message:

Last commit in Merge Request has already been built in build #251

Result:
I would like to just use the MR triggeres, as I dont necessarily need to build without having a MR opened and having two Pipelines triggered is not sufficient. However the MR Event doesn't trigger when merging.

Question:

  • Is there a workaround to trigger the merge with a MR (triggerAcionType: MERGE)?
  • Would a merge of a MR build the master (like the Push Event) or just rebuild the source branch? That' s how I understand the log message that I quoted above.

Thank you and please let me know, if Im missing Information, logs.

@Osmyslitelny
Copy link

Do we have any updates? I got the same problem and its very important for us because "when build job" configuration is the main idea of plugin.

@tpbradt
Copy link
Author

tpbradt commented Dec 7, 2018

@tpbradt what events have you set up in the webhook configuration in GitLab? Pushes and/or Merge Requests?

@omehegan Sorry I never got back to you. We trigger webhooks on merge request only.

@Osmyslitelny
Copy link

Look like I get this problem when json include "state" : "opened" and "action" : "update" with TriggerOpenMergeRequest.never

@Osmyslitelny
Copy link

Osmyslitelny commented Dec 7, 2018

I found the code which do this bug. On my jenkins I installed snapshot version and if you wanna, after some time, I can create Merge Request for project.
p.s. I'm not sure that all my changes was correctly, but this bug is resolved into my snapshot.

@omehegan
Copy link
Member

I have built a snapshot with the change from #869 which should fix the issue of builds getting triggered even when "Rebuild open merge requests" is set to "Never." For those affected by that issue, please try this and let us know if it fixes the problem. http://repo.jenkins-ci.org/snapshots/org/jenkins-ci/plugins/gitlab-plugin/1.5.12-SNAPSHOT/gitlab-plugin-1.5.12-20181217.052605-2.hpi

@omehegan
Copy link
Member

@GoWithTheFlo95 it sounds like your issue would be resolved if we fix #636. Do you agree?

@nop00
Copy link

nop00 commented Dec 19, 2018

@omehegan Just tried the build you provided 2 days ago and I can confirm it fixes the issue for me

@GoWithTheFlo95
Copy link

@omehegan sorry for the late Reply, but yes this would fix my problem.

@hazim1093
Copy link

@omehegan Any update on when the fix will be merged ?

@zottinor
Copy link

zottinor commented Apr 3, 2020

I'm experience the same issue when Accept the merge on GitLab, it is not trigger a new job on jenkins I'm using gitlab 12.5.8 jenkins 2.229 git plugin 4.2.2 gitlab_plugin 1.5.13

Do you have any idea about when it will be solved ?

@yigalg
Copy link

yigalg commented Jul 1, 2021

Hi
Any plan to finish and release this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For changelog: Minor bug. Will be listed after features
Projects
None yet
10 participants