-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
$DRONE_PULL_REQUEST not defined for MRs from non-forks #1931
Comments
The I should point out that in some cases pushing to a feature branch and opening a pull request will trigger two builds. One for the push to the feature branch, and a second for the pull request. The former will never include the pull request number, the latter should. Check Once you have verified the event is correct you can check and see what ref is being used. The ref isn't displayed in the user interface, but you can easily check the value using the API. You can just type If the reference does not look correct someone needs to look at the hook that GitLab sends to Drone and see what fields are available, and make sure Drone is using the correct field. If it is determined drone is sourcing the ref value from an incorrect fields, a PR should be issued to update Drone. Please note that the GitLab implementation is community contributed and not something I personally use. So while I can definitely help point you in the right direction, it is not something I can easily debug of resolve. So community involvement here will be required. |
Thanks for the response @bradrydzewski the |
@k0nserv it looks like this might be the specific section in the code: I recommend we check with @Bugagazavr who authored this code. The initial GitLab integration was created before merge refs existed. It is possible that, at the time of writing this code, merge refs were not available for intra-repository merge requests. Or maybe there is an edge case we don't know about. Either way hopefully @Bugagazavr can shed some light :) |
Hello, @k0nserv which version of gitlab you use? |
Hey @Bugagazavr we are on ee 8.11 currently |
@connorshea do you have any idea why this condition might have been put in place? |
@k0nserv nope, but I've asked the CI team about it. |
just merged the update from @Bugagazavr , thanks!! |
Brilliant thanks @Bugagazavr |
@bradrydzewski pinging back about this. if build.Event == core.EventPullRequest {
env["DRONE_PULL_REQUEST"] = re.FindString(build.Ref)
} Why is the For most of my Drone projects, I've disabled "Pull Requests" and I only spin up Drone pipelines against the "push" events. If there is a Pull Request associated to a branch, I don't see why we wouldn't set up the Is there a specific reason why not to set this env var, even if possible? Thoughts? |
a push hook will never contain the pull request number in the ref. A push ref contains the branch, and follows the pattern |
you're right, thanks for the explanation I'll have to stick to |
Hey 👋,
We are using Gitlab and Drone 0.4. I've found from testing that when drone runs for MRs that orginated in the same repo
$DRONE_PULL_REQUEST
is not defined whereas when a build is ran for an MR from a fork it is defined. Is this expected or do we have a problem with our setup somewhere?The text was updated successfully, but these errors were encountered: