Add ref parameter for triggerring builds with gitlab webhook from other project.
What does this MR do?
This MR makes it possible to trigger builds with webhook from another GitLab project.
Are there points in the code the reviewer needs to double check?
This MR changes the only line in file /lib/api/triggers.rb
.
Why was this MR needed?
Currently GitLab can trigger builds from external tools like curl.
But there is no way to trigger builds with webhook from another GitLab project.
Executing webhook like /projects/:id/trigger/builds?token=TOKEN&ref=master
results in such message from server:
400 No builds created
Problem is the ref from request body takes precedence of the ref from query string.
System tries to trigger build for nonexistent branch instead of master
.
This is the feature of the Grape framework used to build GitLab api.
This MR adds optional ref
parameter into the api url:
/projects/:id/ref/:ref/trigger/builds?token=TOKEN
This will lead that the ref in the url will have precedence of the ref inside request body.
This solution provides compability with current api urls.
Does this MR meet the acceptance criteria?
-
CHANGELOG entry added -
Documentation created/updated -
API support added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
Closes #23584 (closed)