Gitlab merge requests have label values that can be added and removed both programmatically and manually (by reviewers).
Gitlab has a Jenkins Integration setup that sends a JSON blob to Jenkins which contains the labels:
"labels": [
{
"id": 2132,
"title": "blocked",
"color": "#ffbb00",
"project_id": 29634,
"created_at": "2019-11-01 14:32:22 UTC",
"updated_at": "2020-05-12 15:52:22 UTC",
"template": false,
"description": "MR cannot be merged; rationale should be described in-line.",
"type": "ProjectLabel",
"group_id": null
},
{
"id": 1909,
"title": "ready for review",
"color": "#5843AD",
"project_id": 29634,
"created_at": "2019-08-19 23:59:00 UTC",
"updated_at": "2019-08-19 23:59:00 UTC",
"template": false,
"description": "",
"type": "ProjectLabel",
"group_id": null
}
],
The Jenkins Gitlab plugin intercepts that JSON blob and kicks off a test.
I am guessing that this JSON blob is written out to a data structure that I can access inside the scripted pipeline Jenkinsfile, but I can't find any documentation on how to extract values from it. I'd like to be able to check the labels that are present and then take different test actions based on the assigned labels.
How do I extract Gitlab JSON data inside of a scripted pipeline Jenkinsfile?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…