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

buildOpenMergeRequests not triggering #144

Closed
joshuajorel opened this issue Nov 27, 2015 · 8 comments
Closed

buildOpenMergeRequests not triggering #144

joshuajorel opened this issue Nov 27, 2015 · 8 comments

Comments

@joshuajorel
Copy link

The gitlab-plugin is not building when a change is pushed to the source repository in an open merge request. In my Jenkins log, only the message "Existing Merge Request, build will be trigged by buildOpenMergeRequests instead."

HOWEVER, no logs follow suit that show that buildOpenMergeRequests triggered. Is there a setting I missed? Checking the source code all I see is that buildOpenMergeRequests is only called when it calls the generatePushBuild method. But my request enters the generateMergeRequests method, which never calls the method, but instead outputs to the logger the message I wrote above. Why was this designed this way if I may ask? Given this, is there a configuration I missed to enable building open merge requests?

I'm currently using Gitlab ver. 7.14.3, gitlab-plugin ver. 1.1.28, and Jenkins 1.625.2.

@omehegan
Copy link
Member

I have seen this behavior occasionally also. I'm trying to track down what the problem is. If you figure anything out, please let me know!

@omehegan
Copy link
Member

Seems to be a duplicate of #90

@runsisi
Copy link
Contributor

runsisi commented Dec 27, 2015

@omehegan generateMergeRequestBuild only generates build for open and reopen MRs, for update, i.e. those with new commits pushed after the MR opened, it does nothing, as the following code snappet shows:

if("update".equals(request.getObjectAttribute().getAction())) {
    LOGGER.log(Level.INFO, "Existing Merge Request, build will be trigged by buildOpenMergeRequests instead");
    return;
}

i removed the return from my own build, it works like a charm:)

@joshuajorel
Copy link
Author

@runsisi yup. That's the same solution I came up with. But the problem now is if an existing MR is accepted, it must rebuild all open MRs. I haven't gotten back onto work with the plug-in since I've been busy and we might be shifting to GitHub. In any case, redirect your comments to #90

@runsisi
Copy link
Contributor

runsisi commented Dec 27, 2015

@omehegan @joshuajorel i think it's a different problem here, the modification i made works as expected. but as @joshuajorel said i can not rebuild all open MRs after an existing MR has been accepted (yes, On push to source or target branch selected), jenkins shows me error log like this:

Dec 28, 2015 1:12:19 AM WARNING com.dabsquared.gitlabjenkins.GitLabWebHook buildOpenMergeRequests
failed to communicate with gitlab server to determine is this is an update for a merge request: http://hust/api/v3/projects/4/repository/branches/mr4?private_token=UmK47w8rxu7PfA3Fuu6-

and

curl http://hust/api/v3/projects/4/repository/branches/mr4?private_token=UmK47w8rxu7PfA3Fuu6-

returns error:

{"message":"404 Branch Not Found"}

actually the branch mr4 is a branch of the forked project (whose id is 5), i.e. not a branch of origin (whose id is 4), so i am pretty sure this is an bug, as shows below:

curl http://hust/api/v3/projects/4/repository/branches/mr4?private_token=UmK47w8rxu7PfA3Fuu6-

returns the right data:

{"name":"mr4","commit":{"id":"c9036c6a38d17cf9c5e2b6c9727de8bee5d92623","message":"24","parent_ids":["1873b8021e73c7b0076da92d7885f5f69df0b60e"],"authored_date":"2015-12-28T01:05:30.000+08:00","author_name":"runsisi","author_email":"[email protected]","committed_date":"2015-12-28T01:05:30.000+08:00","committer_name":"runsisi","committer_email":"[email protected]"},"protected":false}

btw, my gitlab version is gitlab-ce-8.3.0-ce, jenkins version is jenkins-1.642-1.1

thanks~

@joshuajorel
Copy link
Author

Yeah, I'm experiencing the same issue, but it's been almost 3 weeks since I last checked the code. So please let me know if you have an update or anything. I'll be back to fixing the problem this weekend since I'll be free by then. Let me know if you need anything and please keep me posted.

Thanks!

@runsisi
Copy link
Contributor

runsisi commented Jan 2, 2016

@joshuajorel ok, i think the not triggering thing is acting by design(i.e. forked repo need to setup a webhook too? i am not quite sure though), so i am not to create a PR for this, but to address our own problem(only setup a webhook for the master repo) we need to combine PR #169 #170 #171 and get rid of the return statement(see here)

@litmanovich
Copy link

I have this problem on GitLab 8.5.8 - build is started when MR is created but not started when source branch is updated. I tried adding a webhook in the fork repo, but this way build starts on each push, even when there is no MR, which I don't want to happen. I'd prefer having webhook only on main repo and triggering the build on MR updates. Do I need to remove the return statement from Jenkins plugin?

Thanks!

exceed-alae pushed a commit to exceed-alae/gitlab-plugin that referenced this issue May 20, 2022
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

No branches or pull requests

4 participants