Manage GitLab Webhook
Since QuickBuild 15.0, you can manage GitLab Webhook settings via REST API.
API Permissions
The permissions for GitLab Webhook Configuration settings should be granted EDIT_SETTINGS of the configuration.
List GitLab Webhook Configuration Settings
GET /rest/webhook/gitlab/configuration_settings/{configurationId}
replace configurationId
to the actual id of the configuration you want.
By default, the media type of return result is XML, you can add request header Accept
to change the media type, for example, add below header to get JSON result:
Accept: application/json
Update GitHub Webhook Configuration Settings
POST /rest/webhook/gitlab/configuration_settings/{configurationId}
replace configurationId
to the actual id of the configuration you want.
{
"secret": "mysecretlife",
"username": "admin",
"condition": "target == \"android\"",
"variables": [
{
"name": "url",
"value": "http://localhost"
}
]
}
The fields above is same as what should be defined in UI.
secret
is the webhook secret which you should have defined in GitLab.username
is the QuickBuild user (username here) to trigger the build who should at least haveRUN_BUILD
permission for this configuration.condition
is an optional field which are some Groovy scripts to tell QuickBuild on which condition the build should be triggered.variables
is a list of build variables. Each variable should containname
and itsvalue
, all should be string type.
Delete GitLab Webhook Configuration Settings
DELETE /rest/webhook/gitlab/configuration_settings/{configurationId}
replace configurationId
to the actual id of the configuration you want.