Merge When Pipeline Succeeds option is ignored in API calls
Summary
API call to set MWPS is described here
- When there is no running pipeline
- And you set
merge_when_pipeline_succeeds=trueand call formergeAPI action - Then the MR is immediately merged without running new pipeline
Steps to reproduce
- Create an MR
- Run a pipeline. Wait until it succeeds
- Call for
PUT /projects/:id/merge_requests/:merge_request_iid/mergewithmerge_when_pipeline_succeeds=true - MR will be merged immediately
Expected behaviour
-
First of all I think that combining
mergewithmerge_when_pipeline_succeedscan be risky because it's easy to make a param mistake that alters behaviour of endpoint dramatically. Imagine 3rd party script which has a flaw of some typecasting or any other mistake that results in "true" value being converted to "false". With single endpoint that 3rd party script will immediately merge an MR. I'd suggest to split setting MWPS to a separate endpoint because it's more safe and error-proof for API users -
I believe if
merge_when_pipeline_succeeds=trueis set AND there is no running pipeline the API should return an error object with "No running pipelines detected." error instead of silently merging an MR.
/cc @mnohr I guess it belongs to your team