I am trying out the new API in 12.7 to skip a CI when doing a rebase. The syntax, from what I can guess is something like:
https://host.com/api/v4/projects/$PROJECT/merge_requests/$ISSUE/rebase?skip_ci=true
This doesn’t work for me though. The rebase works correctly, but the CI is NOT skipped. Am I doing something wrong here?
Hello @fedordoc - Thank you for your question. Per the documentation for Rebase a merge request a :merge_request_iid
is expected; can you confirm in your example if $ISSUE
is referencing the merge request id and not an issue id?
I’m using the number that’s displayed in the merge request page at the top, e.g. ‘project > Merge Requests > !xxx’
Using that number gets me the correct information with other API requests
Here’s the actual commands I use, for reference:
> curl --request GET --header PRIVATE-TOKEN: XXXXXX https://git.hostcom/api/v4/version
{"version":"12.8.0","revision":"928201defb0"}
> curl --request PUT --header PRIVATE-TOKEN: XXXXXXX https://git.host.com/api/v4/projects/16/merge_requests/572/rebase?skip_ci=true
{"rebase_in_progress":true}
I am also getting issue with skip_ci flag in rebase api. But for me skip_ci flag doesn’t skip pipeline all the time which is blocker for me in my gitlab repo.
My use case is:
Pipeline must succeed
feature is enabled from repo settings. Means pipeline can only merge when all pipeline will finish for the merge request.
I wrote a script which does rebase and merge MR automatically (both using gitlab api).
Now because skip_ci sometime creates new pipeline (not all the time), my merge api fails with error {“message”:“405 Method Not Allowed”} and I think this issue is because rebase api created new pipeline and Pipeline must succeed
is enable.
Note: My script waits to finish rebase process before do merge MR api.
Can you please help me, how to fix skip_ci flag in rebase api?
Gitlab runner version: tried with 12.2 and 12.9
Gitlab version: 12.9.2
More precise error about above pipeline issue is: it does’t skips deteched pipeline in rebase api with skip_ci flag.
I caught the same error like Pipeline must succeed
after put Gitlab API for rebase with skip_ci option.
My case is:
I’m using Merge Request Pipeline for a merge request. After the pipeline runs successfully, but unable to merge becase it requires a rebase my source branch to be able to merge into master branch.
Then I’ve used gitlab api to send a PUT request for rebase action with skip_ci option. But this action creates another Skipped Pipeline which resulted in my merge request showed Pipeline must succeed
error again.
I found that we can select Skipped pipelines are considered successful in project settings for Merge Request . See Merge when pipeline succeeds | GitLab, which allows us to merge a merge request with Skipped Pipeline