Marking a MR for Merge-When-Pipeline-Succeeds fails directly after creating the MR
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
Trying to "merge when pipeline succeeds" via the API, immediately after opening a MR, fails with "405 Method not allowed".
Steps to reproduce
POST /projects/:id/merge_requests
- Use the resulting MR iid to run
PUT /projects/:id/merge_requests/:iid/merge
withmerge_when_pipeline_succeeds=true
Example Project
We're using CML to automatically create merge requests with new data that is pulled in daily (example). We'd like to automatically mark them as "merge when pipeline succeeds", and I opened a PR to CML that adds this behaviour: https://github.com/iterative/cml/pull/903
What is the current bug behavior?
It responds 405 Method Not allowed
What is the expected correct behavior?
It responds 200 OK
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
this bug happens on gitlab.com
Possible fixes
on my end, I can fix it by adding a 20secs timeout between the two API calls. this makes me think there's some race condition with a background worker on Gitlab's side that hasn't yet executed.