Skip to content

Conversation

@maxshine
Copy link
Contributor

Problem Description

While we are using gitlab-plugin as tiggers for Jenkins builds by Merge Request events from gitlab, we hit an issue that the builds can not be fired correctly by merge action of any Merge Request. As I dig the root cause, I think I have some findings and make this change for this issue.

Scenario and Issue Solution

The CI process of our team based on Jenkins + Gitlab is like this :

  • When there is a MR opened, a build should be triggered
  • When there is an update of opened MR, a build should be triggered
  • When the MR is accepted (merged), a build should be triggered.

So, the cause of the issue we have, it the 3rd scenario of accepted MR. As gitlab-plugin has an logic to check if the build should be skipped because it is already done in this codes, the acceptance event of MR can never trigger the builds due to it skipped.

The fix to this is simple, as Action.merge enumeration element is added in skipBuiltYetCheckActions set.

Please kindly review the change and accept it if this makes sense.

Thanks

@markjacksonfishing
Copy link
Contributor

@maxshine Is there an associated Github issue with this PR? What about a Jenkins jira? If so, can you link them? If not, can you open them and note this PR?
Thank you for that.

@TonyNoble
Copy link

Issues 891 and 958 partially address this issue.

#891
#958

It would be preferable if the ability to re-build previously-build commits was user-selectable, but at the very least, a merged MR should not be ignored purely because it had been built when the MR was opened in the first place.

@maxshine
Copy link
Contributor Author

Issues 891 and 958 partially address this issue.

#891
#958

It would be preferable if the ability to re-build previously-build commits was user-selectable, but at the very least, a merged MR should not be ignored purely because it had been built when the MR was opened in the first place.

Thanks @TonyNoble for adding the related issues. The two are similar to what I hit before.

@maxshine
Copy link
Contributor Author

Also, I think the gitlab-plugin gives the option for user to select which events could trigger the builds as :
Screen Shot 2019-10-12 at 11 05 38 AM

So my fix is just to ensure the selected option would work as expected.

@interone-ms
Copy link

See PR #1001, I have made the check in isLastCommitNotYetBuild overridable on a job level.

@markjacksonfishing markjacksonfishing merged commit f2815dc into jenkinsci:master Nov 24, 2019
@zottinor
Copy link

zottinor commented Apr 1, 2020

I'm with the exactly issue on GitLab where Merge Accept button doesn't trigger jenkins job. This feature only works if a new branch was created from GitLab UI from Repository > Branches and used the green bottom New Branch. Starting a new branch from there when you click on Merge buttom at Merge Request open it trigger a new job on Jenkins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants