我已经下载了scm-manager-cli
我需要通过CLI
在SCM经理中为GIT存储库设置分支写入保护我已经通过Web-App
设置了相同的设置我需要通过CLI作为自动化的一部分来做到这一点
如何做?
嗨,CLI当前不支持属性,但是您可以使用REST API设置属性:
curl -u scmadmin:scmadmin -v http://localhost:8080/scm/api/rest/repositories -XPOST -H 'Content-Type: application/json' -d '{
"name": "newrepository",
"description": "repository with branch protection",
"type": "git",
"properties": [
{ "key": "branchwp.enabled", "value": true },
{ "key": "branchwp.permissions", "value": "master,userone;develop,@devgroup;" }
],
"permissions": [
{ "name": "userone", "type": "WRITE", "groupPermission": false },
{ "name": "devgroup", "type": "WRITE", "groupPermission": true }
]
}'
上面的示例创建了一个具有启用分支保护的新存储库。