如何通过 jenkins 插件或命令行在 stash(Bitbucket Server) 上创建 Pull Request

How to create Pull Request on stash(Bitbucket Server) by jenkins plugins or command lines

我已经安装了 Stash pullrequest builder plugin。此插件用于通过读取 official introduction.

来构建 Pull Request

但我想知道这个插件是否会在 stash 上创建一个特定的 Pull Request。如果没有,我如何通过其他插件或命令行或手动在 stash 上创建?

您可以使用 Stash REST API 通过命令行创建拉取请求。

您必须向此 url 发送 json post 请求:

/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests

C 示例url:

curl -u your_stash_user:your_stash_password -H "Content-Type: application/json" -X POST -d '{JSON CONTENT}' http://your_stash_url/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests

Json 文件(从 Atlassian 文档复制):

{
    "title": "Talking Nerdy",
    "description": "It’s a kludge, but put the tuple from the database in the cache.",
    "state": "OPEN",
    "open": true,
    "closed": false,
    "fromRef": {
        "id": "refs/heads/feature-ABC-123",
        "repository": {
            "slug": "my-repo",
            "name": null,
            "project": {
                "key": "PRJ"
            }
        }
    },
    "toRef": {
        "id": "refs/heads/master",
        "repository": {
            "slug": "my-repo",
            "name": null,
            "project": {
                "key": "PRJ"
            }
        }
    },
    "locked": false,
    "reviewers": [
        {
            "user": {
                "name": "charlie"
            }
        }
    ]
}